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

Unified Diff: third_party/WebKit/Source/core/dom/ContainerNode.cpp

Issue 1511523002: Align HTMLImageElement relevant mutations to spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix removal issue when a text node is between <source> and <img> Created 5 years 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/dom/ContainerNode.cpp
diff --git a/third_party/WebKit/Source/core/dom/ContainerNode.cpp b/third_party/WebKit/Source/core/dom/ContainerNode.cpp
index 380860b6f13af335379ef04f5c2677be1af494f2..3ab098c1a54a4d70b4cff42e37bd29263adaabd8 100644
--- a/third_party/WebKit/Source/core/dom/ContainerNode.cpp
+++ b/third_party/WebKit/Source/core/dom/ContainerNode.cpp
@@ -532,7 +532,7 @@ void ContainerNode::addChildNodesToDeletionQueue(Node*& head, Node*& tail, Conta
RefPtrWillBeRawPtr<Node> protect(n); // removedFromDocument may remove all references to this node.
container.document().adoptIfNeeded(*n);
if (n->inDocument())
- container.notifyNodeRemoved(*n);
+ container.notifyNodeRemoved(*n, next);
}
}
@@ -591,7 +591,7 @@ PassRefPtrWillBeRawPtr<Node> ContainerNode::removeChild(PassRefPtrWillBeRawPtr<N
Node* prev = child->previousSibling();
Node* next = child->nextSibling();
removeBetween(prev, next, *child);
- notifyNodeRemoved(*child);
+ notifyNodeRemoved(*child, next);
childrenChanged(ChildrenChange::forRemoval(*child, prev, next, ChildrenChangeSourceAPI));
}
dispatchSubtreeModifiedEvent();
@@ -643,7 +643,7 @@ void ContainerNode::parserRemoveChild(Node& oldChild)
Node* next = oldChild.nextSibling();
removeBetween(prev, next, oldChild);
- notifyNodeRemoved(oldChild);
+ notifyNodeRemoved(oldChild, next);
childrenChanged(ChildrenChange::forRemoval(oldChild, prev, next, ChildrenChangeSourceParser));
}
@@ -695,11 +695,12 @@ void ContainerNode::removeChildren(SubtreeModificationAction action)
removedChildren.reserveInitialCapacity(countChildren());
#endif
while (RefPtrWillBeRawPtr<Node> child = m_firstChild) {
- removeBetween(0, child->nextSibling(), *child);
+ Node* next = child->nextSibling();
+ removeBetween(nullptr, next, *child);
#if !ENABLE(OILPAN)
removedChildren.append(child.get());
#endif
- notifyNodeRemoved(*child);
+ notifyNodeRemoved(*child, next);
}
}
@@ -847,7 +848,7 @@ void ContainerNode::notifyNodeInsertedInternal(Node& root, NodeVector& postInser
}
}
-void ContainerNode::notifyNodeRemoved(Node& root)
+void ContainerNode::notifyNodeRemoved(Node& root, Node* next)
{
ScriptForbiddenScope forbidScript;
EventDispatchForbiddenScope assertNoEventDispatch;
@@ -858,9 +859,9 @@ void ContainerNode::notifyNodeRemoved(Node& root)
// call to removedFrom is not needed.
if (!node.isContainerNode() && !node.isInTreeScope())
continue;
- node.removedFrom(this);
+ node.removedFrom(this, node == root ? next : node.nextSibling());
esprehn 2015/12/14 22:49:42 Please revert this change, plumbing next through t
for (ShadowRoot* shadowRoot = node.youngestShadowRoot(); shadowRoot; shadowRoot = shadowRoot->olderShadowRoot())
- notifyNodeRemoved(*shadowRoot);
+ notifyNodeRemoved(*shadowRoot, next);
}
}

Powered by Google App Engine
This is Rietveld 408576698