mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 03:55:24 +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
Notes:
sideshowbarker
2024-07-19 05:57:36 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3c6801c3a57
2 changed files with 13 additions and 0 deletions
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
"background": {
|
||||
},
|
||||
"background-attachment": {
|
||||
"inherited": false,
|
||||
"initial": "scroll"
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue