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

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

Issue 2450213002: Utilize EditCommand::setEndingSelection() taking SelectionInDOMTree (Closed)
Patch Set: 2016-10-27T18:27:07 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/ApplyBlockElementCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/ApplyBlockElementCommand.cpp b/third_party/WebKit/Source/core/editing/commands/ApplyBlockElementCommand.cpp
index 66f94dfea14d05f772c38f76d405c15bb8793101..86279dac0bb0cb1fca0356e595c5b1f709b331bb 100644
--- a/third_party/WebKit/Source/core/editing/commands/ApplyBlockElementCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/ApplyBlockElementCommand.cpp
@@ -89,7 +89,7 @@ void ApplyBlockElementCommand::doApply(EditingState* editingState) {
createVisibleSelection(builder.build());
if (newSelection.isNone())
return;
- setEndingSelection(newSelection);
+ setEndingSelection(builder.build());
}
VisibleSelection selection =
@@ -116,12 +116,12 @@ void ApplyBlockElementCommand::doApply(EditingState* editingState) {
VisiblePosition start(visiblePositionForIndex(startIndex, startScope));
VisiblePosition end(visiblePositionForIndex(endIndex, endScope));
if (start.isNotNull() && end.isNotNull()) {
- setEndingSelection(createVisibleSelection(
+ setEndingSelection(
SelectionInDOMTree::Builder()
.collapse(start.toPositionWithAffinity())
.extend(end.deepEquivalent())
.setIsDirectional(endingSelection().isDirectional())
- .build()));
+ .build());
}
}
}
@@ -148,12 +148,10 @@ void ApplyBlockElementCommand::formatSelection(
appendNode(placeholder, blockquote, editingState);
if (editingState->isAborted())
return;
- document().updateStyleAndLayoutIgnorePendingStylesheets();
- setEndingSelection(createVisibleSelection(
- SelectionInDOMTree::Builder()
- .collapse(Position::beforeNode(placeholder))
- .setIsDirectional(endingSelection().isDirectional())
- .build()));
+ setEndingSelection(SelectionInDOMTree::Builder()
+ .collapse(Position::beforeNode(placeholder))
+ .setIsDirectional(endingSelection().isDirectional())
+ .build());
return;
}

Powered by Google App Engine
This is Rietveld 408576698