LibWeb: Expand 2-part border-width shorthand CSS properties

This commit is contained in:
Andreas Kling 2020-06-10 16:42:58 +02:00
parent 7fe2f5f170
commit 2622ead6c6
Notes: sideshowbarker 2024-07-19 05:43:34 +09:00

View file

@ -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;
}