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

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

Issue 2491763004: Revert of Utilize FrameSelection::setSelection() taking SelectionInDOMTree/SelectionInFlatTree (Closed)
Patch Set: Created 4 years, 1 month 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 00a2520dc2c8994200524371b14abf1677c16311..5d5d0f8854b232ae5e5d8ff88be24c42b2621ceb 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
@@ -457,7 +457,7 @@
selection().start().document()->layoutViewItem().clearSelection();
if (clearDOMTreeSelection)
- setSelection(SelectionInDOMTree(), DoNotSetFocus);
+ setSelection(VisibleSelection(), DoNotSetFocus);
m_frameCaret->setCaretRectNeedsUpdate();
// TODO(yosin): We should move to call |TypingCommand::closeTyping()| to
@@ -697,7 +697,7 @@
m_granularity = CharacterGranularity;
if (m_granularityStrategy)
m_granularityStrategy->Clear();
- setSelection(SelectionInDOMTree());
+ setSelection(VisibleSelection());
}
void FrameSelection::documentAttached(Document* document) {
@@ -851,8 +851,6 @@
// Focus on the parent frame, and then select from before this element to
// after.
VisibleSelection newSelection = createVisibleSelection(builder.build());
- // TODO(yosin): We should call |FocusController::setFocusedFrame()| before
- // |createVisibleSelection()|.
page->focusController().setFocusedFrame(parent);
// setFocusedFrame can dispatch synchronous focus/blur events. The document
// tree might be modified.
@@ -1294,12 +1292,13 @@
String text =
plainText(EphemeralRange(start.deepEquivalent(), end.deepEquivalent()));
if (!text.isEmpty() && !isSeparator(text.characterStartingAt(0))) {
- setSelection(SelectionInDOMTree::Builder()
- .collapse(start.toPositionWithAffinity())
- .extend(end.deepEquivalent())
- .build(),
- CloseTyping | ClearTypingStyle,
- CursorAlignOnScroll::IfNeeded, WordGranularity);
+ setSelection(
+ createVisibleSelection(SelectionInDOMTree::Builder()
+ .collapse(start.toPositionWithAffinity())
+ .extend(end.deepEquivalent())
+ .build()),
+ CloseTyping | ClearTypingStyle, CursorAlignOnScroll::IfNeeded,
+ WordGranularity);
return true;
}
}

Powered by Google App Engine
This is Rietveld 408576698