diff options
author | Sam Atkins <atkinssj@gmail.com> | 2021-08-05 17:19:29 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-14 12:45:01 +0200 |
commit | c27f99fc1d541f995673653961414a87ac81aee0 (patch) | |
tree | 1b4a8042cdfb9431ee16b46b5b4d6b909e2d1ff5 /Userland/Libraries/LibWeb/CSS/StyleValue.h | |
parent | ab57d7b4086b39c9d3d6f4dc6d43e71e5fc04647 (diff) | |
download | serenity-c27f99fc1d541f995673653961414a87ac81aee0.zip |
LibWeb: Implement and use FlexFlowStyleValue
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/StyleValue.h')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/StyleValue.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/StyleValue.h b/Userland/Libraries/LibWeb/CSS/StyleValue.h index 1699a36d58..8fbe2dd7b8 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleValue.h +++ b/Userland/Libraries/LibWeb/CSS/StyleValue.h @@ -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))); } |