From 68513a70bcd92384395513322f1b801e7bf9c729 Mon Sep 17 00:00:00 2001 From: Steve Block Date: Wed, 29 Sep 2010 17:32:26 +0100 Subject: Merge WebKit at r67908: Initial merge by Git Change-Id: I43a553e7b3299b28cb6ee8aa035ed70fe342b972 --- WebCore/dom/ContainerNode.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'WebCore/dom/ContainerNode.cpp') diff --git a/WebCore/dom/ContainerNode.cpp b/WebCore/dom/ContainerNode.cpp index 46de749..2dd50bb 100644 --- a/WebCore/dom/ContainerNode.cpp +++ b/WebCore/dom/ContainerNode.cpp @@ -72,7 +72,6 @@ void ContainerNode::removeAllChildren() removeAllChildrenInContainer(this); } - void ContainerNode::takeAllChildrenFrom(ContainerNode* oldParent) { NodeVector children; @@ -82,10 +81,14 @@ void ContainerNode::takeAllChildrenFrom(ContainerNode* oldParent) for (unsigned i = 0; i < children.size(); ++i) { ExceptionCode ec = 0; + if (children[i]->attached()) + children[i]->detach(); // FIXME: We need a no mutation event version of adoptNode. RefPtr child = document()->adoptNode(children[i].release(), ec); ASSERT(!ec); - parserAddChild(child.release()); + parserAddChild(child.get()); + if (attached() && !child->attached()) + child->attach(); } } @@ -359,9 +362,7 @@ static void willRemoveChild(Node* child) // fire removed from document mutation events. dispatchChildRemovalEvents(child); - - if (child->attached()) - child->willRemove(); + child->willRemove(); } static void willRemoveChildren(ContainerNode* container) @@ -373,9 +374,7 @@ static void willRemoveChildren(ContainerNode* container) for (RefPtr child = container->firstChild(); child; child = child->nextSibling()) { // fire removed from document mutation events. dispatchChildRemovalEvents(child.get()); - - if (child->attached()) - child->willRemove(); + child->willRemove(); } } -- cgit v1.1