#pragma once #include #include #include #include class StyleValue : public RefCounted { public: static NonnullRefPtr parse(const StringView&); virtual ~StyleValue(); enum Type { Invalid, Inherit, Initial, Primitive, }; Type type() const { return m_type; } virtual String to_string() const = 0; protected: explicit StyleValue(Type); private: Type m_type { Type::Invalid }; }; class PrimitiveStyleValue : public StyleValue { public: virtual ~PrimitiveStyleValue() override {} PrimitiveStyleValue(const String& string) : StyleValue(Type::Primitive) , m_string(string) { } String to_string() const override { return m_string; } private: String m_string; };