diff --git a/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp b/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp index 935827bb5f3..8c2a11a1f1e 100644 --- a/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp +++ b/Libraries/LibWeb/CSS/Parser/PropertyParsing.cpp @@ -895,12 +895,15 @@ RefPtr Parser::parse_counter_definitions_value(TokenStream | - auto& token = tokens.consume_a_token(); - if (token.is(Token::Type::Ident)) { - definition.name = token.token().ident(); + auto& token = tokens.next_token(); + + // A name cannot match the keyword none; such an identifier is invalid as a . + if (auto counter_name = parse_custom_ident_value(tokens, { { "none"sv } })) { + definition.name = counter_name->custom_ident(); definition.is_reversed = false; } else if (allow_reversed == AllowReversed::Yes && token.is_function("reversed"sv)) { TokenStream function_tokens { token.function().value }; + tokens.discard_a_token(); function_tokens.discard_whitespace(); auto& name_token = function_tokens.consume_a_token(); if (!name_token.is(Token::Type::Ident)) diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-lists/parsing/counter-increment-invalid.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-lists/parsing/counter-increment-invalid.txt new file mode 100644 index 00000000000..4622d38240a --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-lists/parsing/counter-increment-invalid.txt @@ -0,0 +1,18 @@ +Harness status: OK + +Found 13 tests + +13 Pass +Pass e.style['counter-increment'] = "none chapter" should not set the property value +Pass e.style['counter-increment'] = "reversed(none)" should not set the property value +Pass e.style['counter-increment'] = "reversed(chapter)" should not set the property value +Pass e.style['counter-increment'] = "3" should not set the property value +Pass e.style['counter-increment'] = "99 imagenum" should not set the property value +Pass e.style['counter-increment'] = "section -1, imagenum 99" should not set the property value +Pass e.style['counter-increment'] = "section 3.14" should not set the property value +Pass e.style['counter-increment'] = "inherit 1" should not set the property value +Pass e.style['counter-increment'] = "initial 1" should not set the property value +Pass e.style['counter-increment'] = "unset 1" should not set the property value +Pass e.style['counter-increment'] = "default 1" should not set the property value +Pass e.style['counter-increment'] = "revert 1" should not set the property value +Pass e.style['counter-increment'] = "revert-layer 1" should not set the property value \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-lists/parsing/counter-reset-invalid.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-lists/parsing/counter-reset-invalid.txt new file mode 100644 index 00000000000..cb081caa800 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-lists/parsing/counter-reset-invalid.txt @@ -0,0 +1,20 @@ +Harness status: OK + +Found 15 tests + +15 Pass +Pass e.style['counter-reset'] = "none chapter" should not set the property value +Pass e.style['counter-reset'] = "reversed(none)" should not set the property value +Pass e.style['counter-reset'] = "reversed(chapter) none" should not set the property value +Pass e.style['counter-reset'] = "3" should not set the property value +Pass e.style['counter-reset'] = "reversed(3)" should not set the property value +Pass e.style['counter-reset'] = "99 imagenum" should not set the property value +Pass e.style['counter-reset'] = "99 reversed(imagenum)" should not set the property value +Pass e.style['counter-reset'] = "section -1, imagenum 99" should not set the property value +Pass e.style['counter-reset'] = "section 3.14" should not set the property value +Pass e.style['counter-reset'] = "inherit 0" should not set the property value +Pass e.style['counter-reset'] = "initial 0" should not set the property value +Pass e.style['counter-reset'] = "unset 0" should not set the property value +Pass e.style['counter-reset'] = "default 0" should not set the property value +Pass e.style['counter-reset'] = "revert 0" should not set the property value +Pass e.style['counter-reset'] = "revert-layer 0" should not set the property value \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-lists/parsing/counter-set-invalid.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-lists/parsing/counter-set-invalid.txt new file mode 100644 index 00000000000..d0cbfd0a611 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-lists/parsing/counter-set-invalid.txt @@ -0,0 +1,18 @@ +Harness status: OK + +Found 13 tests + +13 Pass +Pass e.style['counter-set'] = "none chapter" should not set the property value +Pass e.style['counter-set'] = "reversed(none)" should not set the property value +Pass e.style['counter-set'] = "reversed(chapter)" should not set the property value +Pass e.style['counter-set'] = "3" should not set the property value +Pass e.style['counter-set'] = "99 imagenum" should not set the property value +Pass e.style['counter-set'] = "section -1, imagenum 99" should not set the property value +Pass e.style['counter-set'] = "section 3.14" should not set the property value +Pass e.style['counter-set'] = "inherit 2" should not set the property value +Pass e.style['counter-set'] = "initial 2" should not set the property value +Pass e.style['counter-set'] = "unset 2" should not set the property value +Pass e.style['counter-set'] = "default 2" should not set the property value +Pass e.style['counter-set'] = "revert 2" should not set the property value +Pass e.style['counter-set'] = "revert-layer 2" should not set the property value \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-lists/parsing/counter-increment-invalid.html b/Tests/LibWeb/Text/input/wpt-import/css/css-lists/parsing/counter-increment-invalid.html new file mode 100644 index 00000000000..b1b2d606823 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/css/css-lists/parsing/counter-increment-invalid.html @@ -0,0 +1,29 @@ + + + + +CSS Lists: parsing counter-increment with invalid values + + + + + + + + + + diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-lists/parsing/counter-reset-invalid.html b/Tests/LibWeb/Text/input/wpt-import/css/css-lists/parsing/counter-reset-invalid.html new file mode 100644 index 00000000000..d8b0367947e --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/css/css-lists/parsing/counter-reset-invalid.html @@ -0,0 +1,31 @@ + + + + +CSS Lists: parsing counter-reset with invalid values + + + + + + + + + + diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-lists/parsing/counter-set-invalid.html b/Tests/LibWeb/Text/input/wpt-import/css/css-lists/parsing/counter-set-invalid.html new file mode 100644 index 00000000000..47307b98d6a --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/css/css-lists/parsing/counter-set-invalid.html @@ -0,0 +1,29 @@ + + + + +CSS Lists: parsing counter-set with invalid values + + + + + + + + + +