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

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

Issue 2557533005: Collect active stylesheets and and apply asynchronously. (Closed)
Patch Set: [Mac] Missing style recalc for device scale change 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 1403ca2372c1bee0095f3b9f4729b0a62146f8ee..4d90718d15188934e5706eed8bd874099ee42ef6 100644
--- a/third_party/WebKit/Source/core/css/StyleSheetContents.cpp
+++ b/third_party/WebKit/Source/core/css/StyleSheetContents.cpp
@@ -618,10 +618,14 @@ RuleSet& StyleSheetContents::ensureRuleSet(const MediaQueryEvaluator& medium,
return *m_ruleSet.get();
}
-static void clearResolvers(HeapHashSet<WeakMember<CSSStyleSheet>>& clients) {
+static void setNeedsActiveStyleUpdateForClients(
+ HeapHashSet<WeakMember<CSSStyleSheet>>& clients) {
for (const auto& sheet : clients) {
- if (Document* document = sheet->ownerDocument())
- document->styleEngine().clearResolver();
+ Document* document = sheet->ownerDocument();
+ Node* node = sheet->ownerNode();
+ if (!document || !node || !node->isConnected())
+ continue;
+ document->styleEngine().setNeedsActiveStyleUpdate(node->treeScope());
esprehn 2016/12/09 01:36:21 Should this be a method on TreeScope instead?
rune 2016/12/09 08:55:50 We will need to pass the tree-scope on to StyleEng
}
}
@@ -629,18 +633,12 @@ void StyleSheetContents::clearRuleSet() {
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,

Powered by Google App Engine
This is Rietveld 408576698