Skip to content

Commit

Permalink
Layout: Use containing block to compute scrollable overflow
Browse files Browse the repository at this point in the history
Instead of using the border boxes of all descendants to compute
scrollable overflow, we use only descendants which have the box as its
containing block.
  • Loading branch information
ebanner committed Sep 3, 2024
1 parent 7d0e33c commit 44d434b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Userland/Libraries/LibWeb/Layout/LayoutState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,13 @@ 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.
Expand All @@ -123,7 +127,7 @@ static CSSPixelRect measure_scrollable_overflow(Box const& box)
scrollable_overflow_rect.unite_vertically(child_scrollable_overflow);
}

return IterationDecision::Continue;
return TraversalDecision::Continue;
});
} else {
box.for_each_child([&scrollable_overflow_rect, &content_overflow_rect](Node const& child) {
Expand Down

0 comments on commit 44d434b

Please sign in to comment.