summaryrefslogtreecommitdiff
path: root/layout
diff options
context:
space:
mode:
authorFranklinDM <mrmineshafter17@gmail.com>2023-02-21 20:00:53 +0800
committerFranklinDM <mrmineshafter17@gmail.com>2023-02-21 22:50:18 +0800
commite0226ccae6493e9e79631c31dee5755863a98c44 (patch)
tree15ad996312f9677d2ab37cb2928af6b448c8146e /layout
parent9c1d44f5f6503dfa7e011c792240a5bb9c107b2f (diff)
downloaduxp-e0226ccae6493e9e79631c31dee5755863a98c44.tar.gz
Issue #1593 - Follow-up: Accept only a single selector in the argument of :host/:host-context
Current spec says these two pseudo-classes accept only a single compound selector: :host( <compound-selector> ) :host-context( <compound-selector> )
Diffstat (limited to 'layout')
-rw-r--r--layout/style/nsCSSParser.cpp5
-rw-r--r--layout/style/nsCSSPseudoClasses.cpp7
-rw-r--r--layout/style/nsCSSPseudoClasses.h1
3 files changed, 13 insertions, 0 deletions
diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp
index c81de2d9f6..63a9bc0514 100644
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -6547,6 +6547,11 @@ CSSParserImpl::ParsePseudoClassWithSelectorListArg(nsCSSSelector& aSelector,
return eSelectorParsingStatus_Error; // our caller calls SkipUntil(')')
}
+ if (nsCSSPseudoClasses::HasSingleSelectorArg(aType) &&
+ slist->mNext) {
+ return eSelectorParsingStatus_Error; // our caller calls SkipUntil(')')
+ }
+
for (nsCSSSelectorList *l = slist; l; l = l->mNext) {
nsCSSSelector *s = l->mSelectors;
if (s == nullptr) {
diff --git a/layout/style/nsCSSPseudoClasses.cpp b/layout/style/nsCSSPseudoClasses.cpp
index a174525b1c..928326e399 100644
--- a/layout/style/nsCSSPseudoClasses.cpp
+++ b/layout/style/nsCSSPseudoClasses.cpp
@@ -102,6 +102,13 @@ nsCSSPseudoClasses::HasNthPairArg(Type aType)
aType == Type::nthLastOfType;
}
+bool
+nsCSSPseudoClasses::HasSingleSelectorArg(Type aType)
+{
+ return aType == Type::host ||
+ aType == Type::hostContext;
+}
+
void
nsCSSPseudoClasses::PseudoTypeToString(Type aType, nsAString& aString)
{
diff --git a/layout/style/nsCSSPseudoClasses.h b/layout/style/nsCSSPseudoClasses.h
index 4a4bbe188c..76fcef3f78 100644
--- a/layout/style/nsCSSPseudoClasses.h
+++ b/layout/style/nsCSSPseudoClasses.h
@@ -58,6 +58,7 @@ public:
static Type GetPseudoType(nsIAtom* aAtom, EnabledState aEnabledState);
static bool HasStringArg(Type aType);
static bool HasNthPairArg(Type aType);
+ static bool HasSingleSelectorArg(Type aType);
static bool HasForgivingSelectorListArg(Type aType) {
return aType == Type::is ||
aType == Type::matches ||