1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 05:25:09 +00:00

LibWeb: Parse background-attachment as part of background property

This commit is contained in:
Sam Atkins 2021-11-03 17:46:45 +00:00 committed by Andreas Kling
parent 116a5fe5d0
commit 018a4aa85c
4 changed files with 39 additions and 8 deletions

View file

@ -304,6 +304,7 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope
set_property_expanding_shorthands(style, CSS::PropertyID::BackgroundPosition, background.position(), document);
set_property_expanding_shorthands(style, CSS::PropertyID::BackgroundRepeatX, background.repeat_x(), document, true);
set_property_expanding_shorthands(style, CSS::PropertyID::BackgroundRepeatY, background.repeat_y(), document, true);
set_property_expanding_shorthands(style, CSS::PropertyID::BackgroundAttachment, background.attachment(), document);
};
if (value.is_background()) {
@ -327,6 +328,22 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope
set_property_expanding_shorthands(style, CSS::PropertyID::BackgroundPosition, value, document);
set_property_expanding_shorthands(style, CSS::PropertyID::BackgroundRepeatX, value, document, true);
set_property_expanding_shorthands(style, CSS::PropertyID::BackgroundRepeatY, value, document, true);
set_property_expanding_shorthands(style, CSS::PropertyID::BackgroundAttachment, value, document);
return;
}
if (property_id == CSS::PropertyID::BackgroundAttachment) {
if (value.is_value_list()) {
auto& background_attachment_list = value.as_value_list().values();
// FIXME: Handle multiple backgrounds.
if (!background_attachment_list.is_empty()) {
auto& background_attachment = background_attachment_list.first();
style.set_property(CSS::PropertyID::BackgroundAttachment, background_attachment);
}
return;
}
style.set_property(CSS::PropertyID::BackgroundAttachment, value);
return;
}