Title: [161142] trunk/Source/WebCore
Revision
161142
Author
an...@apple.com
Date
2013-12-30 06:47:44 -0800 (Mon, 30 Dec 2013)

Log Message

Remove attachChild
https://bugs.webkit.org/show_bug.cgi?id=126288

Reviewed by Andreas Kling.

* dom/ContainerNode.cpp:
(WebCore::destroyRenderTreeIfNeeded):
        
    Rename detachChild and move the tests here.

(WebCore::ContainerNode::takeAllChildrenFrom):
        
    No need to call attachRenderTree explicitly anymore.

(WebCore::ContainerNode::removeBetween):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (161141 => 161142)


--- trunk/Source/WebCore/ChangeLog	2013-12-30 14:13:19 UTC (rev 161141)
+++ trunk/Source/WebCore/ChangeLog	2013-12-30 14:47:44 UTC (rev 161142)
@@ -1,3 +1,21 @@
+2013-12-30  Antti Koivisto  <an...@apple.com>
+
+        Remove attachChild
+        https://bugs.webkit.org/show_bug.cgi?id=126288
+
+        Reviewed by Andreas Kling.
+
+        * dom/ContainerNode.cpp:
+        (WebCore::destroyRenderTreeIfNeeded):
+        
+            Rename detachChild and move the tests here.
+
+        (WebCore::ContainerNode::takeAllChildrenFrom):
+        
+            No need to call attachRenderTree explicitly anymore.
+
+        (WebCore::ContainerNode::removeBetween):
+
 2013-12-29  Andreas Kling  <akl...@apple.com>
 
         RenderLayer: Store corner and resizer renderers in RenderPtrs.

Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (161141 => 161142)


--- trunk/Source/WebCore/dom/ContainerNode.cpp	2013-12-30 14:13:19 UTC (rev 161141)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp	2013-12-30 14:47:44 UTC (rev 161142)
@@ -104,17 +104,12 @@
     removeDetachedChildrenInContainer<Node, ContainerNode>(*this);
 }
 
-static inline void attachChild(Node& child)
+static inline void destroyRenderTreeIfNeeded(Node& child)
 {
+    // FIXME: Get rid of the named flow test.
+    if (!child.renderer() && !child.inNamedFlow())
+        return;
     if (child.isElementNode())
-        Style::attachRenderTree(toElement(child));
-    else if (child.isTextNode())
-        Style::attachTextRenderer(toText(child));
-}
-
-static inline void detachChild(Node& child)
-{
-    if (child.isElementNode())
         Style::detachRenderTree(toElement(child));
     else if (child.isTextNode())
         Style::detachTextRenderer(toText(child));
@@ -140,9 +135,9 @@
 
     for (unsigned i = 0; i < children.size(); ++i) {
         Node& child = children[i].get();
-        if (child.renderer())
-            detachChild(child);
 
+        destroyRenderTreeIfNeeded(child);
+
         // FIXME: We need a no mutation event version of adoptNode.
         RefPtr<Node> adoptedChild = document().adoptNode(&children[i].get(), ASSERT_NO_EXCEPTION);
         parserAppendChild(adoptedChild.get());
@@ -150,8 +145,6 @@
         // (if the document changed or oldParent was in a shadow tree, AND *this is in a shadow tree).
         // Can we do better?
         treeScope().adoptIfNeeded(adoptedChild.get());
-        if (renderer() && !adoptedChild->renderer())
-            attachChild(*adoptedChild.get());
     }
 }
 
@@ -593,10 +586,7 @@
 
     ASSERT(oldChild.parentNode() == this);
 
-    // Remove from rendering tree
-    // FIXME: Get rid of the named flow test.
-    if (oldChild.renderer() || oldChild.inNamedFlow())
-        detachChild(oldChild);
+    destroyRenderTreeIfNeeded(oldChild);
 
     if (nextChild)
         nextChild->setPreviousSibling(previousChild);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to