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

LibWeb: Split OverflowStyleValue out of StyleValue.{h,cpp}

This commit is contained in:
Sam Atkins 2023-03-24 17:20:16 +00:00 committed by Linus Groh
parent 7f6add1c6e
commit f98634586e
7 changed files with 68 additions and 34 deletions

View file

@ -627,35 +627,6 @@ private:
NonnullOwnPtr<CalcSum> m_expression;
};
class OverflowStyleValue final : public StyleValueWithDefaultOperators<OverflowStyleValue> {
public:
static ValueComparingNonnullRefPtr<OverflowStyleValue> create(ValueComparingNonnullRefPtr<StyleValue> overflow_x, ValueComparingNonnullRefPtr<StyleValue> overflow_y)
{
return adopt_ref(*new OverflowStyleValue(move(overflow_x), move(overflow_y)));
}
virtual ~OverflowStyleValue() override = default;
ValueComparingNonnullRefPtr<StyleValue> overflow_x() const { return m_properties.overflow_x; }
ValueComparingNonnullRefPtr<StyleValue> overflow_y() const { return m_properties.overflow_y; }
virtual ErrorOr<String> to_string() const override;
bool properties_equal(OverflowStyleValue const& other) const { return m_properties == other.m_properties; }
private:
OverflowStyleValue(ValueComparingNonnullRefPtr<StyleValue> overflow_x, ValueComparingNonnullRefPtr<StyleValue> overflow_y)
: StyleValueWithDefaultOperators(Type::Overflow)
, m_properties { .overflow_x = move(overflow_x), .overflow_y = move(overflow_y) }
{
}
struct Properties {
ValueComparingNonnullRefPtr<StyleValue> overflow_x;
ValueComparingNonnullRefPtr<StyleValue> overflow_y;
bool operator==(Properties const&) const = default;
} m_properties;
};
class PercentageStyleValue final : public StyleValueWithDefaultOperators<PercentageStyleValue> {
public:
static ValueComparingNonnullRefPtr<PercentageStyleValue> create(Percentage percentage)