Index: Source/core/css/SelectorChecker.cpp |
diff --git a/Source/core/css/SelectorChecker.cpp b/Source/core/css/SelectorChecker.cpp |
index 1b80f44312dcbcf29d4abd2eca64197334c50687..03d9571ed64f1b8c34bae204d73a2b7b68bb0d4e 100644 |
--- a/Source/core/css/SelectorChecker.cpp |
+++ b/Source/core/css/SelectorChecker.cpp |
@@ -108,6 +108,9 @@ SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext& con |
if (context.selector->isCustomPseudoElement()) { |
if (!matchesCustomPseudoElement(context.element, context.selector)) |
return SelectorFailsLocally; |
+ } else if (context.selector->isContentPseudoElement()) { |
+ if (!context.element->isInShadowTree() || !context.element->isInsertionPoint()) |
+ return SelectorFailsLocally; |
} else { |
if ((!context.elementStyle && m_mode == ResolvingStyle) || m_mode == QueryingRules) |
return SelectorFailsLocally; |
@@ -157,7 +160,7 @@ SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext& con |
switch (relation) { |
case CSSSelector::Descendant: |
- if (context.selector->relationIsForShadowDistributed()) { |
+ if (context.selector->relationIsAffectedByPseudoContent()) { |
for (Element* element = context.element; element; element = element->parentElement()) { |
if (matchForShadowDistributed(element, siblingTraversalStrategy, ignoreDynamicPseudo, nextContext) == SelectorMatches) |
return SelectorMatches; |
@@ -176,7 +179,7 @@ SelectorChecker::Match SelectorChecker::match(const SelectorCheckingContext& con |
} |
return SelectorFailsCompletely; |
case CSSSelector::Child: |
- if (context.selector->relationIsForShadowDistributed()) |
+ if (context.selector->relationIsAffectedByPseudoContent()) |
return matchForShadowDistributed(context.element, siblingTraversalStrategy, ignoreDynamicPseudo, nextContext); |
nextContext.element = context.element->parentElement(); |
if (!nextContext.element) |