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

Unified Diff: third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.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/ReplaceSelectionCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp b/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
index e2141461cfec85ff973897674e6afc3caae0ea83..ef5daa681aec935c002e414b18eed39926e3712b 100644
--- a/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp
@@ -1859,12 +1859,21 @@ void ReplaceSelectionCommand::completeHTMLReplacement(
document().updateStyleAndLayoutIgnorePendingStylesheets();
- if (m_selectReplacement)
+ if (m_selectReplacement) {
setEndingSelection(createVisibleSelection(
start, end, SelDefaultAffinity, endingSelection().isDirectional()));
- else
+ return;
+ }
+
+ if (end.isNotNull()) {
setEndingSelection(createVisibleSelection(
- end, SelDefaultAffinity, endingSelection().isDirectional()));
+ SelectionInDOMTree::Builder()
+ .collapse(end)
+ .setIsDirectional(endingSelection().isDirectional())
+ .build()));
+ return;
+ }
+ setEndingSelection(createVisibleSelection(SelectionInDOMTree()));
}
void ReplaceSelectionCommand::mergeTextNodesAroundPosition(

Powered by Google App Engine
This is Rietveld 408576698