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

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

Issue 1695153002: Editing: Make the |EditingState*| argument of CompositeEditCommand::removeNode mandatory. (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/MoveSelectionCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/MoveSelectionCommand.cpp b/third_party/WebKit/Source/core/editing/commands/MoveSelectionCommand.cpp
index c1d25181ab7cff23f2fd7c21d9ba97be84c758b2..4a3af357d33f6dc952044525ad3cdfdb290997da 100644
--- a/third_party/WebKit/Source/core/editing/commands/MoveSelectionCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/MoveSelectionCommand.cpp
@@ -36,7 +36,7 @@ MoveSelectionCommand::MoveSelectionCommand(PassRefPtrWillBeRawPtr<DocumentFragme
ASSERT(m_fragment);
}
-void MoveSelectionCommand::doApply(EditingState*)
+void MoveSelectionCommand::doApply(EditingState* editingState)
{
ASSERT(endingSelection().isNonOrphanedRange());
@@ -55,7 +55,9 @@ void MoveSelectionCommand::doApply(EditingState*)
pos = Position(pos.computeContainerNode(), pos.offsetInContainerNode() + selectionStart.offsetInContainerNode());
}
- deleteSelection(ASSERT_NO_EDITING_ABORT, m_smartDelete);
+ deleteSelection(editingState, m_smartDelete);
+ if (editingState->isAborted())
+ return;
// If the node for the destination has been removed as a result of the deletion,
// set the destination to the ending point after the deletion.
@@ -64,7 +66,9 @@ void MoveSelectionCommand::doApply(EditingState*)
if (!pos.inDocument())
pos = endingSelection().start();
- cleanupAfterDeletion(createVisiblePosition(pos));
+ cleanupAfterDeletion(editingState, createVisiblePosition(pos));
+ if (editingState->isAborted())
+ return;
setEndingSelection(VisibleSelection(pos, endingSelection().affinity(), endingSelection().isDirectional()));
if (!pos.inDocument()) {
@@ -74,7 +78,7 @@ void MoveSelectionCommand::doApply(EditingState*)
ReplaceSelectionCommand::CommandOptions options = ReplaceSelectionCommand::SelectReplacement | ReplaceSelectionCommand::PreventNesting;
if (m_smartInsert)
options |= ReplaceSelectionCommand::SmartReplace;
- applyCommandToComposite(ReplaceSelectionCommand::create(document(), m_fragment, options));
+ applyCommandToComposite(ReplaceSelectionCommand::create(document(), m_fragment, options), editingState);
}
EditAction MoveSelectionCommand::editingAction() const

Powered by Google App Engine
This is Rietveld 408576698