Chromium Code Reviews| Index: Source/core/dom/Node.h |
| diff --git a/Source/core/dom/Node.h b/Source/core/dom/Node.h |
| index b6524c8631b741a0afccb277e9eef1b5e79cd555..5ca66b7c809f21ddaf6ac8e13423cdffc7943c2c 100644 |
| --- a/Source/core/dom/Node.h |
| +++ b/Source/core/dom/Node.h |
| @@ -525,20 +525,27 @@ public: |
| RenderBox* renderBox() const; |
| RenderBoxModelObject* renderBoxModelObject() const; |
| + struct AttachContext { |
|
eae
2013/06/11 19:56:32
Not a big fan of the complexity this introduces, I
stavila
2013/06/11 21:08:51
Could you elaborate a little bit on that? I'm not
|
| + RenderStyle* resolvedStyle; |
| + bool performingReattach; |
| + |
| + AttachContext() : resolvedStyle(0), performingReattach(false) { } |
| + }; |
| + |
| // Attaches this node to the rendering tree. This calculates the style to be applied to the node and creates an |
| // appropriate RenderObject which will be inserted into the tree (except when the style has display: none). This |
| // makes the node visible in the FrameView. |
| - virtual void attach(); |
| + virtual void attach(const AttachContext& = AttachContext()); |
| // Detaches the node from the rendering tree, making it invisible in the rendered view. This method will remove |
| // the node's rendering object from the rendering tree and delete it. |
| - virtual void detach(); |
| + virtual void detach(const AttachContext& = AttachContext()); |
| #ifndef NDEBUG |
| bool inDetach() const; |
| #endif |
| - void reattach(); |
| + void reattach(const AttachContext& = AttachContext()); |
| void lazyReattachIfAttached(); |
| ContainerNode* parentNodeForRenderingAndStyle(); |
| @@ -879,11 +886,14 @@ inline ContainerNode* Node::parentNodeGuaranteedHostFree() const |
| return parentOrShadowHostNode(); |
| } |
| -inline void Node::reattach() |
| +inline void Node::reattach(const AttachContext& context) |
| { |
| + AttachContext reattachContext(context); |
| + reattachContext.performingReattach = true; |
| + |
| if (attached()) |
| - detach(); |
| - attach(); |
| + detach(reattachContext); |
| + attach(reattachContext); |
| } |
| inline void Node::lazyReattachIfAttached() |