LibWeb/CSS: Treat counters() function with 1 argument as invalid

Fixes #887.
This commit is contained in:
Sam Atkins 2024-07-29 16:20:36 +01:00 committed by Tim Flynn
parent 0bfcf73524
commit 5abe246385
Notes: github-actions[bot] 2024-07-29 16:58:37 +00:00
3 changed files with 17 additions and 1 deletions

View File

@ -0,0 +1,11 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x600 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x17 children: inline
frag 0 from TextNode start: 0, length: 19, rect: [8,8 162.109375x17] baseline: 13.296875
"PASS (didn't crash)"
TextNode <#text>
ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x17]
TextPaintable (TextNode<#text>)

View File

@ -0,0 +1,5 @@
<style>
html {
content: counters(index);
}
</style>PASS (didn't crash)

View File

@ -3003,7 +3003,7 @@ RefPtr<StyleValue> Parser::parse_counter_value(TokenStream<ComponentValue>& toke
auto& function = token.function();
TokenStream function_tokens { function.values() };
auto function_values = parse_a_comma_separated_list_of_component_values(function_tokens);
if (function_values.is_empty() || function_values.size() > 3)
if (function_values.size() < 2 || function_values.size() > 3)
return nullptr;
TokenStream name_tokens { function_values[0] };