Issue #2078 - Follow-up: Don't try to resolve ancestor link elements when matching for Has*DependentStyle

This commit is contained in:
Martok 2025-01-22 00:11:03 +01:00 committed by roytam1
commit 77728935ef

View file

@ -2772,8 +2772,9 @@ static bool SelectorListMatches(Element* aElement,
nsCSSSelector* next = selector->mNext;
SelectorMatchesTreeFlags selectorTreeFlags = SelectorMatchesTreeFlags(0);
// Try to look for the closest ancestor link element if we're processing
// the selector list argument of a pseudo-class.
// the selector list argument of a pseudo-class, but only if for a new style context (see SelectorMatches).
if (!aNodeMatchContext.mIsRelevantLink &&
aTreeMatchContext.mForStyling &&
(aSelectorFlags & SelectorMatchesFlags::IS_PSEUDO_CLASS_ARGUMENT)) {
selectorTreeFlags = eLookForRelevantLink;
}