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

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

Issue 1703903002: Editing: Remove unreasonable ASSERT_NO_EDITING_ABORT instances. (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/SimplifyMarkupCommand.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/SimplifyMarkupCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/SimplifyMarkupCommand.cpp b/third_party/WebKit/Source/core/editing/commands/SimplifyMarkupCommand.cpp
index 9817935187aa1756086de52f12e6f0b8001477d8..359b0f20e0ce1e25cfdf796f11ec5f05c6a4b278 100644
--- a/third_party/WebKit/Source/core/editing/commands/SimplifyMarkupCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/SimplifyMarkupCommand.cpp
@@ -38,7 +38,7 @@ SimplifyMarkupCommand::SimplifyMarkupCommand(Document& document, Node* firstNode
{
}
-void SimplifyMarkupCommand::doApply(EditingState*)
+void SimplifyMarkupCommand::doApply(EditingState* editingState)
{
ContainerNode* rootNode = m_firstNode->parentNode();
WillBeHeapVector<RefPtrWillBeMember<ContainerNode>> nodesToRemove;
@@ -88,15 +88,19 @@ void SimplifyMarkupCommand::doApply(EditingState*)
// we perform all the DOM mutations at once.
for (size_t i = 0; i < nodesToRemove.size(); ++i) {
// FIXME: We can do better by directly moving children from nodesToRemove[i].
- int numPrunedAncestors = pruneSubsequentAncestorsToRemove(nodesToRemove, i);
+ int numPrunedAncestors = pruneSubsequentAncestorsToRemove(nodesToRemove, i, editingState);
+ if (editingState->isAborted())
+ return;
if (numPrunedAncestors < 0)
continue;
- removeNodePreservingChildren(nodesToRemove[i], ASSERT_NO_EDITING_ABORT, AssumeContentIsAlwaysEditable);
+ removeNodePreservingChildren(nodesToRemove[i], editingState, AssumeContentIsAlwaysEditable);
+ if (editingState->isAborted())
+ return;
i += numPrunedAncestors;
}
}
-int SimplifyMarkupCommand::pruneSubsequentAncestorsToRemove(WillBeHeapVector<RefPtrWillBeMember<ContainerNode>>& nodesToRemove, size_t startNodeIndex)
+int SimplifyMarkupCommand::pruneSubsequentAncestorsToRemove(WillBeHeapVector<RefPtrWillBeMember<ContainerNode>>& nodesToRemove, size_t startNodeIndex, EditingState* editingState)
{
size_t pastLastNodeToRemove = startNodeIndex + 1;
for (; pastLastNodeToRemove < nodesToRemove.size(); ++pastLastNodeToRemove) {
@@ -113,9 +117,15 @@ int SimplifyMarkupCommand::pruneSubsequentAncestorsToRemove(WillBeHeapVector<Ref
if (pastLastNodeToRemove == startNodeIndex + 1)
return 0;
- removeNode(nodesToRemove[startNodeIndex], ASSERT_NO_EDITING_ABORT, AssumeContentIsAlwaysEditable);
- insertNodeBefore(nodesToRemove[startNodeIndex], highestAncestorToRemove, ASSERT_NO_EDITING_ABORT, AssumeContentIsAlwaysEditable);
- removeNode(highestAncestorToRemove, ASSERT_NO_EDITING_ABORT, AssumeContentIsAlwaysEditable);
+ removeNode(nodesToRemove[startNodeIndex], editingState, AssumeContentIsAlwaysEditable);
+ if (editingState->isAborted())
+ return -1;
+ insertNodeBefore(nodesToRemove[startNodeIndex], highestAncestorToRemove, editingState, AssumeContentIsAlwaysEditable);
+ if (editingState->isAborted())
+ return -1;
+ removeNode(highestAncestorToRemove, editingState, AssumeContentIsAlwaysEditable);
+ if (editingState->isAborted())
+ return -1;
return pastLastNodeToRemove - startNodeIndex - 1;
}
« no previous file with comments | « third_party/WebKit/Source/core/editing/commands/SimplifyMarkupCommand.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698