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

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

Issue 1311463004: Invalidate style from shadow host, not root, to apply :host rules. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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 | « LayoutTests/fast/css/invalidation/shadow-add-sheet-host-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp
diff --git a/Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp b/Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp
index 9f94cd011379ce13a0e350303efe704510c22e0c..5a1a12953e44de843c89abf2e797aa54b65d105b 100644
--- a/Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp
+++ b/Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp
@@ -177,12 +177,12 @@ static bool elementMatchesSelectorScopes(const Element* element, const HashSet<S
return false;
}
-static ContainerNode* outermostShadowHost(const ShadowRoot& root)
+static ContainerNode* outermostShadowHost(ContainerNode& host)
{
- ContainerNode* host = root.host();
- while (host->isInShadowTree())
- host = host->containingShadowRoot()->host();
- return host;
+ ContainerNode* outerHost = &host;
+ while (outerHost->isInShadowTree())
+ outerHost = outerHost->containingShadowRoot()->host();
+ return outerHost;
}
void StyleSheetInvalidationAnalysis::invalidateStyle()
@@ -190,9 +190,9 @@ void StyleSheetInvalidationAnalysis::invalidateStyle()
ASSERT(!m_dirtiesAllStyle);
if (m_treeScope->rootNode().isShadowRoot()) {
- ContainerNode* invalidationRoot = &m_treeScope->rootNode();
+ ContainerNode* invalidationRoot = toShadowRoot(m_treeScope->rootNode()).host();
if (m_hasDistributedRules)
- invalidationRoot = outermostShadowHost(*toShadowRoot(invalidationRoot));
+ invalidationRoot = outermostShadowHost(*invalidationRoot);
invalidationRoot->setNeedsStyleRecalc(SubtreeStyleChange, StyleChangeReasonForTracing::create(StyleChangeReason::StyleSheetChange));
return;
}
« no previous file with comments | « LayoutTests/fast/css/invalidation/shadow-add-sheet-host-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698