mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:17:36 +00:00
LibWeb: Convert flex-basis to LengthPercentage
The flexbox logic confuses me so regressions are possible, though our test page looks the same as before so it should be fine. Renamed FlexBasis::Length -> LengthPercentage too, for clarity.
This commit is contained in:
parent
784ba2ec42
commit
cb0cce5cdc
5 changed files with 29 additions and 15 deletions
|
@ -194,18 +194,22 @@ Optional<CSS::FlexWrap> StyleProperties::flex_wrap() const
|
|||
|
||||
Optional<CSS::FlexBasisData> StyleProperties::flex_basis() const
|
||||
{
|
||||
auto value = property(CSS::PropertyID::FlexBasis);
|
||||
if (!value.has_value())
|
||||
auto maybe_value = property(CSS::PropertyID::FlexBasis);
|
||||
if (!maybe_value.has_value())
|
||||
return {};
|
||||
auto& value = maybe_value.value();
|
||||
|
||||
if (value.value()->is_identifier() && value.value()->to_identifier() == CSS::ValueID::Content)
|
||||
if (value->is_identifier() && value->to_identifier() == CSS::ValueID::Content)
|
||||
return { { CSS::FlexBasis::Content, {} } };
|
||||
|
||||
if (value.value()->has_auto())
|
||||
if (value->has_auto())
|
||||
return { { CSS::FlexBasis::Auto, {} } };
|
||||
|
||||
if (value.value()->has_length())
|
||||
return { { CSS::FlexBasis::Length, value.value()->to_length() } };
|
||||
if (value->is_percentage())
|
||||
return { { CSS::FlexBasis::LengthPercentage, value->as_percentage().percentage() } };
|
||||
|
||||
if (value->has_length())
|
||||
return { { CSS::FlexBasis::LengthPercentage, value->to_length() } };
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue