Remove unused attachChildrenLazily method and make attach/detachChildren private

No one should be manually trying to attach or detach all their children so there's
no reason for these methods to be public.

In doing this I realized that attachChildrenLazily is not used and can be removed.

I also realized that we were detaching all our children before the ShadowRoots which
is sad since the InsertionPoints will call detach() on them as well, and then when we
call ContainerNode::detach at the end of Element::detach we'll go detach them again!
This patch makes it so we only go through and detach them twice instead of three times.
In the future we should figure out a way to only do this once.

Review URL: https://chromiumcodereview.appspot.com/17512006

git-svn-id: svn://svn.chromium.org/blink/trunk@152841 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/Source/core/dom/ContainerNode.h b/Source/core/dom/ContainerNode.h
index 1af8909..28dea40 100644
--- a/Source/core/dom/ContainerNode.h
+++ b/Source/core/dom/ContainerNode.h
@@ -127,11 +127,6 @@
     // node that is of the type CDATA_SECTION_NODE, TEXT_NODE or COMMENT_NODE has changed its value.
     virtual void childrenChanged(bool createdByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
 
-    void attachChildren(const AttachContext& = AttachContext());
-    void attachChildrenLazily();
-    void detachChildren(const AttachContext& = AttachContext());
-    void detachChildrenIfNeeded(const AttachContext& = AttachContext());
-
     void disconnectDescendantFrames();
 
     virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const { return true; }
@@ -158,6 +153,9 @@
     void removeBetween(Node* previousChild, Node* nextChild, Node* oldChild);
     void insertBeforeCommon(Node* nextChild, Node* oldChild);
 
+    void attachChildren(const AttachContext& = AttachContext());
+    void detachChildren(const AttachContext& = AttachContext());
+
     static void dispatchPostAttachCallbacks();
 
     void suspendPostAttachCallbacks();
@@ -208,24 +206,6 @@
     }
 }
 
-inline void ContainerNode::attachChildrenLazily()
-{
-    for (Node* child = firstChild(); child; child = child->nextSibling())
-        if (!child->attached())
-            child->lazyAttach();
-}
-
-inline void ContainerNode::detachChildrenIfNeeded(const AttachContext& context)
-{
-    AttachContext childrenContext(context);
-    childrenContext.resolvedStyle = 0;
-
-    for (Node* child = firstChild(); child; child = child->nextSibling()) {
-        if (child->attached())
-            child->detach(childrenContext);
-    }
-}
-
 inline void ContainerNode::detachChildren(const AttachContext& context)
 {
     AttachContext childrenContext(context);
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index 23631f8..ecaa500 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -1351,11 +1351,8 @@
         data->resetComputedStyle();
         data->resetDynamicRestyleObservations();
     }
-
-    if (ElementShadow* shadow = this->shadow()) {
-        detachChildrenIfNeeded(context);
+    if (ElementShadow* shadow = this->shadow())
         shadow->detach(context);
-    }
     ContainerNode::detach(context);
 }