diff --git a/Libraries/LibWeb/CSS/Properties.json b/Libraries/LibWeb/CSS/Properties.json index a92a09fdd4..7baa918ffd 100644 --- a/Libraries/LibWeb/CSS/Properties.json +++ b/Libraries/LibWeb/CSS/Properties.json @@ -1,4 +1,6 @@ { + "background": { + }, "background-attachment": { "inherited": false, "initial": "scroll" diff --git a/Libraries/LibWeb/CSS/StyleResolver.cpp b/Libraries/LibWeb/CSS/StyleResolver.cpp index c97eb083ee..32cd0ef49d 100644 --- a/Libraries/LibWeb/CSS/StyleResolver.cpp +++ b/Libraries/LibWeb/CSS/StyleResolver.cpp @@ -256,6 +256,17 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope return; } + if (property_id == CSS::PropertyID::Background) { + auto parts = split_on_whitespace(value.to_string()); + NonnullRefPtrVector values; + for (auto& part : parts) { + values.append(parse_css_value(part)); + } + if (values[0].is_color()) + style.set_property(CSS::PropertyID::BackgroundColor, values[0]); + return; + } + if (property_id == CSS::PropertyID::Margin) { if (value.is_length()) { style.set_property(CSS::PropertyID::MarginTop, value);