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 a2ce787cc8e9cc6fcfb7bfad0ca1587b978746c2..f4191e44619a924dd61b532c45cb5450b9999b8a 100644 |
--- a/third_party/WebKit/Source/core/dom/ContainerNode.cpp |
+++ b/third_party/WebKit/Source/core/dom/ContainerNode.cpp |
@@ -779,7 +779,6 @@ void ContainerNode::detachLayoutTree(const AttachContext& context) { |
for (Node* child = firstChild(); child; child = child->nextSibling()) |
child->detachLayoutTree(childrenContext); |
- setChildNeedsStyleRecalc(); |
Node::detachLayoutTree(context); |
} |
@@ -1294,6 +1293,24 @@ void ContainerNode::recalcDescendantStyles(StyleRecalcChange change) { |
lastTextNode = nullptr; |
} |
} |
+ clearChildNeedsStyleRecalc(); |
+} |
+ |
+void ContainerNode::rebuildDescendantLayoutTree() { |
+ DCHECK(!needsStyleRecalc()); |
+ DCHECK(!childNeedsStyleRecalc()); |
+ DCHECK(!needsReattachLayoutTree()); |
+ |
+ for (Node* child = firstChild(); child; child = child->nextSibling()) { |
+ if (child->needsReattachLayoutTree() || |
+ child->childNeedsReattachLayoutTree()) { |
+ if (child->isTextNode()) |
+ toText(child)->rebuildTextLayoutTree(); |
+ else if (child->isElementNode()) |
+ toElement(child)->rebuildLayoutTree(); |
+ } |
+ } |
+ clearChildNeedsReattachLayoutTree(); |
} |
void ContainerNode::checkForSiblingStyleChanges(SiblingCheckType changeType, |