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

LibWeb: Replace FlexStyleValue with ShorthandStyleValue

We still need the custom parsing and to_string() logic, but nothing
else. :^)
This commit is contained in:
Sam Atkins 2023-09-19 16:26:23 +01:00 committed by Sam Atkins
parent a72788b889
commit aa45b3dfe3
11 changed files with 44 additions and 106 deletions

View file

@ -12,23 +12,26 @@ namespace Web::CSS {
class ShorthandStyleValue final : public StyleValueWithDefaultOperators<ShorthandStyleValue> {
public:
static ValueComparingNonnullRefPtr<ShorthandStyleValue> create(Vector<PropertyID> sub_properties, Vector<ValueComparingNonnullRefPtr<StyleValue const>> values)
static ValueComparingNonnullRefPtr<ShorthandStyleValue> create(PropertyID shorthand, Vector<PropertyID> sub_properties, Vector<ValueComparingNonnullRefPtr<StyleValue const>> values)
{
return adopt_ref(*new ShorthandStyleValue(move(sub_properties), move(values)));
return adopt_ref(*new ShorthandStyleValue(shorthand, move(sub_properties), move(values)));
}
virtual ~ShorthandStyleValue() override;
Vector<PropertyID> const& sub_properties() const { return m_properties.sub_properties; }
Vector<ValueComparingNonnullRefPtr<StyleValue const>> const& values() const { return m_properties.values; }
ValueComparingRefPtr<StyleValue const> longhand(PropertyID) const;
virtual String to_string() const override;
bool properties_equal(ShorthandStyleValue const& other) const { return m_properties == other.m_properties; }
private:
ShorthandStyleValue(Vector<PropertyID> sub_properties, Vector<ValueComparingNonnullRefPtr<StyleValue const>> values);
ShorthandStyleValue(PropertyID shorthand, Vector<PropertyID> sub_properties, Vector<ValueComparingNonnullRefPtr<StyleValue const>> values);
struct Properties {
PropertyID shorthand_property;
Vector<PropertyID> sub_properties;
Vector<ValueComparingNonnullRefPtr<StyleValue const>> values;
bool operator==(Properties const&) const = default;