LibWeb/CSS: Merge ScaleStyleValue into TransformationStyleValue

The only ways this varies from the `scale()` function is with parsing
and serialization. Parsing stays separate, and serialization is done by
telling `TransformationStyleValue` which property it is, and overriding
its normal `to_string()` code for properties other than `transform`.
This commit is contained in:
Sam Atkins 2025-01-15 14:58:23 +00:00 committed by Andreas Kling
commit ac15e626dd
Notes: github-actions[bot] 2025-01-17 09:15:32 +00:00
12 changed files with 52 additions and 132 deletions

View file

@ -16,9 +16,9 @@ namespace Web::CSS {
class TransformationStyleValue final : public StyleValueWithDefaultOperators<TransformationStyleValue> {
public:
static ValueComparingNonnullRefPtr<TransformationStyleValue> create(CSS::TransformFunction transform_function, StyleValueVector&& values)
static ValueComparingNonnullRefPtr<TransformationStyleValue> create(PropertyID property, TransformFunction transform_function, StyleValueVector&& values)
{
return adopt_ref(*new (nothrow) TransformationStyleValue(transform_function, move(values)));
return adopt_ref(*new (nothrow) TransformationStyleValue(property, transform_function, move(values)));
}
virtual ~TransformationStyleValue() override = default;
@ -32,14 +32,15 @@ public:
bool properties_equal(TransformationStyleValue const& other) const { return m_properties == other.m_properties; }
private:
TransformationStyleValue(CSS::TransformFunction transform_function, StyleValueVector&& values)
TransformationStyleValue(PropertyID property, TransformFunction transform_function, StyleValueVector&& values)
: StyleValueWithDefaultOperators(Type::Transformation)
, m_properties { .transform_function = transform_function, .values = move(values) }
, m_properties { .property = property, .transform_function = transform_function, .values = move(values) }
{
}
struct Properties {
CSS::TransformFunction transform_function;
PropertyID property;
TransformFunction transform_function;
StyleValueVector values;
bool operator==(Properties const& other) const;
} m_properties;