1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:17:35 +00:00

LibWeb: Make painting order more spec-compliant

Now our painting order inside stacking contexts is closer to the
algorithm specified by CSS 2.1 (see section 9.9 and Appendix E)
This commit is contained in:
Egor Ananyin 2021-05-07 19:03:25 +03:00 committed by Andreas Kling
parent 33af7075e7
commit d2b6148787
8 changed files with 89 additions and 43 deletions

View file

@ -42,8 +42,6 @@ void Box::paint(PaintContext& context, PaintPhase phase)
Painting::paint_border(context, Painting::BorderEdge::Bottom, bordered_rect, computed_values());
}
Layout::NodeWithStyleAndBoxModelMetrics::paint(context, phase);
if (phase == PaintPhase::Overlay && dom_node() && document().inspected_node() == dom_node()) {
auto content_rect = absolute_rect();
@ -179,23 +177,6 @@ StackingContext* Box::enclosing_stacking_context()
VERIFY_NOT_REACHED();
}
bool Box::establishes_stacking_context() const
{
if (!has_style())
return false;
if (dom_node() == document().root())
return true;
auto position = computed_values().position();
auto z_index = computed_values().z_index();
if (position == CSS::Position::Absolute || position == CSS::Position::Relative) {
if (z_index.has_value())
return true;
}
if (position == CSS::Position::Fixed || position == CSS::Position::Sticky)
return true;
return false;
}
LineBox& Box::ensure_last_line_box()
{
if (m_line_boxes.is_empty())