Title: [110140] branches/chromium/963/Source/WebCore/dom/ContainerNode.cpp
Revision
110140
Author
infe...@chromium.org
Date
2012-03-07 20:16:56 -0800 (Wed, 07 Mar 2012)

Log Message

Merge 110139 - ContainerNode::willRemove uses a weak iteration pattern
https://bugs.webkit.org/show_bug.cgi?id=80530

Reviewed by Ryosuke Niwa.

This patch moves ContainerNode::willRemove to using a better iteration
pattern in which we collect all the nodes we're planning to iterate
into a vector and then iterate over them.

* dom/ContainerNode.cpp:
(WebCore::ContainerNode::willRemove):


TBR=aba...@webkit.org
Review URL: https://chromiumcodereview.appspot.com/9641008

Modified Paths

Diff

Modified: branches/chromium/963/Source/WebCore/dom/ContainerNode.cpp (110139 => 110140)


--- branches/chromium/963/Source/WebCore/dom/ContainerNode.cpp	2012-03-08 04:08:41 UTC (rev 110139)
+++ branches/chromium/963/Source/WebCore/dom/ContainerNode.cpp	2012-03-08 04:16:56 UTC (rev 110140)
@@ -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();
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to