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

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

Issue 1702233002: Editing: Make the |EditingState*| argument of CompositeEditCommand::insertNodeAt 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/ApplyStyleCommand.cpp
diff --git a/third_party/WebKit/Source/core/editing/commands/ApplyStyleCommand.cpp b/third_party/WebKit/Source/core/editing/commands/ApplyStyleCommand.cpp
index b9c419961c9cdf171ae52389cc8cf5d87dffbb50..4cc439468dce93cc9e9c9f09bc9e216c71c87088 100644
--- a/third_party/WebKit/Source/core/editing/commands/ApplyStyleCommand.cpp
+++ b/third_party/WebKit/Source/core/editing/commands/ApplyStyleCommand.cpp
@@ -882,8 +882,11 @@ void ApplyStyleCommand::applyInlineStyleToNodeRange(EditingStyle* style, PassRef
removeConflictingInlineStyleFromRun(style, run.start, run.end, run.pastEndNode, editingState);
if (editingState->isAborted())
return;
- if (run.startAndEndAreStillInDocument())
- run.positionForStyleComputation = positionToComputeInlineStyleChange(run.start, run.dummyElement);
+ if (run.startAndEndAreStillInDocument()) {
+ run.positionForStyleComputation = positionToComputeInlineStyleChange(run.start, run.dummyElement, editingState);
+ if (editingState->isAborted())
+ return;
+ }
}
document().updateLayoutIgnorePendingStylesheets();
@@ -1516,7 +1519,9 @@ void ApplyStyleCommand::addInlineStyleIfNeeded(EditingStyle* style, PassRefPtrWi
RefPtrWillBeRawPtr<Node> start = passedStart;
RefPtrWillBeMember<HTMLSpanElement> dummyElement = nullptr;
- StyleChange styleChange(style, positionToComputeInlineStyleChange(start, dummyElement));
+ StyleChange styleChange(style, positionToComputeInlineStyleChange(start, dummyElement, editingState));
+ if (editingState->isAborted())
+ return;
if (dummyElement) {
removeNode(dummyElement, editingState);
@@ -1527,12 +1532,14 @@ void ApplyStyleCommand::addInlineStyleIfNeeded(EditingStyle* style, PassRefPtrWi
applyInlineStyleChange(start, passedEnd, styleChange, DoNotAddStyledElement, editingState);
}
-Position ApplyStyleCommand::positionToComputeInlineStyleChange(PassRefPtrWillBeRawPtr<Node> startNode, RefPtrWillBeMember<HTMLSpanElement>& dummyElement)
+Position ApplyStyleCommand::positionToComputeInlineStyleChange(PassRefPtrWillBeRawPtr<Node> startNode, RefPtrWillBeMember<HTMLSpanElement>& dummyElement, EditingState* editingState)
{
// It's okay to obtain the style at the startNode because we've removed all relevant styles from the current run.
if (!startNode->isElementNode()) {
dummyElement = HTMLSpanElement::create(document());
- insertNodeAt(dummyElement, positionBeforeNode(startNode.get()));
+ insertNodeAt(dummyElement, positionBeforeNode(startNode.get()), editingState);
+ if (editingState->isAborted())
+ return Position();
return positionBeforeNode(dummyElement.get());
}

Powered by Google App Engine
This is Rietveld 408576698