mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:47:44 +00:00
LibWeb: Implement and use FlexFlowStyleValue
This commit is contained in:
parent
ab57d7b408
commit
c27f99fc1d
4 changed files with 101 additions and 63 deletions
|
@ -232,6 +232,7 @@ public:
|
|||
Background,
|
||||
BoxShadow,
|
||||
Flex,
|
||||
FlexFlow,
|
||||
Font,
|
||||
ListStyle,
|
||||
TextDecoration,
|
||||
|
@ -254,6 +255,7 @@ public:
|
|||
bool is_background() const { return type() == Type::Background; }
|
||||
bool is_box_shadow() const { return type() == Type::BoxShadow; }
|
||||
bool is_flex() const { return type() == Type::Flex; }
|
||||
bool is_flex_flow() const { return type() == Type::FlexFlow; }
|
||||
bool is_font() const { return type() == Type::Font; }
|
||||
bool is_list_style() const { return type() == Type::ListStyle; }
|
||||
bool is_text_decoration() const { return type() == Type::TextDecoration; }
|
||||
|
@ -716,6 +718,34 @@ private:
|
|||
NonnullRefPtr<StyleValue> m_basis;
|
||||
};
|
||||
|
||||
class FlexFlowStyleValue final : public StyleValue {
|
||||
public:
|
||||
static NonnullRefPtr<FlexFlowStyleValue> create(NonnullRefPtr<StyleValue> flex_direction, NonnullRefPtr<StyleValue> flex_wrap)
|
||||
{
|
||||
return adopt_ref(*new FlexFlowStyleValue(flex_direction, flex_wrap));
|
||||
}
|
||||
virtual ~FlexFlowStyleValue() override { }
|
||||
|
||||
NonnullRefPtr<StyleValue> flex_direction() const { return m_flex_direction; }
|
||||
NonnullRefPtr<StyleValue> flex_wrap() const { return m_flex_wrap; }
|
||||
|
||||
virtual String to_string() const override
|
||||
{
|
||||
return String::formatted("FlexFlow flex_direction: {}, flex_wrap: {}", m_flex_direction->to_string(), m_flex_wrap->to_string());
|
||||
}
|
||||
|
||||
private:
|
||||
FlexFlowStyleValue(NonnullRefPtr<StyleValue> flex_direction, NonnullRefPtr<StyleValue> flex_wrap)
|
||||
: StyleValue(Type::FlexFlow)
|
||||
, m_flex_direction(flex_direction)
|
||||
, m_flex_wrap(flex_wrap)
|
||||
{
|
||||
}
|
||||
|
||||
NonnullRefPtr<StyleValue> m_flex_direction;
|
||||
NonnullRefPtr<StyleValue> m_flex_wrap;
|
||||
};
|
||||
|
||||
class FontStyleValue final : public StyleValue {
|
||||
public:
|
||||
static NonnullRefPtr<FontStyleValue> create(NonnullRefPtr<StyleValue> font_style, NonnullRefPtr<StyleValue> font_weight, NonnullRefPtr<StyleValue> font_size, NonnullRefPtr<StyleValue> line_height, NonnullRefPtrVector<StyleValue>&& font_families) { return adopt_ref(*new FontStyleValue(font_style, font_weight, font_size, line_height, move(font_families))); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue