mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:37:35 +00:00
LibWeb: Add transform property to the system
This patch adds parsing support as well as all the needed stuctures all over LibWeb to pass Transformations around.
This commit is contained in:
parent
74b88a8156
commit
9ebfafafbe
8 changed files with 133 additions and 0 deletions
|
@ -219,6 +219,10 @@ enum class AlignItems {
|
|||
Stretch,
|
||||
};
|
||||
|
||||
enum class TransformFunction {
|
||||
TranslateY,
|
||||
};
|
||||
|
||||
class StyleValue : public RefCounted<StyleValue> {
|
||||
public:
|
||||
virtual ~StyleValue();
|
||||
|
@ -249,6 +253,7 @@ public:
|
|||
ListStyle,
|
||||
Overflow,
|
||||
TextDecoration,
|
||||
Transformation,
|
||||
};
|
||||
|
||||
Type type() const { return m_type; }
|
||||
|
@ -276,6 +281,7 @@ public:
|
|||
bool is_list_style() const { return type() == Type::ListStyle; }
|
||||
bool is_overflow() const { return type() == Type::Overflow; }
|
||||
bool is_text_decoration() const { return type() == Type::TextDecoration; }
|
||||
bool is_transformation() const { return type() == Type::Transformation; }
|
||||
|
||||
bool is_builtin() const { return is_inherit() || is_initial() || is_unset(); }
|
||||
|
||||
|
@ -1060,6 +1066,34 @@ private:
|
|||
NonnullRefPtr<StyleValue> m_color;
|
||||
};
|
||||
|
||||
class TransformationStyleValue final : public StyleValue {
|
||||
public:
|
||||
static NonnullRefPtr<TransformationStyleValue> create(CSS::TransformFunction transform_function, NonnullRefPtrVector<StyleValue>&& values)
|
||||
{
|
||||
return adopt_ref(*new TransformationStyleValue(transform_function, move(values)));
|
||||
}
|
||||
virtual ~TransformationStyleValue() override { }
|
||||
|
||||
CSS::TransformFunction transform_function() const { return m_transform_function; }
|
||||
NonnullRefPtrVector<StyleValue> values() const { return m_values; }
|
||||
|
||||
virtual String to_string() const override
|
||||
{
|
||||
return String::formatted("TransformationStyleValue");
|
||||
}
|
||||
|
||||
private:
|
||||
TransformationStyleValue(CSS::TransformFunction transform_function, NonnullRefPtrVector<StyleValue>&& values)
|
||||
: StyleValue(Type::Transformation)
|
||||
, m_transform_function(transform_function)
|
||||
, m_values(move(values))
|
||||
{
|
||||
}
|
||||
|
||||
CSS::TransformFunction m_transform_function;
|
||||
NonnullRefPtrVector<StyleValue> m_values;
|
||||
};
|
||||
|
||||
class StyleValueList final : public StyleValue {
|
||||
public:
|
||||
static NonnullRefPtr<StyleValueList> create(NonnullRefPtrVector<StyleValue>&& values) { return adopt_ref(*new StyleValueList(move(values))); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue