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

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

Issue 2457613004: Utilize FrameSelection::setSelection() taking SelectionInDOMTree/SelectionInFlatTree (Closed)
Patch Set: 2016-11-24T13:04:01 Rebase 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 640f1249421f1a3cec7f4b07b00a8e7f40253a7c..fb32a3b60e7b131193bf0472f24214d9cd59dce6 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
@@ -457,7 +457,7 @@ void FrameSelection::respondToNodeModification(Node& node,
selection().start().document()->layoutViewItem().clearSelection();
if (clearDOMTreeSelection)
- setSelection(VisibleSelection(), DoNotSetFocus);
+ setSelection(SelectionInDOMTree(), DoNotSetFocus);
m_frameCaret->setCaretRectNeedsUpdate();
// TODO(yosin): We should move to call |TypingCommand::closeTyping()| to
@@ -693,7 +693,7 @@ void FrameSelection::clear() {
m_granularity = CharacterGranularity;
if (m_granularityStrategy)
m_granularityStrategy->Clear();
- setSelection(VisibleSelection());
+ setSelection(SelectionInDOMTree());
}
void FrameSelection::documentAttached(Document* document) {
@@ -847,6 +847,8 @@ void FrameSelection::selectFrameElementInParentIfFullySelected() {
// 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.
@@ -1296,13 +1298,12 @@ bool FrameSelection::selectWordAroundPosition(const VisiblePosition& position) {
String text =
plainText(EphemeralRange(start.deepEquivalent(), end.deepEquivalent()));
if (!text.isEmpty() && !isSeparator(text.characterStartingAt(0))) {
- setSelection(
- createVisibleSelection(SelectionInDOMTree::Builder()
- .collapse(start.toPositionWithAffinity())
- .extend(end.deepEquivalent())
- .build()),
- CloseTyping | ClearTypingStyle, CursorAlignOnScroll::IfNeeded,
- WordGranularity);
+ setSelection(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