1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 13:27:34 +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:
Andreas Kling 2023-05-24 10:50:57 +02:00
parent 30262d7023
commit 655d9d1462
80 changed files with 298 additions and 299 deletions

View file

@ -21,7 +21,7 @@ public:
};
GridSize(LengthPercentage);
GridSize(float);
GridSize(double);
GridSize(Type);
GridSize();
~GridSize();
@ -37,7 +37,7 @@ public:
bool is_min_content() const { return m_type == Type::MinContent; }
LengthPercentage length_percentage() const { return m_length_percentage; };
float flex_factor() const { return m_flex_factor; }
double flex_factor() const { return m_flex_factor; }
// https://www.w3.org/TR/css-grid-2/#layout-algorithm
// An intrinsic sizing function (min-content, max-content, auto, fit-content()).
@ -65,7 +65,7 @@ public:
private:
Type m_type;
LengthPercentage m_length_percentage;
float m_flex_factor { 0 };
double m_flex_factor { 0 };
};
class GridMinMax {