LibWeb: Clamp interpolated font-style angle

This change adds the allowed angle range to the `font-style` property
definition. This allows these angles to be clamped after interpolation.

Ideally, the generator should be updated so that we can specify the
angle is in degrees. This would allow us to make use of this
information during parsing, which we can't do currently because we
don't know what the unit is. Using this value for interpolation
purposes is fine because the angle has been converted to its canonical
unit by this point.
This commit is contained in:
Tim Ledbetter 2025-09-23 16:36:34 +01:00 committed by Sam Atkins
commit 27de4fdcea
Notes: github-actions[bot] 2025-09-24 10:42:06 +00:00
3 changed files with 17 additions and 16 deletions

View file

@ -2974,7 +2974,7 @@ RefPtr<StyleValue const> Parser::parse_font_style_value(TokenStream<ComponentVal
// normal | italic | left | right | oblique <angle [-90deg,90deg]>?
auto transaction = tokens.begin_transaction();
auto keyword_value = parse_css_value_for_property(PropertyID::FontStyle, tokens);
if (!keyword_value)
if (!keyword_value || !keyword_value->is_keyword())
return nullptr;
auto font_style = keyword_to_font_style(keyword_value->to_keyword());
VERIFY(font_style.has_value());