| Index: Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp
|
| diff --git a/Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp b/Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp
|
| index f03f8124e20651f96e67ceb9450d74f522df9744..c7dd4216b09784827d84ead60231550478099e1e 100644
|
| --- a/Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp
|
| +++ b/Source/core/css/invalidation/StyleSheetInvalidationAnalysis.cpp
|
| @@ -92,19 +92,24 @@
|
| return false;
|
| }
|
|
|
| -static Node* determineScopingNodeForStyleInShadow(HTMLStyleElement* ownerElement, StyleSheetContents* styleSheetContents)
|
| -{
|
| - ASSERT(ownerElement && ownerElement->isInShadowTree());
|
| -
|
| - if (hasDistributedRule(styleSheetContents)) {
|
| - ContainerNode* scope = ownerElement;
|
| - do {
|
| - scope = scope->containingShadowRoot()->shadowHost();
|
| - } while (scope->isInShadowTree());
|
| - return scope;
|
| - }
|
| -
|
| - return ownerElement->containingShadowRoot()->shadowHost();
|
| +static Node* determineScopingNodeForStyleScoped(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();
|
| + }
|
| +
|
| + return ownerElement->isRegisteredInShadowRoot() ? ownerElement->containingShadowRoot()->shadowHost() : ownerElement->parentNode();
|
| }
|
|
|
| static bool ruleAdditionMightRequireDocumentStyleRecalc(StyleRuleBase* rule)
|
| @@ -152,8 +157,8 @@
|
| }
|
| if (styleSheetContents->hasSingleOwnerNode()) {
|
| Node* ownerNode = styleSheetContents->singleOwnerNode();
|
| - if (isHTMLStyleElement(ownerNode) && toHTMLStyleElement(*ownerNode).isInShadowTree()) {
|
| - m_scopingNodes.append(determineScopingNodeForStyleInShadow(toHTMLStyleElement(ownerNode), styleSheetContents));
|
| + if (isHTMLStyleElement(ownerNode) && toHTMLStyleElement(*ownerNode).isRegisteredAsScoped()) {
|
| + m_scopingNodes.append(determineScopingNodeForStyleScoped(toHTMLStyleElement(ownerNode), styleSheetContents));
|
| return;
|
| }
|
| }
|
|
|