1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:57:45 +00:00

LibWeb: Convert background painting to new pixel units

This commit is contained in:
Sam Atkins 2022-10-27 14:48:52 +01:00 committed by Linus Groh
parent 4440af0870
commit 0233627545
4 changed files with 55 additions and 55 deletions

View file

@ -243,13 +243,13 @@ void PaintableBox::paint_background(PaintContext& context) const
if (layout_box().is_body() && document().html_element()->should_use_body_background_properties())
return;
Gfx::FloatRect background_rect;
CSSPixelRect background_rect;
Color background_color = computed_values().background_color();
auto* background_layers = &computed_values().background_layers();
if (layout_box().is_root_element()) {
// CSS 2.1 Appendix E.2: If the element is a root element, paint the background over the entire canvas.
background_rect = context.device_viewport_rect().to_type<int>().to_type<float>();
background_rect = context.css_viewport_rect();
// Section 2.11.2: If the computed value of background-image on the root element is none and its background-color is transparent,
// user agents must instead propagate the computed values of the background properties from that elements first HTML BODY child element.
@ -258,13 +258,13 @@ void PaintableBox::paint_background(PaintContext& context) const
background_color = document().background_color(context.palette());
}
} else {
background_rect = absolute_padding_box_rect();
background_rect = absolute_padding_box_rect().to_type<CSSPixels>();
}
// HACK: If the Box has a border, use the bordered_rect to paint the background.
// This way if we have a border-radius there will be no gap between the filling and actual border.
if (computed_values().border_top().width || computed_values().border_right().width || computed_values().border_bottom().width || computed_values().border_left().width)
background_rect = absolute_border_box_rect();
background_rect = absolute_border_box_rect().to_type<CSSPixels>();
Painting::paint_background(context, layout_box(), background_rect, background_color, computed_values().image_rendering(), background_layers, normalized_border_radii_data());
}