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

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

Issue 1679253002: Editing: Add EditingState* argument to EditCommand::doApply. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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/CompositeEditCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
index dd1327455efe5d5134b05cb4e36ed88788a43003..4a16fbaf8489e75bd1374dadd932b130f358de62 100644
--- a/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/CompositeEditCommand.cpp
@@ -204,7 +204,8 @@ void CompositeEditCommand::apply()
ASSERT(frame);
{
EventQueueScope eventQueueScope;
- doApply();
+ EditingState editingState;
+ doApply(&editingState);
}
// Only need to call appliedEditing for top-level commands,
@@ -246,11 +247,15 @@ void CompositeEditCommand::setShouldRetainAutocorrectionIndicator(bool)
//
// sugary-sweet convenience functions to help create and apply edit commands in composite commands
//
-void CompositeEditCommand::applyCommandToComposite(PassRefPtrWillBeRawPtr<EditCommand> prpCommand)
+void CompositeEditCommand::applyCommandToComposite(PassRefPtrWillBeRawPtr<EditCommand> prpCommand, EditingState* editingState)
{
RefPtrWillBeRawPtr<EditCommand> command = prpCommand;
command->setParent(this);
- command->doApply();
+ command->doApply(editingState);
+ if (editingState->isAborted()) {
+ command->setParent(nullptr);
+ return;
+ }
if (command->isSimpleEditCommand()) {
command->setParent(0);
ensureComposition()->append(toSimpleEditCommand(command.get()));
@@ -258,15 +263,16 @@ void CompositeEditCommand::applyCommandToComposite(PassRefPtrWillBeRawPtr<EditCo
m_commands.append(command.release());
}
-void CompositeEditCommand::applyCommandToComposite(PassRefPtrWillBeRawPtr<CompositeEditCommand> command, const VisibleSelection& selection)
+void CompositeEditCommand::applyCommandToComposite(PassRefPtrWillBeRawPtr<CompositeEditCommand> command, const VisibleSelection& selection, EditingState* editingState)
{
command->setParent(this);
if (!equalSelectionsInDOMTree(selection, command->endingSelection())) {
command->setStartingSelection(selection);
command->setEndingSelection(selection);
}
- command->doApply();
- m_commands.append(command);
+ command->doApply(editingState);
+ if (!editingState->isAborted())
+ m_commands.append(command);
}
void CompositeEditCommand::applyStyle(const EditingStyle* style, EditAction editingAction)

Powered by Google App Engine
This is Rietveld 408576698