mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
LibWeb: Convert NumberStyleValue from float to double
We have double precision in the parser, and currently use doubles for most of layout, so we might as well keep that extra precision inside NumberStyleValue too.
This commit is contained in:
parent
8889635ba7
commit
7ce4cbfe1d
Notes:
sideshowbarker
2024-07-17 00:53:02 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/7ce4cbfe1d Pull-request: https://github.com/SerenityOS/serenity/pull/19208
@ -15,25 +15,25 @@ namespace Web::CSS {
|
||||
|
||||
class NumberStyleValue : public StyleValueWithDefaultOperators<NumberStyleValue> {
|
||||
public:
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<NumberStyleValue>> create(float value)
|
||||
static ErrorOr<ValueComparingNonnullRefPtr<NumberStyleValue>> create(double value)
|
||||
{
|
||||
return adopt_nonnull_ref_or_enomem(new (nothrow) NumberStyleValue(value));
|
||||
}
|
||||
|
||||
float number() const { return m_value; }
|
||||
double number() const { return m_value; }
|
||||
|
||||
virtual ErrorOr<String> to_string() const override;
|
||||
|
||||
bool properties_equal(NumberStyleValue const& other) const { return m_value == other.m_value; }
|
||||
|
||||
private:
|
||||
explicit NumberStyleValue(float value)
|
||||
explicit NumberStyleValue(double value)
|
||||
: StyleValueWithDefaultOperators(Type::Number)
|
||||
, m_value(value)
|
||||
{
|
||||
}
|
||||
|
||||
float m_value { 0 };
|
||||
double m_value { 0 };
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user