diff options
author | Andreas Kling <kling@serenityos.org> | 2020-06-10 16:42:58 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-06-10 16:42:58 +0200 |
commit | 2622ead6c648d0af210cfc750c95ed58fb65b072 (patch) | |
tree | 7eb05fd3f43f4a157077a4175f1358dc08e4b043 /Libraries/LibWeb | |
parent | 7fe2f5f1706c911e0eb1576e60bd4eafe8010e49 (diff) | |
download | serenity-2622ead6c648d0af210cfc750c95ed58fb65b072.zip |
LibWeb: Expand 2-part border-width shorthand CSS properties
Diffstat (limited to 'Libraries/LibWeb')
-rw-r--r-- | Libraries/LibWeb/CSS/StyleResolver.cpp | 18 |
1 files changed, 14 insertions, 4 deletions
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; } |