mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:27:35 +00:00
LibWeb: Paint backgrounds with multiple layers :^)
This commit is contained in:
parent
cdeac132dc
commit
e8b7946732
4 changed files with 20 additions and 36 deletions
|
@ -73,8 +73,6 @@ void Box::paint_background(PaintContext& context)
|
|||
Gfx::IntRect background_rect;
|
||||
Color background_color = computed_values().background_color();
|
||||
auto* background_layers = &computed_values().background_layers();
|
||||
const Gfx::Bitmap* background_image = this->background_image() ? this->background_image()->bitmap() : nullptr;
|
||||
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 +83,6 @@ void Box::paint_background(PaintContext& context)
|
|||
if (document().html_element()->should_use_body_background_properties()) {
|
||||
background_layers = document().background_layers();
|
||||
background_color = document().background_color(context.palette());
|
||||
background_image = document().background_image();
|
||||
background_repeat = { document().background_repeat_x(), document().background_repeat_y() };
|
||||
}
|
||||
} else {
|
||||
background_rect = enclosing_int_rect(padded_rect());
|
||||
|
@ -97,13 +93,7 @@ void Box::paint_background(PaintContext& context)
|
|||
if (computed_values().border_top().width || computed_values().border_right().width || computed_values().border_bottom().width || computed_values().border_left().width)
|
||||
background_rect = enclosing_int_rect(bordered_rect());
|
||||
|
||||
auto background_data = Painting::BackgroundData {
|
||||
.color = background_color,
|
||||
.image = background_image,
|
||||
.repeat_x = background_repeat.repeat_x,
|
||||
.repeat_y = background_repeat.repeat_y
|
||||
};
|
||||
Painting::paint_background(context, background_rect, background_data, normalized_border_radius_data());
|
||||
Painting::paint_background(context, background_rect, background_color, background_layers, normalized_border_radius_data());
|
||||
}
|
||||
|
||||
void Box::paint_box_shadow(PaintContext& context)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue