Chromium Code Reviews| Index: third_party/WebKit/Source/core/editing/commands/InsertTextCommand.cpp |
| diff --git a/third_party/WebKit/Source/core/editing/commands/InsertTextCommand.cpp b/third_party/WebKit/Source/core/editing/commands/InsertTextCommand.cpp |
| index dedda26481f4c9ea7ab4887abc8ff1ddb2f2dde7..14c5a770488618459a3703e134801fbd9025e835 100644 |
| --- a/third_party/WebKit/Source/core/editing/commands/InsertTextCommand.cpp |
| +++ b/third_party/WebKit/Source/core/editing/commands/InsertTextCommand.cpp |
| @@ -79,10 +79,11 @@ void InsertTextCommand::setEndingSelectionWithoutValidation( |
| // We could have inserted a part of composed character sequence, |
| // so we are basically treating ending selection as a range to avoid |
| // validation. <http://bugs.webkit.org/show_bug.cgi?id=15781> |
| - VisibleSelection forcedEndingSelection; |
| - forcedEndingSelection.setWithoutValidation(startPosition, endPosition); |
| - forcedEndingSelection.setIsDirectional(endingSelection().isDirectional()); |
| - setEndingSelection(forcedEndingSelection); |
| + setEndingSelection(SelectionInDOMTree::Builder() |
| + .collapse(startPosition) |
| + .extend(endPosition) |
| + .setIsDirectional(endingSelection().isDirectional()) |
| + .build()); |
| } |
| // This avoids the expense of a full fledged delete operation, and avoids a |
| @@ -103,12 +104,10 @@ bool InsertTextCommand::performTrivialReplace(const String& text, |
| setEndingSelectionWithoutValidation(start, endPosition); |
| if (selectInsertedText) |
| return true; |
| - document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| - setEndingSelection(createVisibleSelection( |
| - SelectionInDOMTree::Builder() |
| - .collapse(endingSelection().end()) |
| - .setIsDirectional(endingSelection().isDirectional()) |
| - .build())); |
| + setEndingSelection(SelectionInDOMTree::Builder() |
| + .collapse(endingSelection().end()) |
| + .setIsDirectional(endingSelection().isDirectional()) |
| + .build()); |
| return true; |
| } |
| @@ -137,11 +136,10 @@ bool InsertTextCommand::performOverwrite(const String& text, |
| document().updateStyleAndLayoutIgnorePendingStylesheets(); |
|
Xiaocheng
2016/10/28 02:25:26
This one can also be removed.
yosin_UTC9
2016/10/28 06:06:49
Done.
|
| if (endingSelection().isNone()) |
| return true; |
| - setEndingSelection(createVisibleSelection( |
| - SelectionInDOMTree::Builder() |
| - .collapse(endingSelection().end()) |
| - .setIsDirectional(endingSelection().isDirectional()) |
| - .build())); |
| + setEndingSelection(SelectionInDOMTree::Builder() |
| + .collapse(endingSelection().end()) |
| + .setIsDirectional(endingSelection().isDirectional()) |
| + .build()); |
| return true; |
| } |
| @@ -282,13 +280,12 @@ void InsertTextCommand::doApply(EditingState* editingState) { |
| } |
| if (!m_selectInsertedText) { |
| - document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| SelectionInDOMTree::Builder builder; |
| builder.setAffinity(endingSelection().affinity()); |
| builder.setIsDirectional(endingSelection().isDirectional()); |
| if (endingSelection().end().isNotNull()) |
| builder.collapse(endingSelection().end()); |
| - setEndingSelection(createVisibleSelection(builder.build())); |
| + setEndingSelection(builder.build()); |
| } |
| } |