mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-29 14:32:55 +00:00
LibWeb/CSS: Disallow invalid <counter-name>
values
We now parse `<counter-name>` values as a `<custom-ident>`. This disallows `default` and CSS-wide keywords as counter names. The specification additionally disallows `none` as a counter name.
This commit is contained in:
parent
76aa99a626
commit
ad4ade3f07
Notes:
github-actions[bot]
2025-03-13 05:24:17 +00:00
Author: https://github.com/tcl3
Commit: ad4ade3f07
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3917
Reviewed-by: https://github.com/AtkinsSJ ✅
7 changed files with 151 additions and 3 deletions
|
@ -895,12 +895,15 @@ RefPtr<CSSStyleValue> Parser::parse_counter_definitions_value(TokenStream<Compon
|
|||
CounterDefinition definition {};
|
||||
|
||||
// <counter-name> | <reversed-counter-name>
|
||||
auto& token = tokens.consume_a_token();
|
||||
if (token.is(Token::Type::Ident)) {
|
||||
definition.name = token.token().ident();
|
||||
auto& token = tokens.next_token();
|
||||
|
||||
// A <counter-name> name cannot match the keyword none; such an identifier is invalid as a <counter-name>.
|
||||
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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue