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

Unified Diff: third_party/WebKit/Source/core/editing/commands/InsertLineBreakCommand.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/InsertLineBreakCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/InsertLineBreakCommand.cpp b/third_party/WebKit/Source/core/editing/commands/InsertLineBreakCommand.cpp
index 0cafcb372a41132a804b2181dd01e546d0855991..13782f40fcfa1eb2c2ba1cf223e353a4b55691a7 100644
--- a/third_party/WebKit/Source/core/editing/commands/InsertLineBreakCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/InsertLineBreakCommand.cpp
@@ -148,8 +148,10 @@ void InsertLineBreakCommand::doApply(EditingState* editingState) {
}
setEndingSelection(createVisibleSelection(
- Position::inParentAfterNode(*nodeToInsert), TextAffinity::Downstream,
- endingSelection().isDirectional()));
+ SelectionInDOMTree::Builder()
+ .collapse(Position::inParentAfterNode(*nodeToInsert))
+ .setIsDirectional(endingSelection().isDirectional())
+ .build()));
// If we're inserting after all of the rendered text in a text node, or into
// a non-text node, a simple insertion is sufficient.
} else if (!pos.anchorNode()->isTextNode() ||
@@ -160,8 +162,10 @@ void InsertLineBreakCommand::doApply(EditingState* editingState) {
return;
document().updateStyleAndLayoutIgnorePendingStylesheets();
setEndingSelection(createVisibleSelection(
- Position::inParentAfterNode(*nodeToInsert), TextAffinity::Downstream,
- endingSelection().isDirectional()));
+ SelectionInDOMTree::Builder()
+ .collapse(Position::inParentAfterNode(*nodeToInsert))
+ .setIsDirectional(endingSelection().isDirectional())
+ .build()));
} else if (pos.anchorNode()->isTextNode()) {
// Split a text node
Text* textNode = toText(pos.anchorNode());
@@ -195,9 +199,11 @@ void InsertLineBreakCommand::doApply(EditingState* editingState) {
}
document().updateStyleAndLayoutIgnorePendingStylesheets();
- setEndingSelection(
- createVisibleSelection(endingPosition, TextAffinity::Downstream,
- endingSelection().isDirectional()));
+ setEndingSelection(createVisibleSelection(
+ SelectionInDOMTree::Builder()
+ .collapse(endingPosition)
+ .setIsDirectional(endingSelection().isDirectional())
+ .build()));
}
// Handle the case where there is a typing style.

Powered by Google App Engine
This is Rietveld 408576698