mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:57:35 +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
|
@ -73,8 +73,7 @@ void Box::paint_background(PaintContext& context)
|
|||
Gfx::IntRect background_rect;
|
||||
Color background_color = computed_values().background_color();
|
||||
const Gfx::Bitmap* background_image = this->background_image() ? this->background_image()->bitmap() : nullptr;
|
||||
CSS::Repeat background_repeat_x = computed_values().background_repeat_x();
|
||||
CSS::Repeat background_repeat_y = computed_values().background_repeat_y();
|
||||
CSS::BackgroundRepeatData background_repeat = computed_values().background_repeat();
|
||||
|
||||
if (is_root_element()) {
|
||||
// CSS 2.1 Appendix E.2: If the element is a root element, paint the background over the entire canvas.
|
||||
|
@ -85,8 +84,7 @@ void Box::paint_background(PaintContext& context)
|
|||
if (document().html_element()->should_use_body_background_properties()) {
|
||||
background_color = document().background_color(context.palette());
|
||||
background_image = document().background_image();
|
||||
background_repeat_x = document().background_repeat_x();
|
||||
background_repeat_y = document().background_repeat_y();
|
||||
background_repeat = { document().background_repeat_x(), document().background_repeat_y() };
|
||||
}
|
||||
} else {
|
||||
background_rect = enclosing_int_rect(padded_rect());
|
||||
|
@ -100,8 +98,8 @@ void Box::paint_background(PaintContext& context)
|
|||
auto background_data = Painting::BackgroundData {
|
||||
.color = background_color,
|
||||
.image = background_image,
|
||||
.repeat_x = background_repeat_x,
|
||||
.repeat_y = background_repeat_y
|
||||
.repeat_x = background_repeat.repeat_x,
|
||||
.repeat_y = background_repeat.repeat_y
|
||||
};
|
||||
Painting::paint_background(context, background_rect, background_data, normalized_border_radius_data());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue