Chromium Code Reviews| Index: third_party/WebKit/Source/core/dom/Node.cpp |
| diff --git a/third_party/WebKit/Source/core/dom/Node.cpp b/third_party/WebKit/Source/core/dom/Node.cpp |
| index aeaa766772c025ce7febc7821a9155f978936b3d..dc0d0bf5fea87f609793a420e09717e859276ee0 100644 |
| --- a/third_party/WebKit/Source/core/dom/Node.cpp |
| +++ b/third_party/WebKit/Source/core/dom/Node.cpp |
| @@ -880,24 +880,31 @@ Node* Node::commonAncestor(const Node& other, |
| } |
| void Node::reattachLayoutTree(const AttachContext& context) { |
| + DCHECK(!needsStyleRecalc()); |
| + DCHECK(!childNeedsStyleRecalc()); |
| AttachContext reattachContext(context); |
| reattachContext.performingReattach = true; |
| // We only need to detach if the node has already been through |
| // attachLayoutTree(). |
| - if (getStyleChangeType() < NeedsReattachStyleChange) |
| + if (getStyleChangeType() <= SubtreeStyleChange) |
|
nainar
2016/11/29 06:13:39
Question: This will always be true since SubtreeSt
rune
2016/12/05 10:05:17
Yes, this test doesn't make sense now. If you setN
|
| detachLayoutTree(reattachContext); |
| attachLayoutTree(reattachContext); |
| + DCHECK(!needsStyleRecalc()); |
| + DCHECK(!needsReattachLayoutTree()); |
| } |
| void Node::attachLayoutTree(const AttachContext&) { |
| DCHECK(document().inStyleRecalc() || isDocumentNode()); |
| DCHECK(!document().lifecycle().inDetach()); |
| - DCHECK(needsAttach()); |
| + DCHECK(needsReattachLayoutTree()); |
| DCHECK(!layoutObject() || |
| (layoutObject()->style() && |
| (layoutObject()->parent() || layoutObject()->isLayoutView()))); |
| + // Only doing this to cater to the comment in |
| + // Document::updateStyleAndLayoutTree() right above the call to |
| + // Document::updateStyle(). |
| clearNeedsStyleRecalc(); |
| clearNeedsReattachLayoutTree(); |
| @@ -912,7 +919,7 @@ void Node::detachLayoutTree(const AttachContext& context) { |
| if (layoutObject()) |
| layoutObject()->destroyAndCleanupAnonymousWrappers(); |
| setLayoutObject(nullptr); |
| - setStyleChange(NeedsReattachStyleChange); |
| + setNeedsReattachLayoutTree(); |
|
nainar
2016/11/29 06:13:39
Set the relevant NeedsReattachLayoutTree flag.
|
| clearChildNeedsStyleInvalidation(); |
| } |