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

Unified Diff: sky/engine/core/dom/StyleSheetCollection.cpp

Issue 846703003: Use a dirty bit in StyleSheetCollection::updateActiveStyleSheets. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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 | « sky/engine/core/dom/StyleSheetCollection.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/dom/StyleSheetCollection.cpp
diff --git a/sky/engine/core/dom/StyleSheetCollection.cpp b/sky/engine/core/dom/StyleSheetCollection.cpp
index 91470b462ba608629193cda1131e98691e2f7d20..0d4cdd73b3ff3173f6a342874d6c00db35586f41 100644
--- a/sky/engine/core/dom/StyleSheetCollection.cpp
+++ b/sky/engine/core/dom/StyleSheetCollection.cpp
@@ -39,6 +39,7 @@ namespace blink {
StyleSheetCollection::StyleSheetCollection(TreeScope& treeScope)
: m_treeScope(treeScope)
+ , m_needsUpdate(true)
{
}
@@ -50,11 +51,13 @@ void StyleSheetCollection::addStyleSheetCandidateNode(HTMLStyleElement& element)
{
ASSERT(element.inActiveDocument());
m_styleSheetCandidateNodes.add(&element);
+ m_needsUpdate = true;
}
void StyleSheetCollection::removeStyleSheetCandidateNode(HTMLStyleElement& element)
{
m_styleSheetCandidateNodes.remove(&element);
+ m_needsUpdate = true;
}
void StyleSheetCollection::collectStyleSheets(Vector<RefPtr<CSSStyleSheet>>& sheets)
@@ -68,6 +71,11 @@ void StyleSheetCollection::collectStyleSheets(Vector<RefPtr<CSSStyleSheet>>& she
void StyleSheetCollection::updateActiveStyleSheets(StyleEngine* engine)
{
+ // TODO(esprehn): We need to check if the resolver exists otherwise style
+ // doesn't get computed right. We should figure out why.
+ if (!m_needsUpdate && engine->resolver())
+ return;
+
Vector<RefPtr<CSSStyleSheet>> candidateSheets;
collectStyleSheets(candidateSheets);
@@ -97,6 +105,7 @@ void StyleSheetCollection::updateActiveStyleSheets(StyleEngine* engine)
toShadowRoot(root).host()->setNeedsStyleRecalc(SubtreeStyleChange);
m_activeAuthorStyleSheets.swap(candidateSheets);
+ m_needsUpdate = false;
}
}
« no previous file with comments | « sky/engine/core/dom/StyleSheetCollection.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698