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 207659d70f65cfdf3da66036ac30f8ba15cce0d2..f23a2c10336ee65f384f9d354df95bfd381d852a 100644 |
--- a/third_party/WebKit/Source/core/dom/ContainerNode.cpp |
+++ b/third_party/WebKit/Source/core/dom/ContainerNode.cpp |
@@ -1280,7 +1280,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 |
@@ -1305,6 +1304,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, |