Truly independent web browser
LibWeb: Accumulate reachable overflow independently by axis
Andreas Kling4bb781503bd0
diff --git a/Libraries/LibWeb/Rust/src/painting/scrollable_overflow.rs b/Libraries/LibWeb/Rust/src/painting/scrollable_overflow.rsindex f49f608e36e..bbeb18177c7 100644--- a/Libraries/LibWeb/Rust/src/painting/scrollable_overflow.rs+++ b/Libraries/LibWeb/Rust/src/painting/scrollable_overflow.rs@@ -527,7 +527,8 @@ fn measure_scrollable_overflow_impl(if !child_is_absolutely_positioned {child_border_box = clip_in_flow(child_border_box);}- // NOTE: Only boxes that are not wholly in the unreachable scrollable overflow region contribute.+ // INTEROP: Chrome and Firefox retain reachable overflow in each axis independently, even when+ // the border box lies wholly in the other axis's unreachable region.let wholly_in_unreachable_horizontal_axis = if overflow_directions.horizontal_axis_is_positive {child_border_box.right() < paintable_absolute_padding_box.x} else {@@ -538,13 +539,18 @@ fn measure_scrollable_overflow_impl(} else {child_border_box.y > paintable_absolute_padding_box.bottom()};- if wholly_in_unreachable_horizontal_axis || wholly_in_unreachable_vertical_axis {+ if wholly_in_unreachable_horizontal_axis && wholly_in_unreachable_vertical_axis {continue;}// Border boxes with zero area do not affect the scrollable overflow area.if !child_border_box.is_empty() {- scrollable_overflow_rect.unite(child_border_box);+ if !wholly_in_unreachable_horizontal_axis {+ scrollable_overflow_rect.unite_horizontally(child_border_box);+ }+ if !wholly_in_unreachable_vertical_axis {+ scrollable_overflow_rect.unite_vertically(child_border_box);+ }}// - The scrollable overflow areas of all of the above boxes (including zero-area boxes and accounting for@@ -578,10 +584,10 @@ fn measure_scrollable_overflow_impl(child_scrollable_overflow = clip_in_flow(child_scrollable_overflow);}if !child_scrollable_overflow.is_empty() {- if child_overflow_x == overflow::VISIBLE {+ if child_overflow_x == overflow::VISIBLE && !wholly_in_unreachable_horizontal_axis {scrollable_overflow_rect.unite_horizontally(child_scrollable_overflow);}- if child_overflow_y == overflow::VISIBLE {+ if child_overflow_y == overflow::VISIBLE && !wholly_in_unreachable_vertical_axis {scrollable_overflow_rect.unite_vertically(child_scrollable_overflow);}}diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-position/position-absolute-scrollable-overflow-001.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-position/position-absolute-scrollable-overflow-001.txtindex 7cc6c7abf5a..11e43cc26be 100644--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-position/position-absolute-scrollable-overflow-001.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-position/position-absolute-scrollable-overflow-001.txt@@ -2,19 +2,18 @@ Harness status: OKFound 14 tests-6 Pass-8 Fail-Fail .containing-block 1-Fail .containing-block 2-Fail .containing-block 3-Fail .containing-block 4+14 Pass+Pass .containing-block 1+Pass .containing-block 2+Pass .containing-block 3+Pass .containing-block 4Pass .containing-block 5Pass .containing-block 6Pass .containing-block 7-Fail .containing-block 8-Fail .containing-block 9-Fail .containing-block 10-Fail .containing-block 11+Pass .containing-block 8+Pass .containing-block 9+Pass .containing-block 10+Pass .containing-block 11Pass .containing-block 12Pass .containing-block 13Pass .containing-block 14\ No newline at end of file