1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:47:35 +00:00

LibWeb: Implement IntegerStyleValue, for holding <integer>

Having one StyleValue for `<number>` and `<integer>` is making user code
more complicated than it needs to be. We know based on the property
being parsed, whether it wants a `<number>` or an `<integer>`, so we
can use separate StyleValue types for these.
This commit is contained in:
Sam Atkins 2023-06-01 17:01:09 +01:00 committed by Andreas Kling
parent ad8565011c
commit 1160d8186b
10 changed files with 105 additions and 23 deletions

View file

@ -295,7 +295,7 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& computed_style)
// That's why it has to be set before everything else.
m_font = computed_style.computed_font();
computed_values.set_font_size(computed_style.property(CSS::PropertyID::FontSize)->as_length().length().to_px(*this).value());
computed_values.set_font_weight(computed_style.property(CSS::PropertyID::FontWeight)->as_number().integer());
computed_values.set_font_weight(round_to<int>(computed_style.property(CSS::PropertyID::FontWeight)->as_number().number()));
m_line_height = computed_style.line_height(*this);
computed_values.set_vertical_align(computed_style.vertical_align());