Index: Source/core/dom/Node.cpp |
diff --git a/Source/core/dom/Node.cpp b/Source/core/dom/Node.cpp |
index 6cb9f35f4a68f03d5a4fde44829c03c71e8df83c..1a14679ed6db74c334cbea4e649086733500dc87 100644 |
--- a/Source/core/dom/Node.cpp |
+++ b/Source/core/dom/Node.cpp |
@@ -653,13 +653,20 @@ bool Node::needsDistributionRecalc() const |
void Node::updateDistribution() |
{ |
+ // Extra early out to avoid spamming traces. |
+ if (inDocument() && !document().childNeedsDistributionRecalc()) |
+ return; |
TRACE_EVENT0("blink", "Node::updateDistribution"); |
ScriptForbiddenScope forbidScript; |
- rootInTreeOfTrees(*this).recalcDistribution(); |
+ Node& root = rootInTreeOfTrees(*this); |
+ if (root.childNeedsDistributionRecalc()) |
+ root.recalcDistribution(); |
} |
void Node::recalcDistribution() |
{ |
+ ASSERT(childNeedsDistributionRecalc()); |
+ |
if (isElementNode()) { |
if (ElementShadow* shadow = toElement(this)->shadow()) |
shadow->distributeIfNeeded(); |