'contain:layout' should prevent wide abspos elements from inflating the mobile viewport
Categories
(Core :: Layout: Scrolling and Overflow, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox152 | --- | fixed |
People
(Reporter: dholbert, Assigned: hiro)
References
(Blocks 1 open bug)
Details
(4 keywords)
User Story
user-impact-score:200
Attachments
(3 files)
STR:
- Load attached testcase on Android or in RDM on Desktop.
- Try to scroll (horizontally or vertically).
ACTUAL RESULTS:
I can scroll.
EXPECTED RESULTS:
Should not be able to scroll.
There's some overflow contributed by a large abspos element. That element is inside of a contain:layout wrapper, which I think is supposed to prevent that element from actually generating scrollable overflow.
| Reporter | ||
Updated•1 year ago
|
| Reporter | ||
Comment 1•1 year ago
|
||
Actually, the same bug happens if I just load the testcase directly on desktop (no need for RDM). Firefox shows scrollbars and will let you scroll the page; Chrome and WebKit do not.
Updated•1 year ago
|
Updated•1 year ago
|
Updated•7 months ago
|
| Assignee | ||
Comment 2•4 days ago
|
||
So in the case of comment 0, the abspos element runs through:
aOverflowAreas->UnionWithAbsoluteOverflowAreas(
aKidFrame->GetOverflowAreasRelativeToParent());
this code path in AbsoluteConainingBlock::ReflowAbsoluteFrame, rather than
aDelegatingFrame->ConsiderChildOverflow(*aOverflowAreas, kidFrame);
this code path in AbsoluteContainingBlock::Reflow. Thus, this special handling for contain:layout is not applied to:
if (StyleDisplay()->IsContainLayout() && SupportsContainLayoutAndPaint() &&
!aAsIfScrolled) {
// If we have layout containment and are not a non-atomic, inline-level
// principal box, we should only consider our child's ink overflow,
// leaving the scrollable regions of the parent unaffected.
// Note: scrollable overflow is a subset of ink overflow,
// so this has the same affect as unioning the child's ink and
// scrollable overflow with the parent's ink overflow.
const OverflowAreas childOverflows(aChildFrame->InkOverflowRect(),
nsRect());
aOverflowAreas.UnionWith(childOverflows + aChildFrame->GetPosition());
Adding a similar check in AbsoluteConainingBlock::ReflowAbsoluteFrame solves this bug.
That's being said, I am not sure whether the place where ConsiderChildOverflow is called in AbsoluteContainingBlock::Reflow should also use UnionWithAbsoluteOverflowAreas instead of UnionWith. I have tried to create a similar test case to the one in bug 2025540 which introduced UnionWithAbsoluteOverflowAreas, but the attempt was not successful.
So I am going to leave the ConsiderChildOverflow call as it is.
| Assignee | ||
Comment 3•4 days ago
|
||
When a containing block has contain: layout, scrollable overflow from its
children should not propagate to the parent. nsContainerFrame::ConsiderChildOverflow
already implements this by only unioning the child's ink overflow, but
AbsoluteContainingBlock::ReflowAbsoluteFrame took a separate code path that
unconditionally unioned the child's full overflow areas. As a result, a wide
absolutely positioned descendant of a contain: layout element could still
inflate the page's scrollable area (and the mobile viewport).
Mirror the contain:layout handling from nsContainerFrame::ConsiderChildOverflow
here so that only the child's ink overflow contributes when the delegating
frame has layout containment.
Updated•4 days ago
|
| Assignee | ||
Comment 4•4 days ago
|
||
This is a preparatory refactor for a follow-up commit that introduces a new
flag (for absolutely positioned children). Using a bit-flag enum makes call
sites self-documenting and lets us add more orthogonal options without
expanding the parameter list.
No behavior change.
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/59808 for changes under testing/web-platform/tests
Comment 7•4 days ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/2718e04254c2
https://hg.mozilla.org/mozilla-central/rev/df1a015a45f4
Upstream PR merged by moz-wptsync-bot
Description
•