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

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

Issue 774953002: Always Reconstruct when stylesheets change. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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/StyleEngine.h ('k') | sky/engine/core/dom/TreeScopeStyleSheetCollection.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/dom/StyleEngine.cpp
diff --git a/sky/engine/core/dom/StyleEngine.cpp b/sky/engine/core/dom/StyleEngine.cpp
index f38c4f42d5c8e3205b20d8922b0f2c626f5858cb..aa8d3b846c8e62107cfc6a35c750e912e75f86ea 100644
--- a/sky/engine/core/dom/StyleEngine.cpp
+++ b/sky/engine/core/dom/StyleEngine.cpp
@@ -196,16 +196,6 @@ void StyleEngine::removeStyleSheetCandidateNode(Node* node, ContainerNode* scopi
m_activeTreeScopes.remove(&treeScope);
}
-bool StyleEngine::shouldUpdateDocumentStyleSheetCollection(StyleResolverUpdateMode updateMode) const
-{
- return m_documentScopeDirty || updateMode == FullStyleUpdate;
-}
-
-bool StyleEngine::shouldUpdateShadowTreeStyleSheetCollection(StyleResolverUpdateMode updateMode) const
-{
- return !m_dirtyTreeScopes.isEmpty() || updateMode == FullStyleUpdate;
-}
-
void StyleEngine::clearMediaQueryRuleSetOnTreeScopeStyleSheets(TreeScopeSet treeScopes)
{
for (TreeScopeSet::iterator it = treeScopes.begin(); it != treeScopes.end(); ++it) {
@@ -224,7 +214,7 @@ void StyleEngine::clearMediaQueryRuleSetStyleSheets()
clearMediaQueryRuleSetOnTreeScopeStyleSheets(m_dirtyTreeScopes);
}
-void StyleEngine::updateActiveStyleSheets(StyleResolverUpdateMode updateMode)
+void StyleEngine::updateActiveStyleSheets()
{
ASSERT(isMaster());
ASSERT(!document().inStyleRecalc());
@@ -232,24 +222,21 @@ void StyleEngine::updateActiveStyleSheets(StyleResolverUpdateMode updateMode)
if (!document().isActive())
return;
- if (shouldUpdateDocumentStyleSheetCollection(updateMode))
- documentStyleSheetCollection()->updateActiveStyleSheets(this, updateMode);
-
- if (shouldUpdateShadowTreeStyleSheetCollection(updateMode)) {
- TreeScopeSet treeScopes = updateMode == FullStyleUpdate ? m_activeTreeScopes : m_dirtyTreeScopes;
- HashSet<TreeScope*> treeScopesRemoved;
-
- for (TreeScopeSet::iterator it = treeScopes.begin(); it != treeScopes.end(); ++it) {
- TreeScope* treeScope = *it;
- ASSERT(treeScope != m_document);
- ShadowTreeStyleSheetCollection* collection = static_cast<ShadowTreeStyleSheetCollection*>(styleSheetCollectionFor(*treeScope));
- ASSERT(collection);
- collection->updateActiveStyleSheets(this, updateMode);
- if (!collection->hasStyleSheetCandidateNodes())
- treeScopesRemoved.add(treeScope);
- }
- m_activeTreeScopes.removeAll(treeScopesRemoved);
+ documentStyleSheetCollection()->updateActiveStyleSheets(this);
+
+ TreeScopeSet treeScopes = m_activeTreeScopes;
+ HashSet<TreeScope*> treeScopesRemoved;
+
+ for (TreeScopeSet::iterator it = treeScopes.begin(); it != treeScopes.end(); ++it) {
+ TreeScope* treeScope = *it;
+ ASSERT(treeScope != m_document);
+ ShadowTreeStyleSheetCollection* collection = static_cast<ShadowTreeStyleSheetCollection*>(styleSheetCollectionFor(*treeScope));
+ ASSERT(collection);
+ collection->updateActiveStyleSheets(this);
+ if (!collection->hasStyleSheetCandidateNodes())
+ treeScopesRemoved.add(treeScope);
}
+ m_activeTreeScopes.removeAll(treeScopesRemoved);
m_usesRemUnits = documentStyleSheetCollection()->usesRemUnits();
@@ -320,11 +307,11 @@ void StyleEngine::didDetach()
clearResolver();
}
-void StyleEngine::resolverChanged(StyleResolverUpdateMode mode)
+void StyleEngine::resolverChanged()
{
if (!isMaster()) {
if (Document* master = this->master())
- master->styleResolverChanged(mode);
+ master->styleResolverChanged();
return;
}
@@ -335,7 +322,7 @@ void StyleEngine::resolverChanged(StyleResolverUpdateMode mode)
return;
}
- updateActiveStyleSheets(mode);
+ updateActiveStyleSheets();
}
void StyleEngine::clearFontCache()
« no previous file with comments | « sky/engine/core/dom/StyleEngine.h ('k') | sky/engine/core/dom/TreeScopeStyleSheetCollection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698