LibWeb: Fail CSS color parse for "rgba(123, 123, 123, "

This matches the behavior of other browsers and fixes a WPT test.
This commit is contained in:
Andreas Kling 2024-10-04 14:26:53 +02:00 committed by Andreas Kling
parent 4590c081c2
commit 902586a21d
Notes: github-actions[bot] 2024-10-04 18:02:20 +00:00
3 changed files with 17 additions and 0 deletions

View file

@ -0,0 +1,2 @@
#008000
#008000

View file

@ -0,0 +1,12 @@
<script src="../include.js"></script>
<canvas id="c" width=300 height=300></canvas>
<script>
test(() => {
let x = c.getContext("2d");
x.fillStyle = 'green';
println(x.fillStyle);
x.fillStyle = 'rgba(255, 0, 0, ';
println(x.fillStyle);
c.remove();
});
</script>

View file

@ -2848,6 +2848,9 @@ RefPtr<CSSStyleValue> Parser::parse_rgb_color_value(TokenStream<ComponentValue>&
alpha = parse_number_percentage_value(inner_tokens);
if (!alpha)
return {};
inner_tokens.skip_whitespace();
if (inner_tokens.has_next_token())