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

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

Issue 1913833002: Current work-in-progress crbug.com/567021 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More assert fixes Created 4 years, 7 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
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 c79583017a736b1fbbab801410603b05f9e01ebe..24326c5553ce7ebc5e92576df644bb8d8c68373d 100644
--- a/third_party/WebKit/Source/core/css/StyleSheetContents.cpp
+++ b/third_party/WebKit/Source/core/css/StyleSheetContents.cpp
@@ -274,7 +274,9 @@ bool StyleSheetContents::wrapperInsertRule(StyleRuleBase* rule, unsigned index)
if (rule->isMediaRule())
setHasMediaQueries();
else if (rule->isFontFaceRule())
- setHasFontFaceRule(true);
+ setHasFontFaceRule();
+ else if (rule->isViewportRule())
+ setHasViewportRule();
m_childRules.insert(index, rule);
return true;
@@ -608,11 +610,21 @@ RuleSet& StyleSheetContents::ensureRuleSet(const MediaQueryEvaluator& medium, Ad
return *m_ruleSet.get();
}
-static void clearResolvers(HeapHashSet<WeakMember<CSSStyleSheet>>& clients)
+RuleSet& StyleSheetContents::ensureEmptyRuleSet()
+{
+ DCHECK(m_ruleSet);
+ m_ruleSet = RuleSet::create();
+ return *m_ruleSet.get();
+}
+
+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->inShadowIncludingDocument())
+ continue;
+ document->styleEngine().setNeedsActiveStyleUpdate(node->treeScope());
}
}
@@ -621,17 +633,13 @@ 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, const StyleRuleFontFace* fontFaceRule)

Powered by Google App Engine
This is Rietveld 408576698