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

LibWeb: Parse flex-basis

Flex-basis accepts either 'content' or a Length.
This commit is contained in:
Tobias Christiansen 2021-05-30 14:23:43 +02:00 committed by Ali Mohammad Pur
parent 27704f5f9e
commit ae3e6510d6
7 changed files with 39 additions and 0 deletions

View file

@ -257,6 +257,21 @@ Optional<CSS::FlexWrap> StyleProperties::flex_wrap() const
}
}
Optional<CSS::FlexBasisData> StyleProperties::flex_basis() const
{
auto value = property(CSS::PropertyID::FlexBasis);
if (!value.has_value())
return {};
if (value.value()->is_identifier() && value.value()->to_identifier() == CSS::ValueID::Content)
return { { CSS::FlexBasis::Content, {} } };
if (value.value()->is_length())
return { { CSS::FlexBasis::Length, value.value()->to_length() } };
return {};
}
Optional<CSS::Position> StyleProperties::position() const
{
auto value = property(CSS::PropertyID::Position);