| Index: Source/core/dom/ContainerNode.cpp
|
| diff --git a/Source/core/dom/ContainerNode.cpp b/Source/core/dom/ContainerNode.cpp
|
| index 90240809e8c6a21176a52c3d228d33db50a65b2a..d047971b7d714e2b124ddc50bc3cbf70a890b069 100644
|
| --- a/Source/core/dom/ContainerNode.cpp
|
| +++ b/Source/core/dom/ContainerNode.cpp
|
| @@ -97,7 +97,7 @@ void ContainerNode::takeAllChildrenFrom(ContainerNode* oldParent)
|
|
|
| for (unsigned i = 0; i < children.size(); ++i) {
|
| if (children[i]->attached())
|
| - children[i]->detach();
|
| + children[i]->destroyRenderTree();
|
| // FIXME: We need a no mutation event version of adoptNode.
|
| RefPtr<Node> child = document().adoptNode(children[i].release(), ASSERT_NO_EXCEPTION);
|
| // FIXME: Together with adoptNode above, the tree scope might get updated recursively twice
|
| @@ -498,7 +498,7 @@ void ContainerNode::removeBetween(Node* previousChild, Node* nextChild, Node* ol
|
|
|
| // Remove from rendering tree
|
| if (oldChild->attached())
|
| - oldChild->detach();
|
| + oldChild->destroyRenderTree();
|
|
|
| if (nextChild)
|
| nextChild->setPreviousSibling(previousChild);
|
| @@ -666,18 +666,31 @@ void ContainerNode::parserAppendChild(PassRefPtr<Node> newChild)
|
| ChildNodeInsertionNotifier(this).notify(newChild.get());
|
| }
|
|
|
| -void ContainerNode::attach(const AttachContext& context)
|
| +void ContainerNode::createRenderTree(const AttachContext& context)
|
| {
|
| - attachChildren(context);
|
| + AttachContext childrenContext(context);
|
| + childrenContext.resolvedStyle = 0;
|
| +
|
| + for (Node* child = firstChild(); child; child = child->nextSibling()) {
|
| + ASSERT(!child->attached() || childAttachedAllowedWhenAttachingChildren(this));
|
| + if (!child->attached())
|
| + child->createRenderTree(childrenContext);
|
| + }
|
| +
|
| clearChildNeedsStyleRecalc();
|
| - Node::attach(context);
|
| + Node::createRenderTree(context);
|
| }
|
|
|
| -void ContainerNode::detach(const AttachContext& context)
|
| +void ContainerNode::destroyRenderTree(const AttachContext& context)
|
| {
|
| - detachChildren(context);
|
| + AttachContext childrenContext(context);
|
| + childrenContext.resolvedStyle = 0;
|
| +
|
| + for (Node* child = firstChild(); child; child = child->nextSibling())
|
| + child->destroyRenderTree(childrenContext);
|
| +
|
| clearChildNeedsStyleRecalc();
|
| - Node::detach(context);
|
| + Node::destroyRenderTree(context);
|
| }
|
|
|
| void ContainerNode::childrenChanged(bool changedByParser, Node*, Node*, int childCountDelta)
|
|
|