From e3b557fa6446849434ea9e77aed29d6eaa07f311 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Wed, 19 Apr 2023 11:20:50 +0100 Subject: LibWeb: Stop creating `auto` LengthStyleValue for resolved style --- Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp') diff --git a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp index 93bce087e3..394420fd09 100644 --- a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp @@ -166,6 +166,8 @@ static NonnullRefPtr value_or_default(Optional static NonnullRefPtr style_value_for_length_percentage(LengthPercentage const& length_percentage) { + if (length_percentage.is_auto()) + return IdentifierStyleValue::create(ValueID::Auto); if (length_percentage.is_percentage()) return PercentageStyleValue::create(length_percentage.percentage()); if (length_percentage.is_length()) @@ -595,11 +597,7 @@ RefPtr ResolvedCSSStyleDeclaration::style_value_for_property(L } case CSS::PropertyID::VerticalAlign: if (auto const* length_percentage = layout_node.computed_values().vertical_align().get_pointer()) { - if (length_percentage->is_length()) - return LengthStyleValue::create(length_percentage->length()); - if (length_percentage->is_percentage()) - return PercentageStyleValue::create(length_percentage->percentage()); - VERIFY_NOT_REACHED(); + return style_value_for_length_percentage(*length_percentage); } return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().vertical_align().get())); case CSS::PropertyID::WhiteSpace: -- cgit v1.2.3