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

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

Issue 143873016: Implement style invalidation tree walk for targeted style recalc upon class change. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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/Document.h ('k') | Source/core/dom/Element.cpp » ('j') | 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 6530b8af691d4ea1f8439b92e73c9ef37a548c78..9a71e4f61102e52646ef3be13f198815a6bed226 100644
--- a/Source/core/dom/Document.cpp
+++ b/Source/core/dom/Document.cpp
@@ -1579,7 +1579,7 @@ PassRefPtr<TreeWalker> Document::createTreeWalker(Node* root, unsigned whatToSho
bool Document::shouldCallRecalcStyleForDocument()
{
- return needsStyleRecalc() || childNeedsStyleRecalc() || childNeedsDistributionRecalc() || !m_useElementsNeedingUpdate.isEmpty();
+ return needsStyleRecalc() || childNeedsStyleRecalc() || childNeedsDistributionRecalc() || !m_useElementsNeedingUpdate.isEmpty() || childNeedsStyleInvalidation();
}
void Document::scheduleStyleRecalc()
@@ -1617,6 +1617,21 @@ void Document::updateDistributionIfNeeded()
recalcDistribution();
}
+void Document::updateStyleInvalidationIfNeeded()
+{
+ if (!childNeedsStyleInvalidation())
+ return;
+ TRACE_EVENT0("webkit", "Document::computeNeedsStyleRecalcState");
+ if (!styleResolver()) {
+ clearChildNeedsStyleInvalidation();
+ return;
+ }
+
+ // FIXME: the style resolver can be deleted at present. Either resolve
+ // crbug.com/335964 or move the invalidation data elsewhere.
+ styleResolver()->ensureRuleFeatureSet().computeStyleInvalidation(*this);
+}
+
void Document::updateDistributionForNodeIfNeeded(Node* node)
{
if (node->inDocument()) {
@@ -1705,6 +1720,7 @@ void Document::inheritHtmlAndBodyElementStyles(StyleRecalcChange change)
}
}
+// FIXME: need a better name than recalcStyle. It's performing style invalidation, style recalc, and distribution.
void Document::recalcStyle(StyleRecalcChange change)
{
// we should not enter style recalc while painting
@@ -1724,6 +1740,7 @@ void Document::recalcStyle(StyleRecalcChange change)
updateDistributionIfNeeded();
updateUseShadowTrees();
+ updateStyleInvalidationIfNeeded();
if (m_evaluateMediaQueriesOnStyleRecalc) {
m_evaluateMediaQueriesOnStyleRecalc = false;
@@ -1826,7 +1843,7 @@ void Document::updateStyleForNodeIfNeeded(Node* node)
// the path from 'node' to the root needs style recalc.
// Global needed.
- bool needsRecalc = needsStyleRecalc() || childNeedsDistributionRecalc() || !m_useElementsNeedingUpdate.isEmpty();
+ bool needsRecalc = needsStyleRecalc() || childNeedsDistributionRecalc() || !m_useElementsNeedingUpdate.isEmpty() || childNeedsStyleInvalidation();
// On the path.
for (Node* ancestor = node; ancestor && !needsRecalc; ancestor = ancestor->parentOrShadowHostNode())
« no previous file with comments | « Source/core/dom/Document.h ('k') | Source/core/dom/Element.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698