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

Unified Diff: Source/WebCore/dom/ContainerNode.cpp

Issue 9641008: Merge 110139 - ContainerNode::willRemove uses a weak iteration pattern (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/963/
Patch Set: Created 8 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/dom/ContainerNode.cpp
===================================================================
--- Source/WebCore/dom/ContainerNode.cpp (revision 110139)
+++ Source/WebCore/dom/ContainerNode.cpp (working copy)
@@ -386,11 +386,14 @@
{
RefPtr<Node> protect(this);
- for (RefPtr<Node> child = firstChild(); child; child = child->nextSibling()) {
- if (child->parentNode() != this) // Check for child being removed from subtree while removing.
- break;
- child->willRemove();
+ NodeVector children;
+ collectNodes(this, children);
+ for (size_t i = 0; i < children.size(); ++i) {
+ if (children[i]->parentNode() != this) // Check for child being removed from subtree while removing.
+ continue;
+ children[i]->willRemove();
}
+
Node::willRemove();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698