Closed Bug 1482173 Opened 6 years ago Closed 5 years ago

'contain:size' doesn't work correctly on elements with overflow:hidden / scroll / auto

Categories

(Core :: Layout, defect, P3)

defect

Tracking

()

RESOLVED DUPLICATE of bug 1514843
Tracking Status
firefox63 --- affected

People

(Reporter: dholbert, Unassigned)

References

Details

Attachments

(2 files)

STR:
 0. Flip layout.css.contain.enabled = true
 1. Load attached testcase

ACTUAL RESULTS:
The black border stretches to wrap the text in the 2nd, 3rd, and 4th boxes.

EXPECTED RESULTS:
Black border should *not* stretch to wrap the text. It should just collapse to a single point (perhaps with visible-but-useless scrollbars in the 3rd box -- the overflow:scroll one), as if there were no contents.

Chrome gives "expected results" (without any visible scrollbars on the 3rd box, FWIW - not sure if that's a chrome bug or not).

(Thanks to Gerard for bringing this issue up in bug 1478550 comment 17.)
Attached file testcase 1
I suspect the cleanest way to fix this would be to adjust nsHTMLScrollFrame::ReflowContents [1] or nsHTMLScrollFrame::ReflowScrolledFrame [2] or some code around there to test whether we have contain:size, and to be sure to ignore our scrolled frame's size when determining our own "outer" scroll-frame size.

[1] https://dxr.mozilla.org/mozilla-central/rev/4e56a2f51ad739ca52046723448f3129a58f1666/layout/generic/nsGfxScrollFrame.cpp#698-701

[2] https://dxr.mozilla.org/mozilla-central/rev/4e56a2f51ad739ca52046723448f3129a58f1666/layout/generic/nsGfxScrollFrame.cpp#482-487
(In reply to Daniel Holbert [:dholbert] from comment #0)
> Chrome gives "expected results" (without any visible scrollbars on the 3rd
> box, FWIW - not sure if that's a chrome bug or not).

(I filed https://bugs.chromium.org/p/chromium/issues/detail?id=872794 on this Chrome side-issue, BTW.)
Summary: 'contain:size' doesn't work correctly on elements with overflow:hidden → 'contain:size' doesn't work correctly on elements with overflow:hidden / scroll / auto
Priority: -- → P3
This is a partial patch I've written with dholbert's test included. The patch reduces the BSize of overflow:[hidden | auto] elements to zero. It doesn't address overflow:scroll elements. Tests to add might include: 

* elements with contain:size, an overflow property, and fixed height
* elements with contain:size, an overflow property, and fixed width
* elements with contain:size, an overflow property, and fixed height and width

for all three overflow variants. 

It's probably easiest to grab one of the contain-size-block* or contain-size-fieldset* reftests as a boilerplate, since may of those test cases can have overflow:[hidden | auto | scroll] added.

I believe this was fixed in bug 1514843, which added contain:size support for scrollable elements.

Both testcases linked in comment 5 pass in current Nightly, and the attached testcase from comment 0 passes as well.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: