diff options
author | FranklinDM <mrmineshafter17@gmail.com> | 2023-03-10 17:19:18 +0800 |
---|---|---|
committer | FranklinDM <mrmineshafter17@gmail.com> | 2023-03-10 19:14:25 +0800 |
commit | 40c9c92116ffbf26995c0186beef792f9f814bba (patch) | |
tree | c7d577f8891330b6a2f66399e34424c1f9a85ce9 /layout | |
parent | e9a18599158301e5aa2b8ff3597455f5fe62ca44 (diff) | |
download | uxp-40c9c92116ffbf26995c0186beef792f9f814bba.tar.gz |
Issue #2137 - Part 3: Don't always use the internal pseudo-class for handling negations
Diffstat (limited to 'layout')
-rw-r--r-- | layout/style/nsCSSParser.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 38e2759bb4..1c41e80156 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -6637,11 +6637,21 @@ CSSParserImpl::ParsePseudoClassWithSelectorListArg(nsCSSSelector& aSelector, while (negations->mNegations) { negations = negations->mNegations; } - // XXX: Use a special internal-only pseudo-class to handle selector lists. - // TODO: This should only happen if we don't have a simple selector. - nsCSSSelector* newSel = new nsCSSSelector(); - newSel->AddPseudoClass(CSSPseudoClassType::mozAnyPrivate, slist.forget()); - negations->mNegations = newSel; + // XXX: Use a special internal-only pseudo-class to handle selector lists + // if we have: (a) a complex selector, (b) nested negation pseudo-class, + // or (c) more than one selector argument in the list. + if (slist->mNext || + slist->mSelectors->mNext || + slist->mSelectors->mNegations) { + nsCSSSelector* newSel = new nsCSSSelector(); + newSel->AddPseudoClass(CSSPseudoClassType::mozAnyPrivate, + slist.forget()); + negations->mNegations = newSel; + } else { + // Otherwise, steal the first selector and add it directly to the + // end of aSelector.mNegations. + negations->mNegations = (slist.forget())->mSelectors; + } } else { // Add the pseudo with the selector list parameter aSelector.AddPseudoClass(aType, slist.forget()); |