From 2622ead6c648d0af210cfc750c95ed58fb65b072 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 10 Jun 2020 16:42:58 +0200 Subject: LibWeb: Expand 2-part border-width shorthand CSS properties --- Libraries/LibWeb/CSS/StyleResolver.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'Libraries/LibWeb') diff --git a/Libraries/LibWeb/CSS/StyleResolver.cpp b/Libraries/LibWeb/CSS/StyleResolver.cpp index 5baf531a82..dadfd3a48a 100644 --- a/Libraries/LibWeb/CSS/StyleResolver.cpp +++ b/Libraries/LibWeb/CSS/StyleResolver.cpp @@ -296,10 +296,20 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope } if (property_id == CSS::PropertyID::BorderWidth) { - style.set_property(CSS::PropertyID::BorderTopWidth, value); - style.set_property(CSS::PropertyID::BorderRightWidth, value); - style.set_property(CSS::PropertyID::BorderBottomWidth, value); - style.set_property(CSS::PropertyID::BorderLeftWidth, value); + auto parts = split_on_whitespace(value.to_string()); + if (parts.size() == 2) { + auto vertical_border_width = parse_css_value(parts[0]); + auto horizonal_border_width = parse_css_value(parts[1]); + style.set_property(CSS::PropertyID::BorderTopWidth, vertical_border_width); + style.set_property(CSS::PropertyID::BorderRightWidth, horizonal_border_width); + style.set_property(CSS::PropertyID::BorderBottomWidth, vertical_border_width); + style.set_property(CSS::PropertyID::BorderLeftWidth, horizonal_border_width); + } else { + style.set_property(CSS::PropertyID::BorderTopWidth, value); + style.set_property(CSS::PropertyID::BorderRightWidth, value); + style.set_property(CSS::PropertyID::BorderBottomWidth, value); + style.set_property(CSS::PropertyID::BorderLeftWidth, value); + } return; } -- cgit v1.2.3