mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 00:57:43 +00:00
LibWeb: Combine background-repeat-x/y pseudo-properties
While right now this doesn't save much complexity, it will do once we care about multiple background layers per node. Then, having a single repeat value per layer will simplify things. It also means we can remove the pseudo-property concept entirely! :^)
This commit is contained in:
parent
5d0acb63ae
commit
1e53768f1b
10 changed files with 52 additions and 105 deletions
|
@ -414,33 +414,12 @@ static void set_property_expanding_shorthands(StyleProperties& style, CSS::Prope
|
|||
auto& background_repeat_list = value.as_value_list().values();
|
||||
// FIXME: Handle multiple backgrounds.
|
||||
if (!background_repeat_list.is_empty()) {
|
||||
auto& maybe_background_repeat = background_repeat_list.first();
|
||||
if (maybe_background_repeat.is_background_repeat()) {
|
||||
auto& background_repeat = maybe_background_repeat.as_background_repeat();
|
||||
set_property_expanding_shorthands(style, PropertyID::BackgroundRepeatX, background_repeat.repeat_x(), document, true);
|
||||
set_property_expanding_shorthands(style, PropertyID::BackgroundRepeatY, background_repeat.repeat_y(), document, true);
|
||||
}
|
||||
auto& background_repeat = background_repeat_list.first();
|
||||
style.set_property(CSS::PropertyID::BackgroundRepeat, background_repeat);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (value.is_background_repeat()) {
|
||||
auto& background_repeat = value.as_background_repeat();
|
||||
set_property_expanding_shorthands(style, PropertyID::BackgroundRepeatX, background_repeat.repeat_x(), document, true);
|
||||
set_property_expanding_shorthands(style, PropertyID::BackgroundRepeatY, background_repeat.repeat_y(), document, true);
|
||||
return;
|
||||
}
|
||||
|
||||
set_property_expanding_shorthands(style, PropertyID::BackgroundRepeatX, value, document, true);
|
||||
set_property_expanding_shorthands(style, PropertyID::BackgroundRepeatY, value, document, true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (property_id == CSS::PropertyID::BackgroundRepeatX || property_id == CSS::PropertyID::BackgroundRepeatY) {
|
||||
auto value_id = value.to_identifier();
|
||||
if (value_id == CSS::ValueID::RepeatX || value_id == CSS::ValueID::RepeatY)
|
||||
return;
|
||||
|
||||
style.set_property(property_id, value);
|
||||
style.set_property(CSS::PropertyID::BackgroundRepeat, value);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue