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

LibWeb: Add parsing for the justify-content property

This commit is contained in:
Tobias Christiansen 2021-07-16 18:38:26 +02:00 committed by Ali Mohammad Pur
parent fb66feef5e
commit 80a44c3891
7 changed files with 45 additions and 0 deletions

View file

@ -298,6 +298,26 @@ Optional<float> StyleProperties::flex_shrink_factor() const
auto numeric = verify_cast<CSS::NumericStyleValue>(value.value().ptr());
return numeric->value();
}
Optional<CSS::JustifyContent> StyleProperties::justify_content() const
{
auto value = property(CSS::PropertyID::JustifyContent);
if (!value.has_value())
return {};
switch (value.value()->to_identifier()) {
case CSS::ValueID::FlexStart:
return CSS::JustifyContent::FlexStart;
case CSS::ValueID::FlexEnd:
return CSS::JustifyContent::FlexEnd;
case CSS::ValueID::Center:
return CSS::JustifyContent::Center;
case CSS::ValueID::SpaceBetween:
return CSS::JustifyContent::SpaceBetween;
case CSS::ValueID::SpaceAround:
return CSS::JustifyContent::SpaceAround;
default:
return {};
}
}
Optional<CSS::Position> StyleProperties::position() const
{