LibWeb: Use containing block to compute scrollable overflow

Instead of using child boxes to compute scrollable overflow for the box,
we use descendants which have the box as their containing block.
This commit is contained in:
Edward Banner 2024-10-15 10:35:11 -04:00 committed by Alexander Kalenik
commit 912511a152
Notes: github-actions[bot] 2024-10-18 13:27:39 +00:00
49 changed files with 92 additions and 89 deletions

View file

@ -100,15 +100,18 @@ static CSSPixelRect measure_scrollable_overflow(Box const& box)
// and whose border boxes are positioned not wholly in the negative scrollable overflow region,
// FIXME: accounting for transforms by projecting each box onto the plane of the element that establishes its 3D rendering context. [CSS3-TRANSFORMS]
if (!box.children_are_inline()) {
box.for_each_child_of_type<Box>([&box, &scrollable_overflow_rect, &content_overflow_rect](Box const& child) {
box.for_each_in_subtree_of_type<Box>([&box, &scrollable_overflow_rect, &content_overflow_rect](Box const& child) {
if (!child.paintable_box())
return IterationDecision::Continue;
return TraversalDecision::Continue;
if (child.containing_block() != &box)
return TraversalDecision::Continue;
auto child_border_box = child.paintable_box()->absolute_border_box_rect();
// NOTE: Here we check that the child is not wholly in the negative scrollable overflow region.
if (child_border_box.bottom() < 0 || child_border_box.right() < 0)
return IterationDecision::Continue;
return TraversalDecision::Continue;
scrollable_overflow_rect = scrollable_overflow_rect.united(child_border_box);
content_overflow_rect = content_overflow_rect.united(child_border_box);
@ -125,7 +128,7 @@ static CSSPixelRect measure_scrollable_overflow(Box const& box)
scrollable_overflow_rect.unite_vertically(child_scrollable_overflow);
}
return IterationDecision::Continue;
return TraversalDecision::Continue;
});
}