Index: Source/core/dom/Document.cpp |
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
index e156af0b099036a0dd188ee81cad39af540ff99e..7968c9bc2d43ef5c059576eb7bc30056ee20a165 100644 |
--- a/Source/core/dom/Document.cpp |
+++ b/Source/core/dom/Document.cpp |
@@ -1895,12 +1895,16 @@ void Document::updateStyle(StyleRecalcChange change) |
void Document::updateRenderTreeForNodeIfNeeded(Node* node) |
{ |
+ ASSERT(node); |
if (!node->canParticipateInComposedTree()) |
return; |
- bool needsRecalc = needsFullRenderTreeUpdate(); |
- for (const Node* ancestor = node; ancestor && !needsRecalc; ancestor = NodeRenderingTraversal::parent(*ancestor)) |
- needsRecalc = ancestor->needsStyleRecalc() || ancestor->needsStyleInvalidation(); |
+ bool needsRecalc = needsFullRenderTreeUpdate() || childNeedsDistributionRecalc() || node->needsStyleRecalc() || node->needsStyleInvalidation(); |
+ |
+ if (!needsRecalc) { |
+ for (const ContainerNode* ancestor = NodeRenderingTraversal::parent(*node); ancestor && !needsRecalc; ancestor = NodeRenderingTraversal::parent(*ancestor)) |
+ needsRecalc = ancestor->needsStyleRecalc() || ancestor->needsStyleInvalidation() || ancestor->needsAdjacentStyleRecalc(); |
+ } |
if (needsRecalc) |
updateRenderTreeIfNeeded(); |