LibWeb/CSS: Avoid calling to_font_weight() when serializing font

This function attempts to resolve `lighter` and `bolder`, which we don't
want to do when serializing - that should happen in style computation.

This has the unexpected bonus of 37 more WPT passes!
This commit is contained in:
Sam Atkins 2025-05-23 16:19:35 +01:00 committed by Tim Ledbetter
commit f5cd853597
Notes: github-actions[bot] 2025-05-24 12:36:28 +00:00
2 changed files with 41 additions and 41 deletions

View file

@ -238,8 +238,9 @@ String ShorthandStyleValue::to_string(SerializationMode mode) const
append(font_style_string);
if (font_variant_string != "normal"sv && font_variant_string != "initial"sv)
append(font_variant_string);
if (font_weight->to_font_weight() != Gfx::FontWeight::Regular && font_weight->to_keyword() != Keyword::Initial)
append(font_weight->to_string(mode));
auto font_weight_string = font_weight->to_string(mode);
if (font_weight_string != "normal"sv && font_weight_string != "initial"sv && font_weight_string != "400"sv)
append(font_weight_string);
if (font_width->to_keyword() != Keyword::Normal && font_width->to_keyword() != Keyword::Initial)
append(font_width->to_string(mode));
append(font_size->to_string(mode));