Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(542)

Unified Diff: third_party/WebKit/Source/core/editing/FrameSelection.cpp

Issue 2161373002: Make FrameCaret to retrieve caret position from SelectionEditor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2016-07-21T11:26:04 Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/FrameSelection.cpp
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.cpp b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
index 640ef906d0bcba14e48e5c56267935d6899ce6ed..09fa2b222b7d4e2e3a48046b3730e87d0ffc6d81 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
@@ -99,7 +99,7 @@ FrameSelection::FrameSelection(LocalFrame* frame)
, m_granularity(CharacterGranularity)
, m_xPosForVerticalArrowNavigation(NoXPosForVerticalArrowNavigation())
, m_focused(frame->page() && frame->page()->focusController().focusedFrame() == frame)
- , m_frameCaret(new FrameCaret(frame))
+ , m_frameCaret(new FrameCaret(frame, *m_selectionEditor))
{
DCHECK(frame);
}
@@ -320,10 +320,7 @@ void FrameSelection::setSelectionAlgorithm(const VisibleSelectionTemplate<Strate
const VisibleSelection oldSelectionInDOMTree = selection();
m_selectionEditor->setVisibleSelection(s, options);
- if (s.isCaret())
- m_frameCaret->setCaretPosition(PositionWithAffinity(toPositionInDOMTree(s.start()), s.affinity()));
- else
- m_frameCaret->clear();
+ m_frameCaret->setCaretRectNeedsUpdate();
if (!s.isNone() && !(options & DoNotSetFocus)) {
setFocusedNodeIfNeeded();
@@ -477,15 +474,9 @@ void FrameSelection::respondToNodeModification(Node& node, bool baseRemoved, boo
if (clearLayoutTreeSelection)
selection().start().document()->layoutViewItem().clearSelection();
- if (clearDOMTreeSelection) {
+ if (clearDOMTreeSelection)
setSelection(VisibleSelection(), DoNotSetFocus);
- } else {
- const VisibleSelection& selection = m_selectionEditor->visibleSelection<EditingStrategy>();
- if (selection.isCaret())
- m_frameCaret->setCaretPosition(PositionWithAffinity(selection.start(), selection.affinity()));
- else
- m_frameCaret->clear();
- }
+ m_frameCaret->setCaretRectNeedsUpdate();
// TODO(yosin): We should move to call |TypingCommand::closeTyping()| to
// |Editor| class.
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameCaret.cpp ('k') | third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698