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

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

Issue 1156273002: Add assert that updateLayoutTree clears dirty bits. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Just asserts?? Created 5 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Document.cpp
diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp
index a9c37fc3fdf0091bc437c81ad03d425e11523a14..c574f841765a1461fea54e00c5d4a559c1a9b2d4 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -1683,6 +1683,28 @@ void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change)
}
}
+#if ENABLE(ASSERT)
+static void assertLayoutTreeUpdated(Node& root)
+{
+ for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) {
+ // We leave some nodes with dirty bits in the tree because they don't
+ // matter like Comment and ProcessingInstruction nodes.
ojan 2015/06/19 03:05:44 Add a FIXME to not dirty these in the first place?
+ if (!node.isElementNode()
+ && !node.isTextNode()
+ && !node.isShadowRoot()
+ && !node.isDocumentNode())
+ continue;
+ ASSERT(!node.needsStyleRecalc());
+ ASSERT(!node.childNeedsStyleRecalc());
+ ASSERT(!node.childNeedsDistributionRecalc());
+ ASSERT(!node.needsStyleInvalidation());
+ ASSERT(!node.childNeedsStyleInvalidation());
+ for (ShadowRoot* shadowRoot = node.youngestShadowRoot(); shadowRoot; shadowRoot = shadowRoot->olderShadowRoot())
+ assertLayoutTreeUpdated(*shadowRoot);
+ }
+}
+#endif
+
void Document::updateLayoutTree(StyleRecalcChange change)
{
ASSERT(isMainThread());
@@ -1749,6 +1771,10 @@ void Document::updateLayoutTree(StyleRecalcChange change)
TRACE_EVENT_END1("blink,devtools.timeline", "UpdateLayoutTree", "elementCount", m_styleRecalcElementCounter);
InspectorInstrumentation::didRecalculateStyle(cookie, m_styleRecalcElementCounter);
+
+#if ENABLE(ASSERT)
+ assertLayoutTreeUpdated(*this);
+#endif
}
void Document::updateStyle(StyleRecalcChange change)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698