mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 21:08:12 +00:00
LibWeb: Make CSSPixels and Length use 64-bit (double) floating point
This fixes a plethora of rounding problems on many websites. In the future, we may want to replace this with fixed-point arithmetic (bug #18566) for performance (and consistency with other engines), but in the meantime this makes the web look a bit better. :^) There's a lot more things that could be converted to doubles, which would reduce the amount of casting necessary in this patch. We can do that incrementally, however.
This commit is contained in:
parent
30262d7023
commit
655d9d1462
80 changed files with 298 additions and 299 deletions
|
@ -35,7 +35,7 @@ Length::Length(int value, Type type)
|
|||
, m_value(value)
|
||||
{
|
||||
}
|
||||
Length::Length(float value, Type type)
|
||||
Length::Length(double value, Type type)
|
||||
: m_type(type)
|
||||
, m_value(value)
|
||||
{
|
||||
|
@ -59,7 +59,7 @@ Length Length::percentage_of(Percentage const& percentage) const
|
|||
return *this;
|
||||
}
|
||||
|
||||
return Length { percentage.as_fraction() * raw_value(), m_type };
|
||||
return Length { static_cast<double>(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