Commit afbef274 authored by rniwa@webkit.org's avatar rniwa@webkit.org

2011-05-08 Ryosuke Niwa <rniwa@webkit.org>

        Reviewed by Darin Adler.

        Extract a DragCaretController from FrameSelection
        https://bugs.webkit.org/show_bug.cgi?id=60273

        Extracted CaretBase and DragCaretController from FrameSelection. CaretBase is a base class for
        DragCaretController and FrameSelection and provides functions to paint caret.

        Since DragCaretController doesn't need to store selection, it only holds one VisiblePosition.

        * WebCore.exp.in:
        * editing/FrameSelection.cpp:
        (WebCore::CaretBase::CaretBase): Added.
        (WebCore::DragCaretController::DragCaretController): Added; Set m_caretVisible true.
        (WebCore::DragCaretController::isContentRichlyEditable): Added.
        (WebCore::FrameSelection::FrameSelection): Several member variables are move to CaretBase.
        (WebCore::DragCaretController::setCaretPosition): Extracted from FrameSelection::setSelection.
        (WebCore::FrameSelection::setSelection): Removed an early exit for DragCaretController.
        (WebCore::clearRenderViewSelection): Extracted from FrameSelection::respondToNodeModification.
        (WebCore::DragCaretController::nodeWillBeRemoved): Extracted from FrameSelection::nodeWillBeRemoved
        and respondToNodeModification. Note that the position DragCaretController holds is equivalent to
        FrameSelection's base or start so when removingNodeRemovesPosition returns true for m_position,
        we used to execute the first if clause and cleared render tree selection and DOM tree selection.
        This is exactly what new DragCaretController::nodeWillBeRemoved does.
        (WebCore::FrameSelection::nodeWillBeRemoved): Simplified early exist conditions.
        (WebCore::FrameSelection::respondToNodeModification): Calls clearRenderViewSelection.
        (WebCore::CaretBase::updateCaretRect): Takes document, caretPosition, selection type, and boolean isOrphaned.
        Note that we can't obtain the document from caretPosition because VisiblePosition can be null even if
        FrameSelection's start was not null.
        (WebCore::caretRendersInsideNode): Moved; Made static local.
        (WebCore::CaretBase::caretRenderer): Extracted from FrameSelection::caretRenderer.
        (WebCore::FrameSelection::caretRenderer): Calls CaretBase::caretRenderer.
        (WebCore::DragCaretController::caretRenderer): Ditto.
        (WebCore::FrameSelection::localCaretRect): Calls updateCaretRect with extra arguments.
        (WebCore::CaretBase::absoluteBoundsForLocalRect): Moved from FrameSelection; Takes Node*.
        (WebCore::CaretBase::caretRepaintRect): Ditto.
        (WebCore::FrameSelection::recomputeCaretRect): Calls absoluteBoundsForLocalRect, caretRepaintRect,
        and shouldRepaintCaret with extra arguments.
        (WebCore::CaretBase::shouldRepaintCaret): Takes a boolean isContentEditable.
        (WebCore::FrameSelection::invalidateCaretRect): Calls CaretBase::invalidateCaretRect.
        (WebCore::CaretBase::invalidateCaretRect): Extracted from FrameSelection::invalidateCaretRect.
        (WebCore::FrameSelection::paintCaret): Calls CaretBase::paintCaret.
        (WebCore::CaretBase::paintCaret): Extracted from FrameSelection::paintCaret.
        (WebCore::FrameSelection::updateAppearance): Removed an assertion that this function is never called for
        DragCaretController.
        (WebCore::DragCaretController::paintDragCaret): Moved from FrameSelection::paintDragCaret.
        * editing/FrameSelection.h:
        (WebCore::CaretBase::localCaretRectForPainting): Added.
        (WebCore::DragCaretController::isContentEditable): Added.
        (WebCore::DragCaretController::hasCaret): Added.
        (WebCore::DragCaretController::caretPosition): Added.
        (WebCore::DragCaretController::clear): Added.
        * page/DragController.cpp:
        (WebCore::DragController::tryDocumentDrag): Uses DragCaretController.
        (WebCore::DragController::dispatchTextInputEventFor): Ditto.
        (WebCore::DragController::concludeEditDrag): Ditto.
        (WebCore::DragController::placeDragCaret): Ditto.
        * page/Page.cpp:
        (WebCore::Page::Page): Instantiates DragCaretController instead of FrameSelection.
        * page/Page.h:
        (WebCore::Page::dragCaretController): Returns DragCaretController* instead of FrameSelection*.
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::paintCaret): Uses FrameSelection and DragCaretController.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@86039 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2e498e75
2011-05-08 Ryosuke Niwa <rniwa@webkit.org>
Reviewed by Darin Adler.
Extract a DragCaretController from FrameSelection
https://bugs.webkit.org/show_bug.cgi?id=60273
Extracted CaretBase and DragCaretController from FrameSelection. CaretBase is a base class for
DragCaretController and FrameSelection and provides functions to paint caret.
Since DragCaretController doesn't need to store selection, it only holds one VisiblePosition.
* WebCore.exp.in:
* editing/FrameSelection.cpp:
(WebCore::CaretBase::CaretBase): Added.
(WebCore::DragCaretController::DragCaretController): Added; Set m_caretVisible true.
(WebCore::DragCaretController::isContentRichlyEditable): Added.
(WebCore::FrameSelection::FrameSelection): Several member variables are move to CaretBase.
(WebCore::DragCaretController::setCaretPosition): Extracted from FrameSelection::setSelection.
(WebCore::FrameSelection::setSelection): Removed an early exit for DragCaretController.
(WebCore::clearRenderViewSelection): Extracted from FrameSelection::respondToNodeModification.
(WebCore::DragCaretController::nodeWillBeRemoved): Extracted from FrameSelection::nodeWillBeRemoved
and respondToNodeModification. Note that the position DragCaretController holds is equivalent to
FrameSelection's base or start so when removingNodeRemovesPosition returns true for m_position,
we used to execute the first if clause and cleared render tree selection and DOM tree selection.
This is exactly what new DragCaretController::nodeWillBeRemoved does.
(WebCore::FrameSelection::nodeWillBeRemoved): Simplified early exist conditions.
(WebCore::FrameSelection::respondToNodeModification): Calls clearRenderViewSelection.
(WebCore::CaretBase::updateCaretRect): Takes document, caretPosition, selection type, and boolean isOrphaned.
Note that we can't obtain the document from caretPosition because VisiblePosition can be null even if
FrameSelection's start was not null.
(WebCore::caretRendersInsideNode): Moved; Made static local.
(WebCore::CaretBase::caretRenderer): Extracted from FrameSelection::caretRenderer.
(WebCore::FrameSelection::caretRenderer): Calls CaretBase::caretRenderer.
(WebCore::DragCaretController::caretRenderer): Ditto.
(WebCore::FrameSelection::localCaretRect): Calls updateCaretRect with extra arguments.
(WebCore::CaretBase::absoluteBoundsForLocalRect): Moved from FrameSelection; Takes Node*.
(WebCore::CaretBase::caretRepaintRect): Ditto.
(WebCore::FrameSelection::recomputeCaretRect): Calls absoluteBoundsForLocalRect, caretRepaintRect,
and shouldRepaintCaret with extra arguments.
(WebCore::CaretBase::shouldRepaintCaret): Takes a boolean isContentEditable.
(WebCore::FrameSelection::invalidateCaretRect): Calls CaretBase::invalidateCaretRect.
(WebCore::CaretBase::invalidateCaretRect): Extracted from FrameSelection::invalidateCaretRect.
(WebCore::FrameSelection::paintCaret): Calls CaretBase::paintCaret.
(WebCore::CaretBase::paintCaret): Extracted from FrameSelection::paintCaret.
(WebCore::FrameSelection::updateAppearance): Removed an assertion that this function is never called for
DragCaretController.
(WebCore::DragCaretController::paintDragCaret): Moved from FrameSelection::paintDragCaret.
* editing/FrameSelection.h:
(WebCore::CaretBase::localCaretRectForPainting): Added.
(WebCore::DragCaretController::isContentEditable): Added.
(WebCore::DragCaretController::hasCaret): Added.
(WebCore::DragCaretController::caretPosition): Added.
(WebCore::DragCaretController::clear): Added.
* page/DragController.cpp:
(WebCore::DragController::tryDocumentDrag): Uses DragCaretController.
(WebCore::DragController::dispatchTextInputEventFor): Ditto.
(WebCore::DragController::concludeEditDrag): Ditto.
(WebCore::DragController::placeDragCaret): Ditto.
* page/Page.cpp:
(WebCore::Page::Page): Instantiates DragCaretController instead of FrameSelection.
* page/Page.h:
(WebCore::Page::dragCaretController): Returns DragCaretController* instead of FrameSelection*.
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paintCaret): Uses FrameSelection and DragCaretController.
2011-05-08 Dan Bernstein <mitz@apple.com> 2011-05-08 Dan Bernstein <mitz@apple.com>
Reviewed by Darin Adler. Reviewed by Darin Adler.
...@@ -356,7 +356,7 @@ __ZN7WebCore14FrameSelection20setSelectionFromNoneEv ...@@ -356,7 +356,7 @@ __ZN7WebCore14FrameSelection20setSelectionFromNoneEv
__ZN7WebCore14FrameSelection6modifyENS0_11EAlterationENS_18SelectionDirectionENS_15TextGranularityEb __ZN7WebCore14FrameSelection6modifyENS0_11EAlterationENS_18SelectionDirectionENS_15TextGranularityEb
__ZN7WebCore14FrameSelection5clearEv __ZN7WebCore14FrameSelection5clearEv
__ZN7WebCore14FrameSelection9selectAllEv __ZN7WebCore14FrameSelection9selectAllEv
__ZN7WebCore14FrameSelectionC1EPNS_5FrameEb __ZN7WebCore14FrameSelectionC1EPNS_5FrameE
__ZN7WebCore14ResourceHandle12releaseProxyEv __ZN7WebCore14ResourceHandle12releaseProxyEv
__ZN7WebCore14ResourceHandle20forceContentSniffingEv __ZN7WebCore14ResourceHandle20forceContentSniffingEv
__ZN7WebCore14ResourceLoader14cancelledErrorEv __ZN7WebCore14ResourceLoader14cancelledErrorEv
......
This diff is collapsed.
...@@ -48,7 +48,58 @@ class VisiblePosition; ...@@ -48,7 +48,58 @@ class VisiblePosition;
enum DirectionalityPolicy { MakeNonDirectionalSelection, MakeDirectionalSelection }; enum DirectionalityPolicy { MakeNonDirectionalSelection, MakeDirectionalSelection };
class FrameSelection { class CaretBase {
WTF_MAKE_NONCOPYABLE(CaretBase);
WTF_MAKE_FAST_ALLOCATED;
protected:
CaretBase();
void invalidateCaretRect(Node*, bool caretRectChanged = false);
void updateCaretRect(Document*, const VisiblePosition& caretPosition, VisibleSelection::SelectionType, bool isOrphaned);
IntRect absoluteBoundsForLocalRect(Node*, const IntRect&) const;
IntRect absoluteCaretBounds(bool isContentEditable);
IntRect caretRepaintRect(Node*) const;
bool shouldRepaintCaret(const RenderView*, bool isContentEditable) const;
IntRect localCaretRectForPainting() const { return m_caretRect; }
void paintCaret(Node*, GraphicsContext*, int tx, int ty, const IntRect& clipRect) const;
RenderObject* caretRenderer(Node*) const;
IntRect m_caretRect; // caret rect in coords local to the renderer responsible for painting the caret
IntRect m_absCaretBounds; // absolute bounding rect for the caret
IntRect m_absoluteCaretRepaintBounds;
bool m_caretRectNeedsUpdate; // true if m_caretRect and m_absCaretBounds need to be calculated
bool m_absCaretBoundsDirty;
bool m_caretVisible;
bool m_caretPaint;
};
class DragCaretController : private CaretBase {
WTF_MAKE_NONCOPYABLE(DragCaretController);
WTF_MAKE_FAST_ALLOCATED;
public:
DragCaretController();
RenderObject* caretRenderer() const;
void paintDragCaret(Frame*, GraphicsContext*, int tx, int ty, const IntRect& clipRect) const;
bool isContentEditable() const { return m_position.rootEditableElement(); }
bool isContentRichlyEditable() const;
bool hasCaret() const { return m_position.isNotNull(); }
const VisiblePosition& caretPosition() { return m_position; }
void setCaretPosition(const VisiblePosition&);
void clear() { setCaretPosition(VisiblePosition()); }
void nodeWillBeRemoved(Node*);
private:
VisiblePosition m_position;
};
class FrameSelection : private CaretBase {
WTF_MAKE_NONCOPYABLE(FrameSelection); WTF_MAKE_NONCOPYABLE(FrameSelection);
WTF_MAKE_FAST_ALLOCATED; WTF_MAKE_FAST_ALLOCATED;
public: public:
...@@ -63,7 +114,7 @@ public: ...@@ -63,7 +114,7 @@ public:
}; };
typedef unsigned SetSelectionOptions; typedef unsigned SetSelectionOptions;
FrameSelection(Frame* = 0, bool isDragCaretController = false); FrameSelection(Frame* = 0);
Element* rootEditableElement() const { return m_selection.rootEditableElement(); } Element* rootEditableElement() const { return m_selection.rootEditableElement(); }
bool isContentEditable() const { return m_selection.isContentEditable(); } bool isContentEditable() const { return m_selection.isContentEditable(); }
...@@ -114,7 +165,6 @@ public: ...@@ -114,7 +165,6 @@ public:
// Caret rect local to the caret's renderer // Caret rect local to the caret's renderer
IntRect localCaretRect(); IntRect localCaretRect();
IntRect localCaretRectForPainting() const { return m_caretRect; }
// Bounds of (possibly transformed) caret in absolute coords // Bounds of (possibly transformed) caret in absolute coords
IntRect absoluteCaretBounds(); IntRect absoluteCaretBounds();
...@@ -139,7 +189,7 @@ public: ...@@ -139,7 +189,7 @@ public:
void setCaretVisible(bool = true); void setCaretVisible(bool = true);
void clearCaretRectIfNeeded(); void clearCaretRectIfNeeded();
bool recomputeCaretRect(); // returns true if caret rect moved bool recomputeCaretRect();
void invalidateCaretRect(); void invalidateCaretRect();
void paintCaret(GraphicsContext*, int tx, int ty, const IntRect& clipRect); void paintCaret(GraphicsContext*, int tx, int ty, const IntRect& clipRect);
...@@ -203,18 +253,11 @@ private: ...@@ -203,18 +253,11 @@ private:
VisiblePosition modifyMovingLeft(TextGranularity); VisiblePosition modifyMovingLeft(TextGranularity);
VisiblePosition modifyMovingBackward(TextGranularity); VisiblePosition modifyMovingBackward(TextGranularity);
void updateCaretRect();
IntRect caretRepaintRect() const;
bool shouldRepaintCaret(const RenderView* view) const;
int xPosForVerticalArrowNavigation(EPositionType); int xPosForVerticalArrowNavigation(EPositionType);
void notifyAccessibilityForSelectionChange(); void notifyAccessibilityForSelectionChange();
void focusedOrActiveStateChanged(); void focusedOrActiveStateChanged();
bool caretRendersInsideNode(Node*) const;
IntRect absoluteBoundsForLocalRect(const IntRect&) const;
void caretBlinkTimerFired(Timer<FrameSelection>*); void caretBlinkTimerFired(Timer<FrameSelection>*);
...@@ -231,18 +274,9 @@ private: ...@@ -231,18 +274,9 @@ private:
Timer<FrameSelection> m_caretBlinkTimer; Timer<FrameSelection> m_caretBlinkTimer;
IntRect m_caretRect; // caret rect in coords local to the renderer responsible for painting the caret
IntRect m_absCaretBounds; // absolute bounding rect for the caret
IntRect m_absoluteCaretRepaintBounds;
bool m_caretRectNeedsUpdate; // true if m_caretRect and m_absCaretBounds need to be calculated
bool m_absCaretBoundsDirty;
bool m_isDirectional; bool m_isDirectional;
bool m_isDragCaretController;
bool m_isCaretBlinkingSuspended; bool m_isCaretBlinkingSuspended;
bool m_focused; bool m_focused;
bool m_caretVisible;
bool m_caretPaint;
}; };
inline EditingStyle* FrameSelection::typingStyle() const inline EditingStyle* FrameSelection::typingStyle() const
......
...@@ -330,10 +330,8 @@ bool DragController::tryDocumentDrag(DragData* dragData, DragDestinationAction a ...@@ -330,10 +330,8 @@ bool DragController::tryDocumentDrag(DragData* dragData, DragDestinationAction a
Element* element = elementUnderMouse(m_documentUnderMouse.get(), point); Element* element = elementUnderMouse(m_documentUnderMouse.get(), point);
if (!element) if (!element)
return false; return false;
if (!asFileInput(element)) { if (!asFileInput(element))
VisibleSelection dragCaret = m_documentUnderMouse->frame()->visiblePositionForPoint(point); m_page->dragCaretController()->setCaretPosition(m_documentUnderMouse->frame()->visiblePositionForPoint(point));
m_page->dragCaretController()->setSelection(dragCaret);
}
Frame* innerFrame = element->document()->frame(); Frame* innerFrame = element->document()->frame();
operation = dragIsMove(innerFrame->selection(), dragData) ? DragOperationMove : DragOperationCopy; operation = dragIsMove(innerFrame->selection(), dragData) ? DragOperationMove : DragOperationCopy;
...@@ -372,10 +370,9 @@ static bool setSelectionToDragCaret(Frame* frame, VisibleSelection& dragCaret, R ...@@ -372,10 +370,9 @@ static bool setSelectionToDragCaret(Frame* frame, VisibleSelection& dragCaret, R
bool DragController::dispatchTextInputEventFor(Frame* innerFrame, DragData* dragData) bool DragController::dispatchTextInputEventFor(Frame* innerFrame, DragData* dragData)
{ {
ASSERT(!m_page->dragCaretController()->isNone()); ASSERT(m_page->dragCaretController()->hasCaret());
VisibleSelection dragCaret(m_page->dragCaretController()->selection()); String text = m_page->dragCaretController()->isContentRichlyEditable() ? "" : dragData->asPlainText(innerFrame);
String text = dragCaret.isContentRichlyEditable() ? "" : dragData->asPlainText(innerFrame); Node* target = innerFrame->editor()->findEventTargetFrom(m_page->dragCaretController()->caretPosition());
Node* target = innerFrame->editor()->findEventTargetFrom(dragCaret);
ExceptionCode ec = 0; ExceptionCode ec = 0;
return target->dispatchEvent(TextEvent::createForDrop(innerFrame->domWindow(), text), ec); return target->dispatchEvent(TextEvent::createForDrop(innerFrame->domWindow(), text), ec);
} }
...@@ -395,7 +392,7 @@ bool DragController::concludeEditDrag(DragData* dragData) ...@@ -395,7 +392,7 @@ bool DragController::concludeEditDrag(DragData* dragData)
Frame* innerFrame = element->ownerDocument()->frame(); Frame* innerFrame = element->ownerDocument()->frame();
ASSERT(innerFrame); ASSERT(innerFrame);
if (!m_page->dragCaretController()->isNone() && !dispatchTextInputEventFor(innerFrame, dragData)) if (m_page->dragCaretController()->hasCaret() && !dispatchTextInputEventFor(innerFrame, dragData))
return true; return true;
if (dragData->containsColor()) { if (dragData->containsColor()) {
...@@ -441,7 +438,7 @@ bool DragController::concludeEditDrag(DragData* dragData) ...@@ -441,7 +438,7 @@ bool DragController::concludeEditDrag(DragData* dragData)
return true; return true;
} }
VisibleSelection dragCaret(m_page->dragCaretController()->selection()); VisibleSelection dragCaret = m_page->dragCaretController()->caretPosition();
m_page->dragCaretController()->clear(); m_page->dragCaretController()->clear();
RefPtr<Range> range = dragCaret.toNormalizedRange(); RefPtr<Range> range = dragCaret.toNormalizedRange();
...@@ -851,8 +848,8 @@ void DragController::placeDragCaret(const IntPoint& windowPoint) ...@@ -851,8 +848,8 @@ void DragController::placeDragCaret(const IntPoint& windowPoint)
if (!frameView) if (!frameView)
return; return;
IntPoint framePoint = frameView->windowToContents(windowPoint); IntPoint framePoint = frameView->windowToContents(windowPoint);
VisibleSelection dragCaret(frame->visiblePositionForPoint(framePoint));
m_page->dragCaretController()->setSelection(dragCaret); m_page->dragCaretController()->setCaretPosition(frame->visiblePositionForPoint(framePoint));
} }
} // namespace WebCore } // namespace WebCore
......
...@@ -115,7 +115,7 @@ static void networkStateChanged() ...@@ -115,7 +115,7 @@ static void networkStateChanged()
Page::Page(const PageClients& pageClients) Page::Page(const PageClients& pageClients)
: m_chrome(adoptPtr(new Chrome(this, pageClients.chromeClient))) : m_chrome(adoptPtr(new Chrome(this, pageClients.chromeClient)))
, m_dragCaretController(adoptPtr(new FrameSelection(0, true))) , m_dragCaretController(adoptPtr(new DragCaretController))
#if ENABLE(DRAG_SUPPORT) #if ENABLE(DRAG_SUPPORT)
, m_dragController(adoptPtr(new DragController(this, pageClients.dragClient))) , m_dragController(adoptPtr(new DragController(this, pageClients.dragClient)))
#endif #endif
......
...@@ -54,6 +54,7 @@ namespace WebCore { ...@@ -54,6 +54,7 @@ namespace WebCore {
class DeviceOrientationClient; class DeviceOrientationClient;
class DeviceOrientationController; class DeviceOrientationController;
class Document; class Document;
class DragCaretController;
class DragClient; class DragClient;
class DragController; class DragController;
class EditorClient; class EditorClient;
...@@ -165,7 +166,7 @@ namespace WebCore { ...@@ -165,7 +166,7 @@ namespace WebCore {
int frameCount() const { checkFrameCountConsistency(); return m_frameCount; } int frameCount() const { checkFrameCountConsistency(); return m_frameCount; }
Chrome* chrome() const { return m_chrome.get(); } Chrome* chrome() const { return m_chrome.get(); }
FrameSelection* dragCaretController() const { return m_dragCaretController.get(); } DragCaretController* dragCaretController() const { return m_dragCaretController.get(); }
#if ENABLE(DRAG_SUPPORT) #if ENABLE(DRAG_SUPPORT)
DragController* dragController() const { return m_dragController.get(); } DragController* dragController() const { return m_dragController.get(); }
#endif #endif
...@@ -315,7 +316,7 @@ namespace WebCore { ...@@ -315,7 +316,7 @@ namespace WebCore {
double minimumTimerInterval() const; double minimumTimerInterval() const;
OwnPtr<Chrome> m_chrome; OwnPtr<Chrome> m_chrome;
OwnPtr<FrameSelection> m_dragCaretController; OwnPtr<DragCaretController> m_dragCaretController;
#if ENABLE(ACCELERATED_2D_CANVAS) #if ENABLE(ACCELERATED_2D_CANVAS)
RefPtr<SharedGraphicsContext3D> m_sharedGraphicsContext3D; RefPtr<SharedGraphicsContext3D> m_sharedGraphicsContext3D;
......
...@@ -2429,12 +2429,19 @@ void RenderBlock::paintChildren(PaintInfo& paintInfo, int tx, int ty) ...@@ -2429,12 +2429,19 @@ void RenderBlock::paintChildren(PaintInfo& paintInfo, int tx, int ty)
void RenderBlock::paintCaret(PaintInfo& paintInfo, int tx, int ty, CaretType type) void RenderBlock::paintCaret(PaintInfo& paintInfo, int tx, int ty, CaretType type)
{ {
FrameSelection* selection = type == CursorCaret ? frame()->selection() : frame()->page()->dragCaretController();
// Paint the caret if the FrameSelection says so or if caret browsing is enabled // Paint the caret if the FrameSelection says so or if caret browsing is enabled
bool caretBrowsing = frame()->settings() && frame()->settings()->caretBrowsingEnabled(); bool caretBrowsing = frame()->settings() && frame()->settings()->caretBrowsingEnabled();
RenderObject* caretPainter = selection->caretRenderer(); RenderObject* caretPainter;
if (caretPainter == this && (selection->isContentEditable() || caretBrowsing)) { bool isContentEditable;
if (type == CursorCaret) {
caretPainter = frame()->selection()->caretRenderer();
isContentEditable = frame()->selection()->isContentEditable();
} else {
caretPainter = frame()->page()->dragCaretController()->caretRenderer();
isContentEditable = frame()->page()->dragCaretController()->isContentEditable();
}
if (caretPainter == this && (isContentEditable || caretBrowsing)) {
// Convert the painting offset into the local coordinate system of this renderer, // Convert the painting offset into the local coordinate system of this renderer,
// to match the localCaretRect computed by the FrameSelection // to match the localCaretRect computed by the FrameSelection
offsetForContents(tx, ty); offsetForContents(tx, ty);
...@@ -2442,7 +2449,7 @@ void RenderBlock::paintCaret(PaintInfo& paintInfo, int tx, int ty, CaretType typ ...@@ -2442,7 +2449,7 @@ void RenderBlock::paintCaret(PaintInfo& paintInfo, int tx, int ty, CaretType typ
if (type == CursorCaret) if (type == CursorCaret)
frame()->selection()->paintCaret(paintInfo.context, tx, ty, paintInfo.rect); frame()->selection()->paintCaret(paintInfo.context, tx, ty, paintInfo.rect);
else else
frame()->selection()->paintDragCaret(paintInfo.context, tx, ty, paintInfo.rect); frame()->page()->dragCaretController()->paintDragCaret(frame(), paintInfo.context, tx, ty, paintInfo.rect);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment