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

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