/* * Copyright (c) 2023, Ali Mohammad Pur * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include namespace Web::CSS { class ShorthandStyleValue final : public StyleValueWithDefaultOperators { public: static ValueComparingNonnullRefPtr create(PropertyID shorthand, Vector sub_properties, Vector> values) { return adopt_ref(*new ShorthandStyleValue(shorthand, move(sub_properties), move(values))); } virtual ~ShorthandStyleValue() override; Vector const& sub_properties() const { return m_properties.sub_properties; } Vector> const& values() const { return m_properties.values; } ValueComparingRefPtr longhand(PropertyID) const; virtual void serialize(StringBuilder&, SerializationMode) const override; bool properties_equal(ShorthandStyleValue const& other) const { return m_properties == other.m_properties; } virtual bool is_computationally_independent() const override { return all_of(m_properties.values, [](auto& value) { return value->is_computationally_independent(); }); } private: ShorthandStyleValue(PropertyID shorthand, Vector sub_properties, Vector> values); virtual void set_style_sheet(GC::Ptr) override; struct Properties { PropertyID shorthand_property; Vector sub_properties; Vector> values; bool operator==(Properties const&) const = default; } m_properties; }; }