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

LibWeb: Use doubles for CSS dimension types

Avoid unintentionally converting between float and double multiple times
by just using double everywhere. Also, remove the unused `int` versions
of their constructors.
This commit is contained in:
Sam Atkins 2023-08-20 13:02:41 +01:00 committed by Sam Atkins
parent 95f80bc65b
commit 1feacd4b52
16 changed files with 34 additions and 73 deletions

View file

@ -13,8 +13,8 @@ namespace Web::CSS {
// https://www.w3.org/TR/css-values-4/#ratios
class Ratio {
public:
Ratio(float first, float second = 1);
float value() const { return m_first_value / m_second_value; }
Ratio(double first, double second = 1);
double value() const { return m_first_value / m_second_value; }
bool is_degenerate() const;
ErrorOr<String> to_string() const;
@ -37,8 +37,8 @@ public:
}
private:
float m_first_value { 0 };
float m_second_value { 1 };
double m_first_value { 0 };
double m_second_value { 1 };
};
}