1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:58:12 +00:00

LibWeb: Distinguish between integer and float in NumericStyleValue

We have this information when parsing, and some properties specifically
only allow integers, so it makes sense to keep that around.
This commit is contained in:
Sam Atkins 2021-10-19 16:43:56 +01:00 committed by Andreas Kling
parent 450b782c18
commit 78e57096e2
7 changed files with 55 additions and 30 deletions

View file

@ -665,8 +665,8 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele
default:
break;
}
} else if (font_weight->is_numeric()) {
int font_weight_integer = roundf(static_cast<NumericStyleValue const&>(*font_weight).value());
} else if (font_weight->has_integer()) {
int font_weight_integer = font_weight->to_integer();
if (font_weight_integer <= Gfx::FontWeight::Regular)
weight = Gfx::FontWeight::Regular;
else if (font_weight_integer <= Gfx::FontWeight::Bold)