Chromium Code Reviews| Index: Source/core/dom/Document.cpp |
| diff --git a/Source/core/dom/Document.cpp b/Source/core/dom/Document.cpp |
| index e3199112cca649bf8ae7e40a0ba871602fad2a2f..b2b18b0b9ed28ac3357e8d7e5695962ecffdeb70 100644 |
| --- a/Source/core/dom/Document.cpp |
| +++ b/Source/core/dom/Document.cpp |
| @@ -1528,7 +1528,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() |
| @@ -1570,6 +1570,19 @@ void Document::updateDistributionIfNeeded() |
| recalcDistribution(); |
| } |
| +void Document::updateNeedsStyleRecalcStateIfNeeded() |
| +{ |
| + if (!childNeedsStyleInvalidation()) |
| + return; |
| + TRACE_EVENT0("webkit", "Document::computeNeedsStyleRecalcState"); |
| + if (!styleResolver()) { |
|
esprehn
2014/01/28 00:11:34
This isn't right, the resolver can get thrown away
chrishtr
2014/01/28 01:11:55
Added FIXME.
|
| + clearChildNeedsStyleInvalidation(); |
| + return; |
| + } |
| + |
| + styleResolver()->ensureRuleFeatureSet().computeStyleInvalidation(this); |
|
esprehn
2014/01/28 00:11:34
This can't work, the resolver can get thrown away.
chrishtr
2014/01/28 01:11:55
Added FIXME.
|
| +} |
| + |
| void Document::updateDistributionForNodeIfNeeded(Node* node) |
| { |
| if (node->inDocument()) { |
| @@ -1658,6 +1671,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 |
| @@ -1675,6 +1689,7 @@ void Document::recalcStyle(StyleRecalcChange change) |
| InspectorInstrumentationCookie cookie = InspectorInstrumentation::willRecalculateStyle(this); |
| + updateNeedsStyleRecalcStateIfNeeded(); |
|
esprehn
2014/01/28 00:11:34
This should be the last of these three steps, the
chrishtr
2014/01/28 01:11:55
Done.
|
| updateDistributionIfNeeded(); |
| updateUseShadowTrees(); |
| @@ -1779,7 +1794,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()) |