From 8d65df935e86653f06b21b847a0f138b3fa49d47 Mon Sep 17 00:00:00 2001 From: Itamar Date: Mon, 14 Nov 2022 21:18:52 +0200 Subject: [PATCH] LibWeb: Handle inset properties in style_value_for_property() This adds support for the Top, Right, Bottom and Left CSS properties in style_value_for_property(). --- .../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 909e544fe9..8445a6d9fc 100644 --- a/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp +++ b/Userland/Libraries/LibWeb/CSS/ResolvedCSSStyleDeclaration.cpp @@ -293,6 +293,8 @@ RefPtr ResolvedCSSStyleDeclaration::style_value_for_property(Layout: } case CSS::PropertyID::BoxSizing: return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().box_sizing())); + case CSS::PropertyID::Bottom: + return style_value_for_length_percentage(layout_node.computed_values().inset().bottom()); case CSS::PropertyID::Clear: return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().clear())); case CSS::PropertyID::Clip: @@ -373,6 +375,8 @@ RefPtr ResolvedCSSStyleDeclaration::style_value_for_property(Layout: return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().image_rendering())); case CSS::PropertyID::JustifyContent: return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().justify_content())); + case CSS::PropertyID::Left: + return style_value_for_length_percentage(layout_node.computed_values().inset().left()); case CSS::PropertyID::ListStyleType: return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().list_style_type())); case CSS::PropertyID::Margin: { @@ -427,6 +431,8 @@ RefPtr ResolvedCSSStyleDeclaration::style_value_for_property(Layout: return style_value_for_length_percentage(layout_node.computed_values().padding().top()); case CSS::PropertyID::Position: return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().position())); + case CSS::PropertyID::Right: + return style_value_for_length_percentage(layout_node.computed_values().inset().right()); case CSS::PropertyID::RowGap: return style_value_for_size(layout_node.computed_values().row_gap()); case CSS::PropertyID::TextAlign: @@ -445,6 +451,8 @@ RefPtr ResolvedCSSStyleDeclaration::style_value_for_property(Layout: return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().text_decoration_style())); case CSS::PropertyID::TextTransform: return IdentifierStyleValue::create(to_value_id(layout_node.computed_values().text_transform())); + case CSS::PropertyID::Top: + return style_value_for_length_percentage(layout_node.computed_values().inset().top()); case CSS::PropertyID::Transform: { // NOTE: The computed value for `transform` serializes as a single `matrix(...)` value, instead of // the original list of transform functions. So, we produce a StyleValue for that.