Index: Source/core/css/SelectorChecker.cpp |
diff --git a/Source/core/css/SelectorChecker.cpp b/Source/core/css/SelectorChecker.cpp |
index 45134f9de9d78959dbf1e6d710c414dcf91105de..eec09c769fcfc6cbd2b6a8c203fe069fd6357809 100644 |
--- a/Source/core/css/SelectorChecker.cpp |
+++ b/Source/core/css/SelectorChecker.cpp |
@@ -418,7 +418,7 @@ SelectorChecker::Match SelectorChecker::matchForRelation(const SelectorCheckingC |
if (!context.isUARule) |
UseCounter::countDeprecation(context.element->document(), UseCounter::CSSDeepCombinator); |
if (ShadowRoot* root = context.element->containingShadowRoot()) { |
- if (root->type() == ShadowRootType::UserAgent) |
+ if (!root->isOpen()) |
return SelectorFailsCompletely; |
} |
@@ -433,6 +433,8 @@ SelectorChecker::Match SelectorChecker::matchForRelation(const SelectorCheckingC |
nextContext.isSubSelector = false; |
nextContext.inRightmostCompound = false; |
for (nextContext.element = context.element->parentOrShadowHostElement(); nextContext.element; nextContext.element = nextContext.element->parentOrShadowHostElement()) { |
+ if (nextContext.element->closedShadowRoot()) |
+ return SelectorFailsCompletely; |
Match match = matchSelector(nextContext, result); |
if (match == SelectorMatches || match == SelectorFailsCompletely) |
return match; |