commit 2b54f26fc923d586e1a59f6f6387ff32015bc653
parent cfade7054a4ae0a80d3c39f71224b5738ad3bf2a
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date: Sat, 13 Dec 2025 09:31:09 +0000
Bug 2005683 - Don't apply overflow clipping to list controls. r=layout-reviewers,dshin
I can't repro missing content like comment 0 but I can repro broken
scrollport handling.
And clean up ShouldApplyOverflowClipping while at it:
* Deal with scrollers (including list controls) explicitly at the top.
* Deal with suppressed scrollable blocks for print inside the if where
we check if overflow is scrollable already.
* Remove now redundant SVG check. An SVG layout frame can never be a
suppressed scrollable block.
I'm not sure how would I go about testing this...
Differential Revision: https://phabricator.services.mozilla.com/D276154
Diffstat:
1 file changed, 15 insertions(+), 19 deletions(-)
diff --git a/layout/generic/nsIFrame.cpp b/layout/generic/nsIFrame.cpp
@@ -12288,13 +12288,15 @@ PhysicalAxes nsIFrame::ShouldApplyOverflowClipping(
const nsStyleDisplay* aDisp) const {
MOZ_ASSERT(aDisp == StyleDisplay(), "Wrong display struct");
- // 'contain:paint', which we handle as 'overflow:clip' here. Except for
- // scrollframes we don't need contain:paint to add any clipping, because
- // the scrollable frame will already clip overflowing content, and because
- // 'contain:paint' should prevent all means of escaping that clipping
- // (e.g. because it forms a fixed-pos containing block).
- if (aDisp->IsContainPaint() && !IsScrollContainerFrame() &&
- SupportsContainLayoutAndPaint()) {
+ if (IsScrollContainerOrSubclass()) {
+ // Scrollers deal with overflow on their own.
+ return {};
+ }
+
+ // 'contain:paint', which we handle as 'overflow:clip' here. 'contain:paint'
+ // should prevent all means of escaping that clipping (e.g. because it forms a
+ // fixed-pos containing block).
+ if (aDisp->IsContainPaint() && SupportsContainLayoutAndPaint()) {
return kPhysicalAxesBoth;
}
@@ -12305,7 +12307,6 @@ PhysicalAxes nsIFrame::ShouldApplyOverflowClipping(
switch (type) {
case LayoutFrameType::CheckboxRadio:
case LayoutFrameType::ComboboxControl:
- case LayoutFrameType::ListControl:
case LayoutFrameType::Progress:
case LayoutFrameType::Range:
case LayoutFrameType::SubDocument:
@@ -12333,13 +12334,13 @@ PhysicalAxes nsIFrame::ShouldApplyOverflowClipping(
default:
break;
}
+ if (IsSuppressedScrollableBlockForPrint()) {
+ return kPhysicalAxesBoth;
+ }
}
- // clip overflow:clip, except for nsListControlFrame which is
- // a ScrollContainerFrame sub-class.
- if (MOZ_UNLIKELY((aDisp->mOverflowX == StyleOverflow::Clip ||
- aDisp->mOverflowY == StyleOverflow::Clip) &&
- !IsListControlFrame())) {
+ if (aDisp->mOverflowX == StyleOverflow::Clip ||
+ aDisp->mOverflowY == StyleOverflow::Clip) {
// FIXME: we could use GetViewportScrollStylesOverrideElement() here instead
// if that worked correctly in a print context. (see bug 1654667)
const auto* element = Element::FromNodeOrNull(GetContent());
@@ -12356,12 +12357,7 @@ PhysicalAxes nsIFrame::ShouldApplyOverflowClipping(
}
}
- if (HasAnyStateBits(NS_FRAME_SVG_LAYOUT)) {
- return PhysicalAxes();
- }
-
- return IsSuppressedScrollableBlockForPrint() ? kPhysicalAxesBoth
- : PhysicalAxes();
+ return PhysicalAxes();
}
bool nsIFrame::IsSuppressedScrollableBlockForPrint() const {