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

Include the scrollable overflow of a child box if either its parent or
child has `overflow: visible`

**Issue**: For the blocks having property `overflow:hidden`, their
scroll overflow is not added to parent's scroll overflow.
Causing unable to scroll the parent block aka `Root` block in our Issue
#38248 .

**Testing**: css/cssom-view/scrolling-quirks-vs-nonquirks.html
**Fixes**: #38248

Signed-off-by: Shubham Gupta <shubham13297@gmail.com>
This commit is contained in:
Shubham Gupta 2025-08-06 15:46:54 +08:00 committed by GitHub
parent 5b148cf5de
commit dcb90bb85e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 51 additions and 55 deletions

View file

@ -15,6 +15,7 @@ use super::{BoxFragment, ContainingBlockManager, Fragment};
use crate::ArcRefCell;
use crate::context::LayoutContext;
use crate::geom::PhysicalRect;
use crate::style_ext::ComputedValuesExt;
#[derive(MallocSizeOf)]
pub struct FragmentTree {
@ -117,8 +118,15 @@ impl FragmentTree {
let scrollable_overflow = self.root_fragments.iter().fold(
self.initial_containing_block,
|overflow, fragment| {
let overflow_style = match fragment {
Fragment::Box(fragment) | Fragment::Float(fragment) => {
let fragment_flags = fragment.borrow().base.flags;
Some(fragment.borrow().style.effective_overflow(fragment_flags))
},
_ => None,
};
fragment
.calculate_scrollable_overflow_for_parent()
.calculate_scrollable_overflow_for_parent(overflow_style)
.union(&overflow)
},
);