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

Unified Diff: sky/engine/core/css/StyleSheetContents.cpp

Issue 808563002: Remove second set of clients from StyleSheetContents. (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/css/StyleSheetContents.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/css/StyleSheetContents.cpp
diff --git a/sky/engine/core/css/StyleSheetContents.cpp b/sky/engine/core/css/StyleSheetContents.cpp
index 559cd21a1e5db6e474f746b0abf77229ce51e2b1..86fe580fa735d2deaa7e189208c5a61ca42a1a11 100644
--- a/sky/engine/core/css/StyleSheetContents.cpp
+++ b/sky/engine/core/css/StyleSheetContents.cpp
@@ -82,20 +82,19 @@ bool StyleSheetContents::parseString(const String& sheetText)
void StyleSheetContents::registerClient(CSSStyleSheet* sheet)
{
- ASSERT(!m_loadingClients.contains(sheet) && !m_completedClients.contains(sheet));
+ ASSERT(!m_clients.contains(sheet));
// InspectorCSSAgent::buildObjectForRule creates CSSStyleSheet without any owner node.
if (!sheet->ownerDocument())
return;
- m_loadingClients.add(sheet);
+ m_clients.add(sheet);
}
void StyleSheetContents::unregisterClient(CSSStyleSheet* sheet)
{
- m_loadingClients.remove(sheet);
- m_completedClients.remove(sheet);
+ m_clients.remove(sheet);
- if (!sheet->ownerDocument() || !m_loadingClients.isEmpty() || !m_completedClients.isEmpty())
+ if (!sheet->ownerDocument() || !m_clients.isEmpty())
return;
sheet->ownerDocument()->styleEngine()->removeSheet(this);
}
@@ -114,14 +113,6 @@ RuleSet& StyleSheetContents::ensureRuleSet(const MediaQueryEvaluator& medium, Ad
return *m_ruleSet.get();
}
-static void clearResolvers(HashSet<RawPtr<CSSStyleSheet> >& clients)
-{
- for (HashSet<RawPtr<CSSStyleSheet> >::iterator it = clients.begin(); it != clients.end(); ++it) {
- if (Document* document = (*it)->ownerDocument())
- document->styleEngine()->clearResolver();
- }
-}
-
void StyleSheetContents::clearRuleSet()
{
// Don't want to clear the StyleResolver if the RuleSet hasn't been created
@@ -132,23 +123,11 @@ void StyleSheetContents::clearRuleSet()
// Clearing the ruleSet means we need to recreate the styleResolver data structures.
// See the StyleResolver calls in ScopedStyleResolver::addRulesFromSheet.
- clearResolvers(m_loadingClients);
- clearResolvers(m_completedClients);
- m_ruleSet.clear();
-}
-
-static void removeFontFaceRules(HashSet<RawPtr<CSSStyleSheet> >& clients, const StyleRuleFontFace* fontFaceRule)
-{
- for (HashSet<RawPtr<CSSStyleSheet> >::iterator it = clients.begin(); it != clients.end(); ++it) {
- if (Node* ownerNode = (*it)->ownerNode())
- ownerNode->document().styleEngine()->removeFontFaceRules(Vector<RawPtr<const StyleRuleFontFace> >(1, fontFaceRule));
+ for (RawPtr<CSSStyleSheet> client : m_clients) {
+ if (Document* document = client->ownerDocument())
+ document->styleEngine()->clearResolver();
}
-}
-
-void StyleSheetContents::notifyRemoveFontFaceRule(const StyleRuleFontFace* fontFaceRule)
-{
- removeFontFaceRules(m_loadingClients, fontFaceRule);
- removeFontFaceRules(m_completedClients, fontFaceRule);
+ m_ruleSet.clear();
}
}
« no previous file with comments | « sky/engine/core/css/StyleSheetContents.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698