mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 02:47:34 +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:
parent
62885b5646
commit
3c6801c3a5
2 changed files with 13 additions and 0 deletions
|
@ -1,4 +1,6 @@
|
||||||
{
|
{
|
||||||
|
"background": {
|
||||||
|
},
|
||||||
"background-attachment": {
|
"background-attachment": {
|
||||||
"inherited": false,
|
"inherited": false,
|
||||||
"initial": "scroll"
|
"initial": "scroll"
|
||||||
|
|
|
@ -256,6 +256,17 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope
|
||||||
return;
|
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 (property_id == CSS::PropertyID::Margin) {
|
||||||
if (value.is_length()) {
|
if (value.is_length()) {
|
||||||
style.set_property(CSS::PropertyID::MarginTop, value);
|
style.set_property(CSS::PropertyID::MarginTop, value);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue