mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Parse background-attachment
as part of background
property
This commit is contained in:
parent
116a5fe5d0
commit
018a4aa85c
Notes:
sideshowbarker
2024-07-18 01:20:57 +09:00
Author: https://github.com/AtkinsSJ
Commit: 018a4aa85c
Pull-request: https://github.com/SerenityOS/serenity/pull/10844
Reviewed-by: https://github.com/awesomekling
4 changed files with 39 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue