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

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: Addressed comments. 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 e3199112cca649bf8ae7e40a0ba871602fad2a2f..7f144d93b546cbd40144fe65999061faf261709f 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,21 @@ void Document::updateDistributionIfNeeded()
recalcDistribution();
}
+void Document::updateStyleInvalidationIfNeeded()
+{
+ if (!childNeedsStyleInvalidation())
+ return;
+ TRACE_EVENT0("webkit", "Document::computeNeedsStyleRecalcState");
+ if (!styleResolver()) {
+ clearChildNeedsStyleInvalidation();
ojan 2014/01/29 00:50:07 I think we still need to do the style invalidation
chrishtr 2014/01/29 01:56:42 The style invalidation data structure lives in the
ojan 2014/01/29 02:00:25 I see. Yeah, it seems like we have to block turnin
chrishtr 2014/01/29 02:02:32 Yes. My plan is to try to land the change that rem
+ return;
+ }
+
+ // FIXME: the style resolver can be deleted at present. Either resolve
+ // crbug.com/335964 or move the invalidation data elsewhere.
ojan 2014/01/29 00:50:07 You can use use ensureStyleResolver(). I don't see
chrishtr 2014/01/29 01:56:42 See above.
+ styleResolver()->ensureRuleFeatureSet().computeStyleInvalidation(*this);
+}
+
void Document::updateDistributionForNodeIfNeeded(Node* node)
{
if (node->inDocument()) {
@@ -1658,6 +1673,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
@@ -1677,6 +1693,7 @@ void Document::recalcStyle(StyleRecalcChange change)
updateDistributionIfNeeded();
updateUseShadowTrees();
+ updateStyleInvalidationIfNeeded();
if (m_evaluateMediaQueriesOnStyleRecalc) {
m_evaluateMediaQueriesOnStyleRecalc = false;
@@ -1779,7 +1796,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