mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02:00
LibWeb: Use Optional instead of undefined-lengths for widths/heights
This commit is contained in:
committed by
Andreas Kling
parent
699b48ccc8
commit
5b2482a939
Notes:
sideshowbarker
2024-07-17 18:34:38 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/5b2482a939 Pull-request: https://github.com/SerenityOS/serenity/pull/12628
@@ -536,25 +536,25 @@ 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());
|
||||
return style_value_for_length_percentage(layout_node.computed_values().width().value_or(Length::make_auto()));
|
||||
case CSS::PropertyID::MinWidth:
|
||||
if (layout_node.computed_values().min_width().is_length() && layout_node.computed_values().min_width().length().is_undefined_or_auto())
|
||||
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());
|
||||
return style_value_for_length_percentage(layout_node.computed_values().min_width().value());
|
||||
case CSS::PropertyID::MaxWidth:
|
||||
if (layout_node.computed_values().max_width().is_length() && layout_node.computed_values().max_width().length().is_undefined())
|
||||
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());
|
||||
return style_value_for_length_percentage(layout_node.computed_values().max_width().value());
|
||||
case CSS::PropertyID::Height:
|
||||
return style_value_for_length_percentage(layout_node.computed_values().height());
|
||||
return style_value_for_length_percentage(layout_node.computed_values().height().value_or(Length::make_auto()));
|
||||
case CSS::PropertyID::MinHeight:
|
||||
if (layout_node.computed_values().min_height().is_length() && layout_node.computed_values().min_height().length().is_undefined_or_auto())
|
||||
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());
|
||||
return style_value_for_length_percentage(layout_node.computed_values().min_height().value());
|
||||
case CSS::PropertyID::MaxHeight:
|
||||
if (layout_node.computed_values().max_height().is_length() && layout_node.computed_values().max_height().length().is_undefined())
|
||||
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());
|
||||
return style_value_for_length_percentage(layout_node.computed_values().max_height().value());
|
||||
case CSS::PropertyID::Margin: {
|
||||
auto margin = layout_node.computed_values().margin();
|
||||
auto values = NonnullRefPtrVector<StyleValue> {};
|
||||
|
||||
Reference in New Issue
Block a user