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

Unified Diff: third_party/WebKit/Source/core/css/StyleSheetContents.cpp

Issue 2572473006: Revert of Collect active stylesheets and and apply asynchronously. (Closed)
Patch Set: Created 4 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
Index: third_party/WebKit/Source/core/css/StyleSheetContents.cpp
diff --git a/third_party/WebKit/Source/core/css/StyleSheetContents.cpp b/third_party/WebKit/Source/core/css/StyleSheetContents.cpp
index 7dc7792ec83c2499842949c2d322ef499777b200..b24baaa1190fa6f8900c75172e926a3d657739e4 100644
--- a/third_party/WebKit/Source/core/css/StyleSheetContents.cpp
+++ b/third_party/WebKit/Source/core/css/StyleSheetContents.cpp
@@ -617,14 +617,10 @@
return *m_ruleSet.get();
}
-static void setNeedsActiveStyleUpdateForClients(
- HeapHashSet<WeakMember<CSSStyleSheet>>& clients) {
+static void clearResolvers(HeapHashSet<WeakMember<CSSStyleSheet>>& clients) {
for (const auto& sheet : clients) {
- Document* document = sheet->ownerDocument();
- Node* node = sheet->ownerNode();
- if (!document || !node || !node->isConnected())
- continue;
- document->styleEngine().setNeedsActiveStyleUpdate(node->treeScope());
+ if (Document* document = sheet->ownerDocument())
+ document->styleEngine().clearResolver();
}
}
@@ -632,12 +628,18 @@
if (StyleSheetContents* parentSheet = parentStyleSheet())
parentSheet->clearRuleSet();
+ // Don't want to clear the StyleResolver if the RuleSet hasn't been created
+ // since we only clear the StyleResolver so that it's members are properly
+ // updated in ScopedStyleResolver::addRulesFromSheet.
if (!m_ruleSet)
return;
+ // 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();
- setNeedsActiveStyleUpdateForClients(m_loadingClients);
- setNeedsActiveStyleUpdateForClients(m_completedClients);
}
static void removeFontFaceRules(HeapHashSet<WeakMember<CSSStyleSheet>>& clients,
« no previous file with comments | « third_party/WebKit/Source/core/css/FontFaceSet.cpp ('k') | third_party/WebKit/Source/core/css/resolver/StyleResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698