summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-11-27 20:51:15 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-11-27 20:51:15 +0100
commit5327de2df393bfebd51698618fe412efaf3508ee (patch)
tree92c81b413de75ca383e163f981c6197bc8712fc7
parentd19d4da14a15b616bb0fea87d8f51aff5862dc29 (diff)
downloadserenity-5327de2df393bfebd51698618fe412efaf3508ee.zip
LibHTML: Add shorthand expansion for border-{style,width,color}
This is going to be quite boring to do by hand for every single CSS property. We'll probably want to come up with a way to auto-generate some/most of the shorthand expansion code.
-rw-r--r--Libraries/LibHTML/CSS/StyleResolver.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/Libraries/LibHTML/CSS/StyleResolver.cpp b/Libraries/LibHTML/CSS/StyleResolver.cpp
index 81b5ab15a6..da73828fdb 100644
--- a/Libraries/LibHTML/CSS/StyleResolver.cpp
+++ b/Libraries/LibHTML/CSS/StyleResolver.cpp
@@ -118,6 +118,30 @@ static Vector<String> split_on_whitespace(const StringView& string)
static void set_property_expanding_shorthands(StyleProperties& style, CSS::PropertyID property_id, const StyleValue& value)
{
+ if (property_id == CSS::PropertyID::BorderStyle) {
+ style.set_property(CSS::PropertyID::BorderTopStyle, value);
+ style.set_property(CSS::PropertyID::BorderRightStyle, value);
+ style.set_property(CSS::PropertyID::BorderBottomStyle, value);
+ style.set_property(CSS::PropertyID::BorderLeftStyle, value);
+ return;
+ }
+
+ 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);
+ return;
+ }
+
+ if (property_id == CSS::PropertyID::BorderColor) {
+ style.set_property(CSS::PropertyID::BorderTopColor, value);
+ style.set_property(CSS::PropertyID::BorderRightColor, value);
+ style.set_property(CSS::PropertyID::BorderBottomColor, value);
+ style.set_property(CSS::PropertyID::BorderLeftColor, value);
+ return;
+ }
+
if (property_id == CSS::PropertyID::Margin) {
if (value.is_length()) {
style.set_property(CSS::PropertyID::MarginTop, value);