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

Unified Diff: third_party/WebKit/Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp

Issue 1380883002: SubtreeStyleChange will propagate through <content>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « third_party/WebKit/Source/core/css/invalidation/StyleSheetInvalidationAnalysis.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp
diff --git a/third_party/WebKit/Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp b/third_party/WebKit/Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp
index 5a1a12953e44de843c89abf2e797aa54b65d105b..893bef03704a83159f7d18192e74fb37f12d5d80 100644
--- a/third_party/WebKit/Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp
+++ b/third_party/WebKit/Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp
@@ -75,24 +75,6 @@ static bool determineSelectorScopes(const CSSSelectorList& selectorList, HashSet
return true;
}
-static bool hasDistributedRule(StyleSheetContents* styleSheetContents)
-{
- const WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>>& rules = styleSheetContents->childRules();
- for (unsigned i = 0; i < rules.size(); i++) {
- const StyleRuleBase* rule = rules[i].get();
- if (!rule->isStyleRule())
- continue;
-
- const StyleRule* styleRule = toStyleRule(rule);
- const CSSSelectorList& selectorList = styleRule->selectorList();
- for (size_t selectorIndex = 0; selectorIndex != kNotFound; selectorIndex = selectorList.indexOfNextSelectorAfter(selectorIndex)) {
- if (selectorList.hasShadowDistributedAt(selectorIndex))
- return true;
- }
- }
- return false;
-}
-
static bool ruleAdditionMightRequireDocumentStyleRecalc(StyleRuleBase* rule)
{
// This funciton is conservative. We only return false when we know that
@@ -139,11 +121,8 @@ void StyleSheetInvalidationAnalysis::analyzeStyleSheet(StyleSheetContents* style
return;
}
- if (m_treeScope->rootNode().isShadowRoot()) {
- if (hasDistributedRule(styleSheetContents))
- m_hasDistributedRules = true;
+ if (m_treeScope->rootNode().isShadowRoot())
return;
- }
const WillBeHeapVector<RefPtrWillBeMember<StyleRuleBase>>& rules = styleSheetContents->childRules();
for (unsigned i = 0; i < rules.size(); i++) {
@@ -177,23 +156,13 @@ static bool elementMatchesSelectorScopes(const Element* element, const HashSet<S
return false;
}
-static ContainerNode* outermostShadowHost(ContainerNode& host)
-{
- ContainerNode* outerHost = &host;
- while (outerHost->isInShadowTree())
- outerHost = outerHost->containingShadowRoot()->host();
- return outerHost;
-}
-
void StyleSheetInvalidationAnalysis::invalidateStyle()
{
ASSERT(!m_dirtiesAllStyle);
if (m_treeScope->rootNode().isShadowRoot()) {
- ContainerNode* invalidationRoot = toShadowRoot(m_treeScope->rootNode()).host();
- if (m_hasDistributedRules)
- invalidationRoot = outermostShadowHost(*invalidationRoot);
- invalidationRoot->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::StyleSheetChange));
+ ContainerNode* shadowHost = toShadowRoot(m_treeScope->rootNode()).host();
+ shadowHost->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::StyleSheetChange));
return;
}
« no previous file with comments | « third_party/WebKit/Source/core/css/invalidation/StyleSheetInvalidationAnalysis.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698