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

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

Issue 2442673002: Get rid of createVisibleSelection() taking one Position (Closed)
Patch Set: 2016-10-24T17:42:38 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..bf5bf306a9fe6bba874b49b62263a9b53d834a69 100644
--- a/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/DeleteSelectionCommand.cpp
@@ -1093,8 +1093,12 @@ void DeleteSelectionCommand::doApply(EditingState* editingState) {
if (brResult) {
calculateTypingStyleAfterDelete();
document().updateStyleAndLayoutIgnorePendingStylesheets();
- setEndingSelection(createVisibleSelection(
- m_endingPosition, affinity, endingSelection().isDirectional()));
+ SelectionInDOMTree::Builder builder;
+ builder.setAffinity(affinity);
+ builder.setIsDirectional(endingSelection().isDirectional());
+ if (m_endingPosition.isNotNull())
+ builder.collapse(m_endingPosition);
+ setEndingSelection(createVisibleSelection(builder.build()));
clearTransientState();
rebalanceWhitespace();
return;
@@ -1150,8 +1154,12 @@ void DeleteSelectionCommand::doApply(EditingState* editingState) {
document().updateStyleAndLayoutIgnorePendingStylesheets();
- setEndingSelection(createVisibleSelection(m_endingPosition, affinity,
- endingSelection().isDirectional()));
+ SelectionInDOMTree::Builder builder;
+ builder.setAffinity(affinity);
+ builder.setIsDirectional(endingSelection().isDirectional());
+ if (m_endingPosition.isNotNull())
+ builder.collapse(m_endingPosition);
+ setEndingSelection(createVisibleSelection(builder.build()));
if (relocatableReferencePosition.position().isNull()) {
clearTransientState();

Powered by Google App Engine
This is Rietveld 408576698