Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(817)

Unified Diff: Source/core/dom/Node.cpp

Issue 1328013002: Add early out back to Node::updateDistribution(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: do it right. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/editing/EditingTestBase.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/editing/EditingTestBase.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698