LibWeb: Propagate body background properties to root HTML element

The Acid1 test has a bit of an unusual background - the html and body
tags have different background colors. Our painting order of the DOM was
such that the body background was painted first, then all other elements
were painted in-phase according to Appendix E of CSS 2.1. So the html
element's background color was painted over the body background.

This removes the special handling of the body background from
InitialContainingBlockBox and now all boxes are painted in-phase. Doing
this also exposed that we weren't handling Section 2.11.2 of the spec;
when the html background is unset, the body's background should be
propagated to the html element.
This commit is contained in:
Timothy Flynn 2021-05-13 09:39:30 -04:00 committed by Andreas Kling
parent d1ed6bce5d
commit dba261f79b
Notes: sideshowbarker 2024-07-18 18:15:02 +09:00
5 changed files with 41 additions and 19 deletions

View file

@ -17,4 +17,12 @@ HTMLHtmlElement::~HTMLHtmlElement()
{
}
bool HTMLHtmlElement::should_use_body_background_properties() const
{
auto background_color = layout_node()->computed_values().background_color();
const auto* background_image = layout_node()->background_image();
return (background_color == Color::Transparent) && !background_image;
}
}