mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:27:45 +00:00
LibWeb: Add parsing for flex-wrap property
This commit is contained in:
parent
72d5394b8c
commit
e6545d5259
7 changed files with 38 additions and 0 deletions
|
@ -28,6 +28,7 @@ public:
|
||||||
static CSS::Repeat background_repeat() { return CSS::Repeat::Repeat; }
|
static CSS::Repeat background_repeat() { return CSS::Repeat::Repeat; }
|
||||||
static CSS::ListStyleType list_style_type() { return CSS::ListStyleType::Disc; }
|
static CSS::ListStyleType list_style_type() { return CSS::ListStyleType::Disc; }
|
||||||
static CSS::FlexDirection flex_direction() { return CSS::FlexDirection::Row; }
|
static CSS::FlexDirection flex_direction() { return CSS::FlexDirection::Row; }
|
||||||
|
static CSS::FlexWrap flex_wrap() { return CSS::FlexWrap::Nowrap; }
|
||||||
static CSS::Overflow overflow() { return CSS::Overflow::Visible; }
|
static CSS::Overflow overflow() { return CSS::Overflow::Visible; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -51,6 +52,7 @@ public:
|
||||||
CSS::Position position() const { return m_noninherited.position; }
|
CSS::Position position() const { return m_noninherited.position; }
|
||||||
CSS::WhiteSpace white_space() const { return m_inherited.white_space; }
|
CSS::WhiteSpace white_space() const { return m_inherited.white_space; }
|
||||||
CSS::FlexDirection flex_direction() const { return m_noninherited.flex_direction; }
|
CSS::FlexDirection flex_direction() const { return m_noninherited.flex_direction; }
|
||||||
|
CSS::FlexWrap flex_wrap() const { return m_noninherited.flex_wrap; }
|
||||||
const CSS::Length& width() const { return m_noninherited.width; }
|
const CSS::Length& width() const { return m_noninherited.width; }
|
||||||
const CSS::Length& min_width() const { return m_noninherited.min_width; }
|
const CSS::Length& min_width() const { return m_noninherited.min_width; }
|
||||||
const CSS::Length& max_width() const { return m_noninherited.max_width; }
|
const CSS::Length& max_width() const { return m_noninherited.max_width; }
|
||||||
|
@ -127,6 +129,7 @@ protected:
|
||||||
CSS::Repeat background_repeat_x { InitialValues::background_repeat() };
|
CSS::Repeat background_repeat_x { InitialValues::background_repeat() };
|
||||||
CSS::Repeat background_repeat_y { InitialValues::background_repeat() };
|
CSS::Repeat background_repeat_y { InitialValues::background_repeat() };
|
||||||
CSS::FlexDirection flex_direction { InitialValues::flex_direction() };
|
CSS::FlexDirection flex_direction { InitialValues::flex_direction() };
|
||||||
|
CSS::FlexWrap flex_wrap { InitialValues::flex_wrap() };
|
||||||
CSS::Overflow overflow_x { InitialValues::overflow() };
|
CSS::Overflow overflow_x { InitialValues::overflow() };
|
||||||
CSS::Overflow overflow_y { InitialValues::overflow() };
|
CSS::Overflow overflow_y { InitialValues::overflow() };
|
||||||
} m_noninherited;
|
} m_noninherited;
|
||||||
|
@ -172,6 +175,7 @@ public:
|
||||||
BorderData& border_right() { return m_noninherited.border_right; }
|
BorderData& border_right() { return m_noninherited.border_right; }
|
||||||
BorderData& border_bottom() { return m_noninherited.border_bottom; }
|
BorderData& border_bottom() { return m_noninherited.border_bottom; }
|
||||||
void set_flex_direction(CSS::FlexDirection value) { m_noninherited.flex_direction = value; }
|
void set_flex_direction(CSS::FlexDirection value) { m_noninherited.flex_direction = value; }
|
||||||
|
void set_flex_wrap(CSS::FlexWrap value) { m_noninherited.flex_wrap = value; }
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,6 +165,8 @@
|
||||||
"visible",
|
"visible",
|
||||||
"vertical-text",
|
"vertical-text",
|
||||||
"wait",
|
"wait",
|
||||||
|
"wrap",
|
||||||
|
"wrap-reverse",
|
||||||
"w-resize",
|
"w-resize",
|
||||||
"x-large",
|
"x-large",
|
||||||
"x-small",
|
"x-small",
|
||||||
|
|
|
@ -207,6 +207,10 @@
|
||||||
"inherited": false,
|
"inherited": false,
|
||||||
"initial": "row"
|
"initial": "row"
|
||||||
},
|
},
|
||||||
|
"flex-wrap": {
|
||||||
|
"inherited": false,
|
||||||
|
"initial": "nowrap"
|
||||||
|
},
|
||||||
"float": {
|
"float": {
|
||||||
"inherited": false,
|
"inherited": false,
|
||||||
"initial": "none"
|
"initial": "none"
|
||||||
|
|
|
@ -240,6 +240,23 @@ Optional<CSS::FlexDirection> StyleProperties::flex_direction() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Optional<CSS::FlexWrap> StyleProperties::flex_wrap() const
|
||||||
|
{
|
||||||
|
auto value = property(CSS::PropertyID::FlexWrap);
|
||||||
|
if (!value.has_value())
|
||||||
|
return {};
|
||||||
|
switch (value.value()->to_identifier()) {
|
||||||
|
case CSS::ValueID::Wrap:
|
||||||
|
return CSS::FlexWrap::Wrap;
|
||||||
|
case CSS::ValueID::Nowrap:
|
||||||
|
return CSS::FlexWrap::Nowrap;
|
||||||
|
case CSS::ValueID::WrapReverse:
|
||||||
|
return CSS::FlexWrap::WrapReverse;
|
||||||
|
default:
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Optional<CSS::Position> StyleProperties::position() const
|
Optional<CSS::Position> StyleProperties::position() const
|
||||||
{
|
{
|
||||||
auto value = property(CSS::PropertyID::Position);
|
auto value = property(CSS::PropertyID::Position);
|
||||||
|
|
|
@ -51,6 +51,7 @@ public:
|
||||||
Optional<CSS::TextTransform> text_transform() const;
|
Optional<CSS::TextTransform> text_transform() const;
|
||||||
Optional<CSS::ListStyleType> list_style_type() const;
|
Optional<CSS::ListStyleType> list_style_type() const;
|
||||||
Optional<CSS::FlexDirection> flex_direction() const;
|
Optional<CSS::FlexDirection> flex_direction() const;
|
||||||
|
Optional<CSS::FlexWrap> flex_wrap() const;
|
||||||
Optional<CSS::Overflow> overflow_x() const;
|
Optional<CSS::Overflow> overflow_x() const;
|
||||||
Optional<CSS::Overflow> overflow_y() const;
|
Optional<CSS::Overflow> overflow_y() const;
|
||||||
Optional<CSS::Repeat> background_repeat_x() const;
|
Optional<CSS::Repeat> background_repeat_x() const;
|
||||||
|
|
|
@ -80,6 +80,12 @@ enum class FlexDirection {
|
||||||
ColumnReverse,
|
ColumnReverse,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class FlexWrap {
|
||||||
|
Nowrap,
|
||||||
|
Wrap,
|
||||||
|
WrapReverse
|
||||||
|
};
|
||||||
|
|
||||||
enum class WhiteSpace {
|
enum class WhiteSpace {
|
||||||
Normal,
|
Normal,
|
||||||
Pre,
|
Pre,
|
||||||
|
|
|
@ -259,6 +259,10 @@ void NodeWithStyle::apply_style(const CSS::StyleProperties& specified_style)
|
||||||
if (flex_direction.has_value())
|
if (flex_direction.has_value())
|
||||||
computed_values.set_flex_direction(flex_direction.value());
|
computed_values.set_flex_direction(flex_direction.value());
|
||||||
|
|
||||||
|
auto flex_wrap = specified_style.flex_wrap();
|
||||||
|
if (flex_wrap.has_value())
|
||||||
|
computed_values.set_flex_wrap(flex_wrap.value());
|
||||||
|
|
||||||
auto position = specified_style.position();
|
auto position = specified_style.position();
|
||||||
if (position.has_value())
|
if (position.has_value())
|
||||||
computed_values.set_position(position.value());
|
computed_values.set_position(position.value());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue