1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 01:17:46 +00:00

LibWeb: Remove StyleValue::has/to_length()

Specifically, stop letting NumericStyleValues holding `0` from
pretending to hold a Length. The parser is now smart enough that we
don't have to do this. :^)
This commit is contained in:
Sam Atkins 2023-05-27 12:28:25 +01:00 committed by Andreas Kling
parent 6bbf163499
commit e8a946c674
7 changed files with 27 additions and 34 deletions

View file

@ -20,9 +20,7 @@ public:
Length const& length() const { return m_length; }
virtual bool has_length() const override { return true; }
virtual ErrorOr<String> to_string() const override { return m_length.to_string(); }
virtual Length to_length() const override { return m_length; }
virtual ErrorOr<ValueComparingNonnullRefPtr<StyleValue const>> absolutized(CSSPixelRect const& viewport_rect, Length::FontMetrics const& font_metrics, Length::FontMetrics const& root_font_metrics) const override;
bool properties_equal(LengthStyleValue const& other) const { return m_length == other.m_length; }

View file

@ -25,9 +25,6 @@ public:
return adopt_nonnull_ref_or_enomem(new (nothrow) NumericStyleValue(value));
}
virtual bool has_length() const override { return number() == 0; }
virtual Length to_length() const override { return Length::make_px(0); }
float number() const
{
return m_value.visit(