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()) |