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

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-24T16:38:25 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..d6d22b9620a4743d0c3a3bf3903a6d80eae35d20 100644
--- a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
@@ -195,10 +195,19 @@ void DeleteSelectionCommand::setStartingSelectionOnSmartDelete(
document().lifecycle());
bool isBaseFirst = startingSelection().isBaseFirst();
+ // TODO(yosin): We should not call |createVisiblePosition()| here and use
+ // |start| and |end| as base/extent since |VisibleSelection| also calls
+ // |createVisiblePosition()| during construction.
+ // Because of |newBase.affinity()| can be |Upstream|, we can't simply
+ // use |start| and |end| here.
VisiblePosition newBase = createVisiblePosition(isBaseFirst ? start : end);
VisiblePosition newExtent = createVisiblePosition(isBaseFirst ? end : start);
- setStartingSelection(createVisibleSelection(
- newBase, newExtent, startingSelection().isDirectional()));
+ SelectionInDOMTree::Builder builder;
+ builder.setAffinity(newBase.affinity())
+ .setBaseAndExtentDeprecated(newBase.deepEquivalent(),
+ newExtent.deepEquivalent())
+ .setIsDirectional(startingSelection().isDirectional());
+ setStartingSelection(createVisibleSelection(builder.build()));
}
void DeleteSelectionCommand::initializePositionData(

Powered by Google App Engine
This is Rietveld 408576698