1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-15 07:34:59 +00:00

LibWeb: Make computed flex-grow and flex-shrink always available

These values are not allowed to be absent (auto/none/etc) so we don't
need to use Optional<float> for them. This simplifies some things.
This commit is contained in:
Andreas Kling 2021-10-19 15:22:08 +02:00
parent 19eda59359
commit 07f15aa550
6 changed files with 32 additions and 40 deletions

View file

@ -497,18 +497,10 @@ RefPtr<StyleValue> ResolvedCSSStyleDeclaration::style_value_for_property(Layout:
VERIFY_NOT_REACHED();
}
break;
case CSS::PropertyID::FlexGrow: {
auto maybe_grow_factor = layout_node.computed_values().flex_grow_factor();
if (!maybe_grow_factor.has_value())
return {};
return NumericStyleValue::create_float(maybe_grow_factor.release_value());
}
case CSS::PropertyID::FlexShrink: {
auto maybe_shrink_factor = layout_node.computed_values().flex_shrink_factor();
if (!maybe_shrink_factor.has_value())
return {};
return NumericStyleValue::create_float(maybe_shrink_factor.release_value());
}
case CSS::PropertyID::FlexGrow:
return NumericStyleValue::create_float(layout_node.computed_values().flex_grow());
case CSS::PropertyID::FlexShrink:
return NumericStyleValue::create_float(layout_node.computed_values().flex_shrink());
case CSS::PropertyID::Opacity: {
auto maybe_opacity = layout_node.computed_values().opacity();
if (!maybe_opacity.has_value())