Chromium Code Reviews| Index: Source/core/dom/ContainerNode.h |
| diff --git a/Source/core/dom/ContainerNode.h b/Source/core/dom/ContainerNode.h |
| index da683f2197ddfa8bdde1c68f6baeee576a0d9411..eeb065e816e4435e672039451a7f2fe16656891b 100644 |
| --- a/Source/core/dom/ContainerNode.h |
| +++ b/Source/core/dom/ContainerNode.h |
| @@ -127,10 +127,10 @@ public: |
| // 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(); |
| + void attachChildren(const AttachContext& = AttachContext()); |
| void attachChildrenLazily(); |
| - void detachChildren(); |
| - void detachChildrenIfNeeded(); |
| + void detachChildren(const AttachContext& = AttachContext()); |
| + void detachChildrenIfNeeded(const AttachContext& = AttachContext()); |
| void disconnectDescendantFrames(); |
| @@ -196,12 +196,16 @@ inline ContainerNode::ContainerNode(TreeScope* treeScope, ConstructionType type) |
| { |
| } |
| -inline void ContainerNode::attachChildren() |
| +inline void ContainerNode::attachChildren(const AttachContext& context) |
| { |
| + // the resolved style need not be passed to the children, as it represents only the parent's style |
| + AttachContext childrenContext(context); |
| + childrenContext.resolvedStyle = 0; |
|
esprehn
2013/06/13 18:20:42
You should put this inside the constructor to just
stavila
2013/06/13 21:10:06
You mean the copy constructor should set by defaul
|
| + |
| for (Node* child = firstChild(); child; child = child->nextSibling()) { |
| ASSERT(!child->attached() || childAttachedAllowedWhenAttachingChildren(this)); |
| if (!child->attached()) |
| - child->attach(); |
| + child->attach(childrenContext); |
| } |
| } |
| @@ -212,18 +216,26 @@ inline void ContainerNode::attachChildrenLazily() |
| child->lazyAttach(); |
| } |
| -inline void ContainerNode::detachChildrenIfNeeded() |
| +inline void ContainerNode::detachChildrenIfNeeded(const AttachContext& context) |
| { |
| + // the resolved style need not be passed to the children, as it represents only the parent's style |
| + AttachContext childrenContext(context); |
| + childrenContext.resolvedStyle = 0; |
| + |
| for (Node* child = firstChild(); child; child = child->nextSibling()) { |
| if (child->attached()) |
| - child->detach(); |
| + child->detach(childrenContext); |
| } |
| } |
| -inline void ContainerNode::detachChildren() |
| +inline void ContainerNode::detachChildren(const AttachContext& context) |
| { |
| + // the resolved style need not be passed to the children, as it represents only the parent's style |
| + AttachContext childrenContext(context); |
|
esprehn
2013/06/13 18:20:42
Please remove all the comments here, this should b
|
| + childrenContext.resolvedStyle = 0; |
| + |
| for (Node* child = firstChild(); child; child = child->nextSibling()) |
| - child->detach(); |
| + child->detach(childrenContext); |
| } |
| inline unsigned Node::childNodeCount() const |