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

Unified Diff: third_party/WebKit/Source/core/editing/commands/TypingCommand.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
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/TypingCommand.h ('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 d2dcf25653ee11abf4962c433afc7f6dbf378cfa..725c1b1b5f4508ab0de6a03e38e710bcb0d12bb7 100644
--- a/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp
@@ -386,7 +386,7 @@ void TypingCommand::insertParagraphSeparatorInQuotedContent()
typingAddedToOpenCommand(InsertParagraphSeparatorInQuotedContent);
}
-bool TypingCommand::makeEditableRootEmpty()
+bool TypingCommand::makeEditableRootEmpty(EditingState* editingState)
{
Element* root = endingSelection().rootEditableElement();
if (!root || !root->hasChildren())
@@ -400,8 +400,11 @@ bool TypingCommand::makeEditableRootEmpty()
}
}
- while (Node* child = root->firstChild())
- removeNode(child);
+ while (Node* child = root->firstChild()) {
+ removeNode(child, editingState);
+ if (editingState->isAborted())
+ return false;
+ }
addBlockPlaceholderIfNeeded(root);
setEndingSelection(VisibleSelection(firstPositionInNode(root), TextAffinity::Downstream, endingSelection().isDirectional()));
@@ -428,7 +431,10 @@ void TypingCommand::deleteKeyPressed(TextGranularity granularity, bool killRing,
case CaretSelection: {
// After breaking out of an empty mail blockquote, we still want continue with the deletion
// so actual content will get deleted, and not just the quote style.
- if (breakOutOfEmptyMailBlockquotedParagraph())
+ bool breakOutResult = breakOutOfEmptyMailBlockquotedParagraph(editingState);
+ if (editingState->isAborted())
+ return;
+ if (breakOutResult)
typingAddedToOpenCommand(DeleteKey);
m_smartDelete = false;
@@ -442,15 +448,20 @@ void TypingCommand::deleteKeyPressed(TextGranularity granularity, bool killRing,
VisiblePosition visibleStart(endingSelection().visibleStart());
if (previousPositionOf(visibleStart, CannotCrossEditingBoundary).isNull()) {
// When the caret is at the start of the editable area in an empty list item, break out of the list item.
- if (breakOutOfEmptyListItem()) {
+ bool breakOutOfEmptyListItemResult = breakOutOfEmptyListItem(editingState);
+ if (editingState->isAborted())
+ return;
+ if (breakOutOfEmptyListItemResult) {
typingAddedToOpenCommand(DeleteKey);
return;
}
// When there are no visible positions in the editing root, delete its entire contents.
- if (nextPositionOf(visibleStart, CannotCrossEditingBoundary).isNull() && makeEditableRootEmpty()) {
+ if (nextPositionOf(visibleStart, CannotCrossEditingBoundary).isNull() && makeEditableRootEmpty(editingState)) {
typingAddedToOpenCommand(DeleteKey);
return;
}
+ if (editingState->isAborted())
+ return;
}
// If we have a caret selection at the beginning of a cell, we have nothing to do.
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/TypingCommand.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698