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

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

Issue 325663003: Remove scoped styles (retry) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix layout test (and expectation) Created 6 years, 6 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: Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp
diff --git a/Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp b/Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp
index c7dd4216b09784827d84ead60231550478099e1e..f03f8124e20651f96e67ceb9450d74f522df9744 100644
--- a/Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp
+++ b/Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp
@@ -92,24 +92,19 @@ static bool hasDistributedRule(StyleSheetContents* styleSheetContents)
return false;
}
-static Node* determineScopingNodeForStyleScoped(HTMLStyleElement* ownerElement, StyleSheetContents* styleSheetContents)
+static Node* determineScopingNodeForStyleInShadow(HTMLStyleElement* ownerElement, StyleSheetContents* styleSheetContents)
{
- ASSERT(ownerElement && ownerElement->isRegisteredAsScoped());
-
- if (ownerElement->isInShadowTree()) {
- if (hasDistributedRule(styleSheetContents)) {
- ContainerNode* scope = ownerElement;
- do {
- scope = scope->containingShadowRoot()->shadowHost();
- } while (scope->isInShadowTree());
-
- return scope;
- }
- if (ownerElement->isRegisteredAsScoped())
- return ownerElement->containingShadowRoot()->shadowHost();
+ ASSERT(ownerElement && ownerElement->isInShadowTree());
+
+ if (hasDistributedRule(styleSheetContents)) {
+ ContainerNode* scope = ownerElement;
+ do {
+ scope = scope->containingShadowRoot()->shadowHost();
+ } while (scope->isInShadowTree());
+ return scope;
}
- return ownerElement->isRegisteredInShadowRoot() ? ownerElement->containingShadowRoot()->shadowHost() : ownerElement->parentNode();
+ return ownerElement->containingShadowRoot()->shadowHost();
}
static bool ruleAdditionMightRequireDocumentStyleRecalc(StyleRuleBase* rule)
@@ -157,8 +152,8 @@ void StyleSheetInvalidationAnalysis::analyzeStyleSheet(StyleSheetContents* style
}
if (styleSheetContents->hasSingleOwnerNode()) {
Node* ownerNode = styleSheetContents->singleOwnerNode();
- if (isHTMLStyleElement(ownerNode) && toHTMLStyleElement(*ownerNode).isRegisteredAsScoped()) {
- m_scopingNodes.append(determineScopingNodeForStyleScoped(toHTMLStyleElement(ownerNode), styleSheetContents));
+ if (isHTMLStyleElement(ownerNode) && toHTMLStyleElement(*ownerNode).isInShadowTree()) {
+ m_scopingNodes.append(determineScopingNodeForStyleInShadow(toHTMLStyleElement(ownerNode), styleSheetContents));
return;
}
}
« no previous file with comments | « LayoutTests/fast/dom/shadow/style-scoped-not-enabled-expected.txt ('k') | Source/core/css/resolver/ScopedStyleResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698