LibWeb: Support '<zero>' in '<color-stop-angle>`

`<color-stop-angle> = [ <angle-percentage> | <zero> ]{1,2}` but we were
previously parsing instead as `<angle-percentage>{1,2}`.
This commit is contained in:
Callum Law 2025-10-17 17:25:04 +13:00 committed by Tim Ledbetter
parent cc2c8e8615
commit cdbf4f49e1
Notes: github-actions[bot] 2025-10-17 07:38:48 +00:00
2 changed files with 15 additions and 5 deletions

View file

@ -126,7 +126,18 @@ Optional<Vector<AngularColorStopListElement>> Parser::parse_angular_color_stop_l
// <angular-color-stop> , [ <angular-color-hint>? , <angular-color-stop> ]#
return parse_color_stop_list<AngularColorStopListElement>(
tokens,
[&](auto& it) { return parse_angle_percentage(it); });
[&](TokenStream<ComponentValue>& it) -> Optional<AnglePercentage> {
if (tokens.next_token().is(Token::Type::Number)) {
auto transaction = tokens.begin_transaction();
auto numeric_value = tokens.consume_a_token().token().number_value();
if (numeric_value == 0) {
transaction.commit();
return Angle::make_degrees(0);
}
}
return parse_angle_percentage(it);
});
}
Optional<InterpolationMethod> Parser::parse_interpolation_method(TokenStream<ComponentValue>& tokens)