From 9bebb3a61a14bd53e77f890a198b7b51fff7d68c Mon Sep 17 00:00:00 2001 From: FranklinDM Date: Sun, 19 Feb 2023 23:38:20 +0800 Subject: [PATCH] Issue #1593 - Follow-up: :host() should not automatically match if we have a non-empty selector list --- layout/style/nsCSSRuleProcessor.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/layout/style/nsCSSRuleProcessor.cpp b/layout/style/nsCSSRuleProcessor.cpp index c8f888e7a1..3644e3e45b 100644 --- a/layout/style/nsCSSRuleProcessor.cpp +++ b/layout/style/nsCSSRuleProcessor.cpp @@ -1960,15 +1960,15 @@ static bool SelectorMatches(Element* aElement, // selector. // We match automatically if GetParent() and GetShadowRoot() have - // the same result. Without special casing this ahead of all other - // selector matching, it fails. Have not determined the cause. - - if (aElement->GetParent() == aElement->GetShadowRoot()) { + // the same result iff our selector list is empty. Without special + // casing this ahead of all other selector matching, it fails. + // Have not determined the cause. + if (!pseudoClass->u.mSelectorList && + aElement->GetParent() == aElement->GetShadowRoot()) { break; } // Match if any selector in the argument list matches. - NodeMatchContext nodeContext(EventStates(), nsCSSRuleProcessor::IsLink(aElement)); if (SelectorListMatches(aElement,