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

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

Issue 2473743003: Call Element::rebuildLayoutTree from Document::updateStyle directly (Closed)
Patch Set: Final patch - make sure to retain information needed to determine whether to call detachLayoutTree() Created 3 years, 11 months 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/ContainerNode.cpp
diff --git a/third_party/WebKit/Source/core/dom/ContainerNode.cpp b/third_party/WebKit/Source/core/dom/ContainerNode.cpp
index f5c16a1a367698d9dd5ffded0a5a7b7b0402b9e8..12e82d6053a697b05da572db039c7b43360dc78a 100644
--- a/third_party/WebKit/Source/core/dom/ContainerNode.cpp
+++ b/third_party/WebKit/Source/core/dom/ContainerNode.cpp
@@ -1273,7 +1273,6 @@ void ContainerNode::setRestyleFlag(DynamicRestyleFlags mask) {
void ContainerNode::recalcDescendantStyles(StyleRecalcChange change) {
DCHECK(document().inStyleRecalc());
DCHECK(change >= UpdatePseudoElements || childNeedsStyleRecalc());
- DCHECK(!needsStyleRecalc());
// This loop is deliberately backwards because we use insertBefore in the
// layout tree, and want to avoid a potentially n^2 loop to find the insertion
@@ -1298,6 +1297,25 @@ void ContainerNode::recalcDescendantStyles(StyleRecalcChange change) {
}
}
+void ContainerNode::rebuildChildrenLayoutTrees() {
+ DCHECK(!needsReattachLayoutTree());
+
+ for (Node* child = lastChild(); child; child = child->previousSibling()) {
+ if (child->needsReattachLayoutTree() ||
+ child->childNeedsReattachLayoutTree()) {
+ if (child->isTextNode())
+ toText(child)->rebuildTextLayoutTree();
+ else if (child->isElementNode())
+ toElement(child)->rebuildLayoutTree();
+ }
+ }
+ clearNeedsStyleRecalc();
+ // This is done in ContainerNode::attachLayoutTree but will never be cleared
+ // if we don't enter ContainerNode::attachLayoutTree so we do it here.
+ clearChildNeedsStyleRecalc();
+ clearChildNeedsReattachLayoutTree();
+}
+
void ContainerNode::checkForSiblingStyleChanges(SiblingCheckType changeType,
Element* changedElement,
Node* nodeBeforeChange,

Powered by Google App Engine
This is Rietveld 408576698