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

Unified Diff: third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp

Issue 2437873008: Get rid of flat tree version of createVisibleSelection() taking two VisiblePosition (Closed)
Patch Set: 2016-10-21T16:03:11 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
Index: third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
index 35896331fcbb1286c3761f16dcdd8b571467f10e..73960d9c443878e62cf59cd5f8e553933676e77d 100644
--- a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
@@ -197,8 +197,17 @@ void DeleteSelectionCommand::setStartingSelectionOnSmartDelete(
bool isBaseFirst = startingSelection().isBaseFirst();
VisiblePosition newBase = createVisiblePosition(isBaseFirst ? start : end);
VisiblePosition newExtent = createVisiblePosition(isBaseFirst ? end : start);
- setStartingSelection(createVisibleSelection(
- newBase, newExtent, startingSelection().isDirectional()));
+ SelectionInDOMTree::Builder builder;
+ builder.setIsDirectional(startingSelection().isDirectional());
+ if (newBase.isNotNull() && newExtent.isNotNull()) {
Xiaocheng 2016/10/21 11:18:36 Let's use setBaseAndExtentDeprecated, as having a
yosin_UTC9 2016/10/24 06:19:44 Done.
+ builder.collapse(newBase.deepEquivalent())
+ .extend(newExtent.deepEquivalent());
+ } else if (newBase.isNotNull()) {
+ builder.collapse(newBase.deepEquivalent());
+ } else if (newExtent.isNotNull()) {
+ builder.collapse(newExtent.deepEquivalent());
+ }
+ setStartingSelection(createVisibleSelection(builder.build()));
}
void DeleteSelectionCommand::initializePositionData(

Powered by Google App Engine
This is Rietveld 408576698