Revert "Include the scrollable overflow of a child box if either its parent or child has overflow: visible (#38443)" (#38546)

This reverts commit dcb90bb85e.

This broke scrollable overflow calculation in the following case:

```
<div id="foo" style="width: 200px; height: 200px; outline: solid; overflow: auto;">
    <div style="height: 5000px; background: pink;">hello</div>
</div>
```

In this case the overflow is propagating through the `overflow: auto`
`<div>` and into the parents. When dumping the flow tree I see the root
node being 5000 pixels tall. It's unclear why this change didn't break
any tests, so it's likely that we need to add a test for this case.

Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Martin Robinson 2025-08-08 15:37:14 +02:00 committed by GitHub
parent 5c307a38df
commit 4257db643b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 55 additions and 51 deletions

View file

@ -23,7 +23,7 @@ use super::{
use crate::cell::ArcRefCell;
use crate::flow::inline::SharedInlineStyles;
use crate::geom::{LogicalSides, PhysicalPoint, PhysicalRect};
use crate::style_ext::{AxesOverflow, ComputedValuesExt};
use crate::style_ext::ComputedValuesExt;
#[derive(Clone, MallocSizeOf)]
pub(crate) enum Fragment {
@ -168,19 +168,14 @@ impl Fragment {
let fragment = fragment.borrow();
fragment.offset_by_containing_block(&fragment.scrollable_overflow())
},
_ => self.scrollable_overflow_for_parent(None),
_ => self.scrollable_overflow_for_parent(),
}
}
pub(crate) fn scrollable_overflow_for_parent(
&self,
parent_overflow_style: Option<AxesOverflow>,
) -> PhysicalRect<Au> {
pub(crate) fn scrollable_overflow_for_parent(&self) -> PhysicalRect<Au> {
match self {
Fragment::Box(fragment) | Fragment::Float(fragment) => {
return fragment
.borrow()
.scrollable_overflow_for_parent(parent_overflow_style);
return fragment.borrow().scrollable_overflow_for_parent();
},
Fragment::AbsoluteOrFixedPositioned(_) => PhysicalRect::zero(),
Fragment::Positioning(fragment) => fragment.borrow().scrollable_overflow_for_parent(),
@ -190,12 +185,9 @@ impl Fragment {
}
}
pub(crate) fn calculate_scrollable_overflow_for_parent(
&self,
parent_overflow_style: Option<AxesOverflow>,
) -> PhysicalRect<Au> {
pub(crate) fn calculate_scrollable_overflow_for_parent(&self) -> PhysicalRect<Au> {
self.calculate_scrollable_overflow();
self.scrollable_overflow_for_parent(parent_overflow_style)
self.scrollable_overflow_for_parent()
}
pub(crate) fn calculate_scrollable_overflow(&self) {