summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2023-04-19 11:20:50 +0100
committerAndreas Kling <kling@serenityos.org>2023-04-19 18:25:18 +0200
commite3b557fa6446849434ea9e77aed29d6eaa07f311 (patch)
treeff7e00dd23b101925abe9e04b41e8bff054382c6 /Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp
parent5647d37d4286e35a507e390edc8311673e5554ba (diff)
downloadserenity-e3b557fa6446849434ea9e77aed29d6eaa07f311.zip
LibWeb: Stop creating `auto` LengthStyleValue for resolved style
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp')
-rw-r--r--Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp8
1 files changed, 3 insertions, 5 deletions
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<StyleValue const> value_or_default(Optional<StyleProperty>
static NonnullRefPtr<StyleValue const> 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<StyleValue const> ResolvedCSSStyleDeclaration::style_value_for_property(L
}
case CSS::PropertyID::VerticalAlign:
if (auto const* length_percentage = layout_node.computed_values().vertical_align().get_pointer<CSS::LengthPercentage>()) {
- 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<CSS::VerticalAlign>()));
case CSS::PropertyID::WhiteSpace: