1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:37:35 +00:00

LibWeb: Naive support for CSS "background" shorthand

Many sites simply use "background" as an alias for "background-color"
so let's at least support that.
This commit is contained in:
Andreas Kling 2020-05-30 11:58:05 +02:00
parent 62885b5646
commit 3c6801c3a5
2 changed files with 13 additions and 0 deletions

View file

@ -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<StyleValue> 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);