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

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

Issue 2430253003: Get rid of createVisibleSelection() to take EphemeralRange (Closed)
Patch Set: 2016-10-20T14:03:19 Created 4 years, 2 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/VisibleSelection.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/Editor.cpp
diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp
index 79d11fcbd34a53523e68212d2143718f13b96867..248dfca935316916b2151ec98532b2a1a4e1e3fb 100644
--- a/third_party/WebKit/Source/core/editing/Editor.cpp
+++ b/third_party/WebKit/Source/core/editing/Editor.cpp
@@ -152,6 +152,8 @@ Editor::RevealSelectionScope::~RevealSelectionScope() {
// When an event handler has moved the selection outside of a text control
// we should use the target control's selection for this editing operation.
+// TODO(yosin): We should make |Editor::selectionForCommand()| to return
+// |SelectionInDOMTree| instead of |VisibleSelection|.
VisibleSelection Editor::selectionForCommand(Event* event) {
frame().selection().updateIfNeeded();
VisibleSelection selection = frame().selection().selection();
@@ -169,9 +171,11 @@ VisibleSelection Editor::selectionForCommand(Event* event) {
(selection.start().isNull() ||
textFromControlOfTarget != textFormControlOfSelectionStart)) {
if (Range* range = textFromControlOfTarget->selection()) {
- return createVisibleSelection(EphemeralRange(range),
- TextAffinity::Downstream,
- selection.isDirectional());
+ return createVisibleSelection(
+ SelectionInDOMTree::Builder()
+ .setBaseAndExtent(EphemeralRange(range))
+ .setIsDirectional(selection.isDirectional())
+ .build());
}
}
return selection;
@@ -1281,7 +1285,8 @@ void Editor::transpose() {
const EphemeralRange range = makeRange(previous, next);
if (range.isNull())
return;
- VisibleSelection newSelection = createVisibleSelection(range);
+ VisibleSelection newSelection = createVisibleSelection(
+ SelectionInDOMTree::Builder().setBaseAndExtent(range).build());
// Transpose the two characters.
String text = plainText(range);
@@ -1419,7 +1424,9 @@ bool Editor::findString(const String& target, FindOptions options) {
return false;
frame().selection().setSelection(
- createVisibleSelection(EphemeralRange(resultRange)));
+ SelectionInDOMTree::Builder()
+ .setBaseAndExtent(EphemeralRange(resultRange))
+ .build());
frame().selection().revealSelection();
return true;
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/VisibleSelection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698