Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Unified Diff: third_party/WebKit/Source/core/dom/Node.cpp

Issue 2473743003: Call Element::rebuildLayoutTree from Document::updateStyle directly (Closed)
Patch Set: Commit the renames Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
}

Powered by Google App Engine
This is Rietveld 408576698