Index: Source/core/css/SelectorChecker.cpp |
diff --git a/Source/core/css/SelectorChecker.cpp b/Source/core/css/SelectorChecker.cpp |
index 3dff0a3c6d52688f3f4a8310b1ce0c1dbf2cc49a..026f4f9f9a40b923e146a551342791cecf866859 100644 |
--- a/Source/core/css/SelectorChecker.cpp |
+++ b/Source/core/css/SelectorChecker.cpp |
@@ -960,9 +960,9 @@ bool SelectorChecker::checkPseudoClass(const SelectorCheckingContext& context, M |
case CSSSelector::PseudoScope: |
if (m_mode == SharingRules) |
return true; |
- if (context.scope) |
- return context.scope == element; |
- return element == element.document().documentElement(); |
+ if (context.scope == element.document()) |
+ return element == element.document().documentElement(); |
+ return context.scope == element; |
case CSSSelector::PseudoUnresolved: |
return element.isUnresolvedCustomElement(); |
case CSSSelector::PseudoHost: |
@@ -1050,8 +1050,6 @@ bool SelectorChecker::checkPseudoHost(const SelectorCheckingContext& context, Ma |
if (m_mode == SharingRules) |
return true; |
// :host only matches a shadow host when :host is in a shadow tree of the shadow host. |
- if (!context.scope) |
- return false; |
const ContainerNode* shadowHost = context.scope->shadowHost(); |
if (!shadowHost || shadowHost != element) |
return false; |