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

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

Issue 2437873008: Get rid of flat tree version of createVisibleSelection() taking two VisiblePosition (Closed)
Patch Set: 2016-10-24T13:35:49 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/InsertListCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp b/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp
index 9b16ad8b03461d9d3aa4b3a398bacf613c3a16ce..799b67dc1bdd03601102179e1ef1c88ede986ba7 100644
--- a/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/InsertListCommand.cpp
@@ -155,10 +155,14 @@ void InsertListCommand::doApply(EditingState* editingState) {
// consistent and then use a left margin/padding rule here.
if (visibleEnd.deepEquivalent() != visibleStart.deepEquivalent() &&
isStartOfParagraph(visibleEnd, CanSkipOverEditingBoundary)) {
- setEndingSelection(createVisibleSelection(
- visibleStart,
- previousPositionOf(visibleEnd, CannotCrossEditingBoundary),
- endingSelection().isDirectional()));
+ const VisiblePosition& newEnd =
+ previousPositionOf(visibleEnd, CannotCrossEditingBoundary);
+ SelectionInDOMTree::Builder builder;
+ builder.setIsDirectional(endingSelection().isDirectional());
+ builder.collapse(visibleStart.toPositionWithAffinity());
+ if (newEnd.isNotNull())
+ builder.extend(newEnd.deepEquivalent());
+ setEndingSelection(createVisibleSelection(builder.build()));
if (!endingSelection().rootEditableElement())
return;
}
@@ -277,9 +281,14 @@ void InsertListCommand::doApply(EditingState* editingState) {
visibleStartOfSelection = createVisiblePosition(startOfSelection);
}
- setEndingSelection(
- createVisibleSelection(visibleStartOfSelection, visibleEndOfSelection,
- endingSelection().isDirectional()));
+ setEndingSelection(createVisibleSelection(
+ SelectionInDOMTree::Builder()
+ .setAffinity(visibleStartOfSelection.affinity())
+ .setBaseAndExtentDeprecated(
+ visibleStartOfSelection.deepEquivalent(),
+ visibleEndOfSelection.deepEquivalent())
+ .setIsDirectional(endingSelection().isDirectional())
+ .build()));
return;
}

Powered by Google App Engine
This is Rietveld 408576698