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

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

Issue 2450213002: Utilize EditCommand::setEndingSelection() taking SelectionInDOMTree (Closed)
Patch Set: 2016-10-28T14:44:14 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
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp b/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp
index ad433857fa01eb0e489aaafa53e76fb08ae67168..b97f20d46406a4151c8943e0a646d69701948d6e 100644
--- a/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp
@@ -157,7 +157,7 @@ void TypingCommand::updateSelectionIfDifferentFromCurrentSelection(
return;
typingCommand->setStartingSelection(currentSelection);
- typingCommand->setEndingSelection(currentSelection);
+ typingCommand->setEndingVisibleSelection(currentSelection);
}
static String dispatchBeforeTextInsertedEvent(
@@ -218,7 +218,7 @@ void TypingCommand::insertText(Document& document,
lastTypingCommandIfStillOpenForTyping(frame)) {
if (lastTypingCommand->endingSelection() != selectionForInsertion) {
lastTypingCommand->setStartingSelection(selectionForInsertion);
- lastTypingCommand->setEndingSelection(selectionForInsertion);
+ lastTypingCommand->setEndingVisibleSelection(selectionForInsertion);
}
lastTypingCommand->setCompositionType(compositionType);
@@ -238,11 +238,11 @@ void TypingCommand::insertText(Document& document,
bool changeSelection = selectionForInsertion != currentSelection;
if (changeSelection) {
command->setStartingSelection(selectionForInsertion);
- command->setEndingSelection(selectionForInsertion);
+ command->setEndingVisibleSelection(selectionForInsertion);
}
command->apply();
if (changeSelection) {
- command->setEndingSelection(currentSelection);
+ command->setEndingVisibleSelection(currentSelection);
frame->selection().setSelection(currentSelection);
}
}
@@ -512,12 +512,10 @@ bool TypingCommand::makeEditableRootEmpty(EditingState* editingState) {
addBlockPlaceholderIfNeeded(root, editingState);
if (editingState->isAborted())
return false;
- document().updateStyleAndLayoutIgnorePendingStylesheets();
- setEndingSelection(createVisibleSelection(
- SelectionInDOMTree::Builder()
- .collapse(Position::firstPositionInNode(root))
- .setIsDirectional(endingSelection().isDirectional())
- .build()));
+ setEndingSelection(SelectionInDOMTree::Builder()
+ .collapse(Position::firstPositionInNode(root))
+ .setIsDirectional(endingSelection().isDirectional())
+ .build());
return true;
}
@@ -611,12 +609,12 @@ void TypingCommand::deleteKeyPressed(TextGranularity granularity,
// If the caret is just after a table, select the table and don't delete
// anything.
} else if (Element* table = tableElementJustBefore(visibleStart)) {
- setEndingSelection(createVisibleSelection(
+ setEndingSelection(
SelectionInDOMTree::Builder()
.collapse(Position::beforeNode(table))
.extend(endingSelection().start())
.setIsDirectional(endingSelection().isDirectional())
- .build()));
+ .build());
typingAddedToOpenCommand(DeleteKey);
return;
}
@@ -732,13 +730,13 @@ void TypingCommand::forwardDeleteKeyPressed(TextGranularity granularity,
if (isDisplayInsideTable(downstreamEnd.computeContainerNode()) &&
downstreamEnd.computeOffsetInContainerNode() <=
caretMinOffset(downstreamEnd.computeContainerNode())) {
- setEndingSelection(createVisibleSelection(
+ setEndingSelection(
SelectionInDOMTree::Builder()
.setBaseAndExtentDeprecated(
endingSelection().end(),
Position::afterNode(downstreamEnd.computeContainerNode()))
.setIsDirectional(endingSelection().isDirectional())
- .build()));
+ .build());
typingAddedToOpenCommand(ForwardDeleteKey);
return;
}
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/ReplaceSelectionCommand.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698