Title: [149386] trunk/Source/WebCore
Revision
149386
Author
[email protected]
Date
2013-04-30 11:44:40 -0700 (Tue, 30 Apr 2013)

Log Message

Simplify ContainerNode::removeChildren
https://bugs.webkit.org/show_bug.cgi?id=115398

Reviewed by Andreas Kling.

Back port https://chromium.googlesource.com/chromium/blink/+/b981f01cd065236b5ff7e3a8446d15b384c1b557
by Andrei Bucur, which includes both this and his r148754.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (149385 => 149386)


--- trunk/Source/WebCore/ChangeLog	2013-04-30 18:38:06 UTC (rev 149385)
+++ trunk/Source/WebCore/ChangeLog	2013-04-30 18:44:40 UTC (rev 149386)
@@ -1,3 +1,16 @@
+2013-04-30  Ryosuke Niwa  <[email protected]>
+
+        Simplify ContainerNode::removeChildren
+        https://bugs.webkit.org/show_bug.cgi?id=115398
+
+        Reviewed by Andreas Kling.
+
+        Back port https://chromium.googlesource.com/chromium/blink/+/b981f01cd065236b5ff7e3a8446d15b384c1b557
+        by Andrei Bucur, which includes both this and his r148754.
+
+        * dom/ContainerNode.cpp:
+        (WebCore::ContainerNode::removeChildren):
+
 2013-04-30  Carlos Garcia Campos  <[email protected]>
 
         [SOUP] Move default buffer handling from ResourceHandleClient to ResourceHandlesoup

Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (149385 => 149386)


--- trunk/Source/WebCore/dom/ContainerNode.cpp	2013-04-30 18:38:06 UTC (rev 149385)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp	2013-04-30 18:44:40 UTC (rev 149386)
@@ -607,30 +607,15 @@
     // and remove... e.g. stop loading frames, fire unload events.
     willRemoveChildren(protect.get());
 
-    Vector<RefPtr<Node>, 10> removedChildren;
+    NodeVector removedChildren;
     {
         WidgetHierarchyUpdatesSuspensionScope suspendWidgetHierarchyUpdates;
         {
             NoEventDispatchAssertion assertNoEventDispatch;
             removedChildren.reserveInitialCapacity(childNodeCount());
             while (RefPtr<Node> n = m_firstChild) {
-                Node* next = n->nextSibling();
-
-                if (n->attached())
-                    n->detach();
-
-                n->setPreviousSibling(0);
-                n->setNextSibling(0);
-                n->setParentOrShadowHostNode(0);
-                document()->adoptIfNeeded(n.get());
-
-                m_firstChild = next;
-                if (n == m_lastChild)
-                    m_lastChild = 0;
-                else
-                    m_firstChild->setPreviousSibling(0);
-
-                removedChildren.append(n.release());
+                removedChildren.append(m_firstChild);
+                removeBetween(0, m_firstChild->nextSibling(), m_firstChild);
             }
         }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to