2019-06-21 00:25:25 +03:00
|
|
|
#pragma once
|
|
|
|
|
2019-06-22 22:48:21 +03:00
|
|
|
#include <AK/AKString.h>
|
2019-06-21 19:58:45 +03:00
|
|
|
#include <AK/RefCounted.h>
|
2019-06-22 22:48:21 +03:00
|
|
|
#include <AK/RefPtr.h>
|
|
|
|
#include <AK/StringView.h>
|
2019-06-21 00:25:25 +03:00
|
|
|
|
2019-06-21 16:29:31 +03:00
|
|
|
class StyleValue : public RefCounted<StyleValue> {
|
2019-06-21 00:25:25 +03:00
|
|
|
public:
|
2019-06-22 22:48:21 +03:00
|
|
|
static NonnullRefPtr<StyleValue> parse(const StringView&);
|
|
|
|
|
2019-06-21 00:25:25 +03:00
|
|
|
virtual ~StyleValue();
|
|
|
|
|
|
|
|
enum Type {
|
|
|
|
Invalid,
|
|
|
|
Inherit,
|
|
|
|
Initial,
|
|
|
|
Primitive,
|
|
|
|
};
|
|
|
|
|
|
|
|
Type type() const { return m_type; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
explicit StyleValue(Type);
|
|
|
|
|
|
|
|
private:
|
|
|
|
Type m_type { Type::Invalid };
|
|
|
|
};
|
2019-06-22 22:48:21 +03:00
|
|
|
|
|
|
|
class PrimitiveStyleValue : public StyleValue {
|
|
|
|
public:
|
|
|
|
virtual ~PrimitiveStyleValue() override {}
|
|
|
|
PrimitiveStyleValue(const String& string)
|
|
|
|
: StyleValue(Type::Primitive)
|
|
|
|
, m_string(string)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
String to_string() const { return m_string; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
String m_string;
|
|
|
|
};
|