1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 17:17:44 +00:00

LibWeb: Parse the CSS "flex-direction" property

This commit is contained in:
Andreas Kling 2021-01-18 17:41:57 +01:00
parent fd7920fa8f
commit 149f10b0b9
7 changed files with 43 additions and 0 deletions

View file

@ -225,6 +225,25 @@ Optional<int> StyleProperties::z_index() const
return static_cast<int>(value.value()->to_length().raw_value());
}
Optional<CSS::FlexDirection> StyleProperties::flex_direction() const
{
auto value = property(CSS::PropertyID::FlexDirection);
if (!value.has_value())
return {};
switch (value.value()->to_identifier()) {
case CSS::ValueID::Row:
return CSS::FlexDirection::Row;
case CSS::ValueID::RowReverse:
return CSS::FlexDirection::RowReverse;
case CSS::ValueID::Column:
return CSS::FlexDirection::Column;
case CSS::ValueID::ColumnReverse:
return CSS::FlexDirection::ColumnReverse;
default:
return {};
}
}
Optional<CSS::Position> StyleProperties::position() const
{
auto value = property(CSS::PropertyID::Position);