mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 16:17:47 +00:00
LibWeb: Remove 3 decimal places rounding hack in Length::percentage_of
CSSPixels uses fixed point now.
This commit is contained in:
parent
f2c60b7716
commit
a426263dee
2 changed files with 9 additions and 17 deletions
|
@ -59,15 +59,7 @@ Length Length::percentage_of(Percentage const& percentage) const
|
|||
return *this;
|
||||
}
|
||||
|
||||
// HACK: We round to 3 decimal places to emulate what happens in browsers that used fixed point math.
|
||||
// FIXME: Remove this when converting CSSPixels to a fixed-point type.
|
||||
// https://github.com/SerenityOS/serenity/issues/18566
|
||||
auto value = percentage.as_fraction() * raw_value();
|
||||
value *= 1000;
|
||||
value = round(value);
|
||||
value /= 1000;
|
||||
|
||||
return Length { value, m_type };
|
||||
return Length { percentage.as_fraction() * raw_value(), m_type };
|
||||
}
|
||||
|
||||
CSSPixels Length::font_relative_length_to_px(Length::FontMetrics const& font_metrics, Length::FontMetrics const& root_font_metrics) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue