| Index: Source/core/css/SelectorChecker.cpp
|
| diff --git a/Source/core/css/SelectorChecker.cpp b/Source/core/css/SelectorChecker.cpp
|
| index eff32607837754fcff7e2bca5a3902e7eff25b5e..cc023da531c544ca9e7c6c5304e925a22c7c647a 100644
|
| --- a/Source/core/css/SelectorChecker.cpp
|
| +++ b/Source/core/css/SelectorChecker.cpp
|
| @@ -84,7 +84,7 @@ Element* SelectorChecker::parentElement(const SelectorCheckingContext& context,
|
| return context.element->parentOrShadowHostElement();
|
|
|
| // If context.scope is a shadow host, we should walk up from a shadow root to its shadow host.
|
| - if (context.behaviorAtBoundary & SelectorChecker::ScopeIsShadowHost)
|
| + if ((context.behaviorAtBoundary & SelectorChecker::ScopeIsShadowHost) && context.scope == context.element->shadowHost())
|
| return context.element->parentOrShadowHostElement();
|
|
|
| if ((context.behaviorAtBoundary & SelectorChecker::BoundaryBehaviorMask) != SelectorChecker::StaysWithinTreeScope)
|
|
|