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..8719ef80eb256403fd283256720eebcfbaa31a72 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,24 @@ 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(); |
+ } |
+ } |
+ // 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, |