From b7f00148ad2d47274204fbac39cc00dee0af1729 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Mon, 17 May 2021 16:05:35 -0400 Subject: [PATCH] LibWeb: Resolve 2-part and 3-part border-color values --- .../Libraries/LibWeb/CSS/StyleResolver.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp b/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp index e3865aff17b..4f215da0228 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleResolver.cpp @@ -441,6 +441,25 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope style.set_property(CSS::PropertyID::BorderBottomColor, *bottom); style.set_property(CSS::PropertyID::BorderLeftColor, *left); } + } else if (value.is_string() && parts.size() == 3) { + auto top = parse_css_value(context, parts[0]); + auto horizontal = parse_css_value(context, parts[1]); + auto bottom = parse_css_value(context, parts[2]); + if (top && horizontal && bottom) { + style.set_property(CSS::PropertyID::BorderTopColor, *top); + style.set_property(CSS::PropertyID::BorderRightColor, *horizontal); + style.set_property(CSS::PropertyID::BorderBottomColor, *bottom); + style.set_property(CSS::PropertyID::BorderLeftColor, *horizontal); + } + } else if (value.is_string() && parts.size() == 2) { + auto vertical = parse_css_value(context, parts[0]); + auto horizontal = parse_css_value(context, parts[1]); + if (vertical && horizontal) { + style.set_property(CSS::PropertyID::BorderTopColor, *vertical); + style.set_property(CSS::PropertyID::BorderRightColor, *horizontal); + style.set_property(CSS::PropertyID::BorderBottomColor, *vertical); + style.set_property(CSS::PropertyID::BorderLeftColor, *horizontal); + } } else { style.set_property(CSS::PropertyID::BorderTopColor, value); style.set_property(CSS::PropertyID::BorderRightColor, value);