From a31855ae10d398719f39ef755a9834eda59735cc Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 4 Oct 2021 18:55:36 +0200 Subject: [PATCH] LibWeb: Improve resolved style for CSS {min,max}-{width,height} If the specified value for these properties is "none", we end up storing it as an "undefined" CSS::Length in the computed values. We need to convert it back into "none" for getComputedStyle(). --- .../Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp index 1ad7322c97..89dbc77f35 100644 --- a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp @@ -452,14 +452,22 @@ RefPtr ResolvedCSSStyleDeclaration::style_value_for_property(Layout: case CSS::PropertyID::Width: return LengthStyleValue::create(layout_node.computed_values().width()); case CSS::PropertyID::MinWidth: + if (layout_node.computed_values().min_width().is_undefined()) + return IdentifierStyleValue::create(CSS::ValueID::None); return LengthStyleValue::create(layout_node.computed_values().min_width()); case CSS::PropertyID::MaxWidth: + if (layout_node.computed_values().max_width().is_undefined()) + return IdentifierStyleValue::create(CSS::ValueID::None); return LengthStyleValue::create(layout_node.computed_values().max_width()); case CSS::PropertyID::Height: return LengthStyleValue::create(layout_node.computed_values().height()); case CSS::PropertyID::MinHeight: + if (layout_node.computed_values().min_height().is_undefined()) + return IdentifierStyleValue::create(CSS::ValueID::None); return LengthStyleValue::create(layout_node.computed_values().min_height()); case CSS::PropertyID::MaxHeight: + if (layout_node.computed_values().max_height().is_undefined()) + return IdentifierStyleValue::create(CSS::ValueID::None); return LengthStyleValue::create(layout_node.computed_values().max_height()); case CSS::PropertyID::MarginTop: return LengthStyleValue::create(layout_node.computed_values().margin().top);