1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:08:10 +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:
Sam Atkins 2021-11-04 16:51:34 +00:00 committed by Andreas Kling
parent 5d0acb63ae
commit 1e53768f1b
10 changed files with 52 additions and 105 deletions

View file

@ -660,15 +660,10 @@ RefPtr<StyleValue> ResolvedCSSStyleDeclaration::style_value_for_property(Layout:
return ColorStyleValue::create(layout_node.computed_values().color());
case PropertyID::BackgroundColor:
return ColorStyleValue::create(layout_node.computed_values().background_color());
case CSS::PropertyID::BackgroundRepeatX:
return IdentifierStyleValue::create(to_css_value_id(layout_node.computed_values().background_repeat_x()));
case CSS::PropertyID::BackgroundRepeatY:
return IdentifierStyleValue::create(to_css_value_id(layout_node.computed_values().background_repeat_y()));
case CSS::PropertyID::BackgroundRepeat: {
auto maybe_background_repeat_x = property(CSS::PropertyID::BackgroundRepeatX);
auto maybe_background_repeat_y = property(CSS::PropertyID::BackgroundRepeatY);
return BackgroundRepeatStyleValue::create(value_or_default(maybe_background_repeat_x, IdentifierStyleValue::create(CSS::ValueID::RepeatX)), value_or_default(maybe_background_repeat_y, IdentifierStyleValue::create(CSS::ValueID::RepeatY)));
}
case CSS::PropertyID::BackgroundRepeat:
return BackgroundRepeatStyleValue::create(
IdentifierStyleValue::create(to_css_value_id(layout_node.computed_values().background_repeat().repeat_x)),
IdentifierStyleValue::create(to_css_value_id(layout_node.computed_values().background_repeat().repeat_y)));
case CSS::PropertyID::Background: {
auto maybe_background_color = property(CSS::PropertyID::BackgroundColor);
auto maybe_background_image = property(CSS::PropertyID::BackgroundImage);