| Index: Source/core/css/SelectorChecker.cpp
|
| diff --git a/Source/core/css/SelectorChecker.cpp b/Source/core/css/SelectorChecker.cpp
|
| index 45134f9de9d78959dbf1e6d710c414dcf91105de..e439e4743b447c03fa756386632d0b13bd6dfa05 100644
|
| --- a/Source/core/css/SelectorChecker.cpp
|
| +++ b/Source/core/css/SelectorChecker.cpp
|
| @@ -432,12 +432,23 @@ 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()) {
|
| +
|
| + Element* element = context.element;
|
| + while (true) {
|
| + if (element->parentNode() && element->parentNode()->isShadowRoot()) {
|
| + if (!toShadowRoot(element->parentNode())->isOpen())
|
| + break;
|
| + }
|
| + element = element->parentOrShadowHostElement();
|
| + if (!element)
|
| + break;
|
| +
|
| + nextContext.element = element;
|
| Match match = matchSelector(nextContext, result);
|
| if (match == SelectorMatches || match == SelectorFailsCompletely)
|
| return match;
|
| if (nextSelectorExceedsScope(nextContext))
|
| - return SelectorFailsCompletely;
|
| + break;
|
| }
|
| return SelectorFailsCompletely;
|
| }
|
|
|