mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 00:29:15 +00:00
LibWeb: Allow descendant boxes to contribute in overflow rect of parent
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
...with inline children. This fixes an issue when we ignore abspos boxes contained by PaintableWithLines while calculating overflow rect size. Lots of layout tests are affected, because now PaintableWithLines has overflow rect. `Text/input/DOM/Element-set-scroll-left.html` is also affected and now matches other browsers.
This commit is contained in:
parent
5baa85cbee
commit
9e232a70c3
Notes:
github-actions[bot]
2025-07-06 15:11:19 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: 9e232a70c3
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5312
54 changed files with 171 additions and 160 deletions
|
@ -77,49 +77,47 @@ static CSSPixelRect measure_scrollable_overflow(Box const& box)
|
|||
// - The border boxes of all boxes for which it is the containing block
|
||||
// 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_in_subtree_of_type<Box>([&box, &scrollable_overflow_rect, &content_overflow_rect](Box const& child) {
|
||||
if (!child.paintable_box())
|
||||
return TraversalDecision::Continue;
|
||||
|
||||
if (child.containing_block() != &box)
|
||||
return TraversalDecision::Continue;
|
||||
|
||||
// https://drafts.csswg.org/css-position/#fixed-positioning-containing-block
|
||||
// [..] As a result, parts of fixed-positioned boxes that extend outside the layout viewport/page area
|
||||
// cannot be scrolled to and will not print.
|
||||
// FIXME: Properly establish the fixed positioning containing block for `position: fixed`
|
||||
if (child.is_fixed_position())
|
||||
return TraversalDecision::Continue;
|
||||
|
||||
auto child_border_box = child.paintable_box()->absolute_border_box_rect();
|
||||
|
||||
// Border boxes with zero area do not affect the scrollable overflow area.
|
||||
if (child_border_box.is_empty())
|
||||
return TraversalDecision::Continue;
|
||||
|
||||
// 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 TraversalDecision::Continue;
|
||||
|
||||
scrollable_overflow_rect.unite(child_border_box);
|
||||
content_overflow_rect.unite(child_border_box);
|
||||
|
||||
// - The scrollable overflow areas of all of the above boxes
|
||||
// (including zero-area boxes and accounting for transforms as described above),
|
||||
// provided they themselves have overflow: visible (i.e. do not themselves trap the overflow)
|
||||
// and that scrollable overflow is not already clipped (e.g. by the clip property or the contain property).
|
||||
if (child.computed_values().overflow_x() == CSS::Overflow::Visible || child.computed_values().overflow_y() == CSS::Overflow::Visible) {
|
||||
auto child_scrollable_overflow = measure_scrollable_overflow(child);
|
||||
if (child.computed_values().overflow_x() == CSS::Overflow::Visible)
|
||||
scrollable_overflow_rect.unite_horizontally(child_scrollable_overflow);
|
||||
if (child.computed_values().overflow_y() == CSS::Overflow::Visible)
|
||||
scrollable_overflow_rect.unite_vertically(child_scrollable_overflow);
|
||||
}
|
||||
|
||||
box.for_each_in_subtree_of_type<Box>([&box, &scrollable_overflow_rect, &content_overflow_rect](Box const& child) {
|
||||
if (!child.paintable_box())
|
||||
return TraversalDecision::Continue;
|
||||
});
|
||||
}
|
||||
|
||||
if (child.containing_block() != &box)
|
||||
return TraversalDecision::Continue;
|
||||
|
||||
// https://drafts.csswg.org/css-position/#fixed-positioning-containing-block
|
||||
// [..] As a result, parts of fixed-positioned boxes that extend outside the layout viewport/page area
|
||||
// cannot be scrolled to and will not print.
|
||||
// FIXME: Properly establish the fixed positioning containing block for `position: fixed`
|
||||
if (child.is_fixed_position())
|
||||
return TraversalDecision::Continue;
|
||||
|
||||
auto child_border_box = child.paintable_box()->absolute_border_box_rect();
|
||||
|
||||
// Border boxes with zero area do not affect the scrollable overflow area.
|
||||
if (child_border_box.is_empty())
|
||||
return TraversalDecision::Continue;
|
||||
|
||||
// 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 TraversalDecision::Continue;
|
||||
|
||||
scrollable_overflow_rect.unite(child_border_box);
|
||||
content_overflow_rect.unite(child_border_box);
|
||||
|
||||
// - The scrollable overflow areas of all of the above boxes
|
||||
// (including zero-area boxes and accounting for transforms as described above),
|
||||
// provided they themselves have overflow: visible (i.e. do not themselves trap the overflow)
|
||||
// and that scrollable overflow is not already clipped (e.g. by the clip property or the contain property).
|
||||
if (child.computed_values().overflow_x() == CSS::Overflow::Visible || child.computed_values().overflow_y() == CSS::Overflow::Visible) {
|
||||
auto child_scrollable_overflow = measure_scrollable_overflow(child);
|
||||
if (child.computed_values().overflow_x() == CSS::Overflow::Visible)
|
||||
scrollable_overflow_rect.unite_horizontally(child_scrollable_overflow);
|
||||
if (child.computed_values().overflow_y() == CSS::Overflow::Visible)
|
||||
scrollable_overflow_rect.unite_vertically(child_scrollable_overflow);
|
||||
}
|
||||
|
||||
return TraversalDecision::Continue;
|
||||
});
|
||||
|
||||
// FIXME: - The margin areas of grid item and flex item boxes for which the box establishes a containing block.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue