mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:18:12 +00:00
LibWeb: Make sure CSS::ComputedValues has initial size values
Instead of using Optional<LengthPercentage>, we now use LengthPercentage for these values. The initial values are all `auto`. This avoids having to check `has_value()` in a ton of places.
This commit is contained in:
parent
734ff422ad
commit
cefc931347
9 changed files with 81 additions and 86 deletions
|
@ -205,25 +205,17 @@ RefPtr<StyleValue> ResolvedCSSStyleDeclaration::style_value_for_property(Layout:
|
|||
return StyleValueList::create(move(box_shadow), StyleValueList::Separator::Comma);
|
||||
}
|
||||
case CSS::PropertyID::Width:
|
||||
return style_value_for_length_percentage(layout_node.computed_values().width().value_or(Length::make_auto()));
|
||||
return style_value_for_length_percentage(layout_node.computed_values().width());
|
||||
case CSS::PropertyID::MinWidth:
|
||||
if (!layout_node.computed_values().min_width().has_value())
|
||||
return IdentifierStyleValue::create(CSS::ValueID::Auto);
|
||||
return style_value_for_length_percentage(layout_node.computed_values().min_width().value());
|
||||
return style_value_for_length_percentage(layout_node.computed_values().min_width());
|
||||
case CSS::PropertyID::MaxWidth:
|
||||
if (!layout_node.computed_values().max_width().has_value())
|
||||
return IdentifierStyleValue::create(CSS::ValueID::None);
|
||||
return style_value_for_length_percentage(layout_node.computed_values().max_width().value());
|
||||
return style_value_for_length_percentage(layout_node.computed_values().max_width());
|
||||
case CSS::PropertyID::Height:
|
||||
return style_value_for_length_percentage(layout_node.computed_values().height().value_or(Length::make_auto()));
|
||||
return style_value_for_length_percentage(layout_node.computed_values().height());
|
||||
case CSS::PropertyID::MinHeight:
|
||||
if (!layout_node.computed_values().min_height().has_value())
|
||||
return IdentifierStyleValue::create(CSS::ValueID::Auto);
|
||||
return style_value_for_length_percentage(layout_node.computed_values().min_height().value());
|
||||
return style_value_for_length_percentage(layout_node.computed_values().min_height());
|
||||
case CSS::PropertyID::MaxHeight:
|
||||
if (!layout_node.computed_values().max_height().has_value())
|
||||
return IdentifierStyleValue::create(CSS::ValueID::None);
|
||||
return style_value_for_length_percentage(layout_node.computed_values().max_height().value());
|
||||
return style_value_for_length_percentage(layout_node.computed_values().max_height());
|
||||
case CSS::PropertyID::Margin: {
|
||||
auto margin = layout_node.computed_values().margin();
|
||||
auto values = NonnullRefPtrVector<StyleValue> {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue