Closed Bug 1471758 Opened 6 years ago Closed 5 years ago

[css-grid-2][css-contain] contain:paint and contain:layout on a subgrid need to *prevent* it from being a subgrid

Categories

(Core :: Layout, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla69
Tracking Status
firefox63 --- wontfix
firefox69 --- fixed

People

(Reporter: dholbert, Assigned: MatsPalmgren_bugz)

References

Details

Attachments

(1 file)

contain:layout and contain:paint are specced as making an element "[establish] an independent formatting context" https://drafts.csswg.org/css-contain/#containment-layout https://drafts.csswg.org/css-contain/#containment-paint (For blocks, this prevents margin-collapsing and float interactions across the containment boundary.) For grid: if this is set on an element which is a subgrid, it needs to make that element *not* be a subgrid. (It can't participate in its parent's grid formatting context.) (There might be other things that make an element "establish an independent formatting context" that we need to consider for subgrid-disabling, too...? not sure)
Priority: -- → P3
Summary: contain:paint and contain:layout on a subgrid need to *prevent* it from being a subgrid → [css-grid][css-contain] contain:paint and contain:layout on a subgrid need to *prevent* it from being a subgrid
(In reply to Daniel Holbert [:dholbert] from comment #0) > For grid: if this is set on an element which is a subgrid, it needs to make > that element *not* be a subgrid. (It can't participate in its parent's grid > formatting context.) This seems simple enough. In nsGridContainerFrame::Init where we require that the parent is a grid container we could also check 'contain' on the frame itself and simply not set the subgrid frame bits if so. > (There might be other things that make an element "establish an independent > formatting context" that we need to consider for subgrid-disabling, too...? > not sure) Not participating the item baseline alignment group perhaps?
> Not participating the item baseline alignment group perhaps? Or behave as overflow:hidden when calculating its baseline?
(In reply to Mats Palmgren (:mats) from comment #1) > > (There might be other things that make an element "establish an independent > > formatting context" that we need to consider for subgrid-disabling, too...? > > not sure) > > Not participating the item baseline alignment group perhaps? [...] > Or behave as overflow:hidden when calculating its baseline? I suspect this behavior would be triggered by "contain:size", *not* by "contain:layout". [EDIT: The spec has now changed on this so that `contain:layout` is now the thing that suppresses baselines from leaking out, as Florian notes below]
Flags: needinfo?(dholbert)
(In reply to Daniel Holbert [:dholbert] from comment #4) > I suspect this behavior would be triggered by "contain:size", *not* by > "contain:layout". OK, I haven't read the 'contain' spec in detail so you're probably right. Still, baselines are a bit of an edge case in the sense that they are normally derived from the box' contents and the goal of 'contain:layout' seems to be about not "leaking" out any layout details outside it. Anyway, seems off-topic for this bug, sorry for the digression.

Suppression of baselines is triggered by layout containment, not by size containment. The spec (now) has normative text and a note clarifying that.

Size containment sizes the element as if it had no content. Other effects, such as laying out out its descendants within that size, or placing the element within its parent are done with its actual content, and baselines are generated normally.

Layout containment does suppress baseline alignment, otherwise changes in the internal layout of the element would have effects on the rest of document.

Type: enhancement → defect

The baseline alignment part of this bug is also tracked (in the more general case, not limited to subgrids) in https://bugzilla.mozilla.org/show_bug.cgi?id=1508441

oops, followed the wrong link above. That one was specific to buttons, the generic one is https://bugzilla.mozilla.org/show_bug.cgi?id=1491235, which has been fixed already. Sorry for the noise.

(In reply to Florian Rivoal from comment #6)

Suppression of baselines is triggered by layout containment, not by size containment. The spec (now) has normative text and a note clarifying that.

Yup -- I've edited comment 4 to reflect that. (At the time I wrote comment 4, contain:size was the thing that triggered baseline suppression, but that has indeed changed now.)

(I filed bug 1548709 on implementing contain:size on a subgrid)

Assignee: nobody → mats
Summary: [css-grid][css-contain] contain:paint and contain:layout on a subgrid need to *prevent* it from being a subgrid → [css-grid-2][css-contain] contain:paint and contain:layout on a subgrid need to *prevent* it from being a subgrid
Pushed by mpalmgren@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/8a0c6e30d738 [css-grid-2][css-contain] Make 'contain:paint' and 'contain:layout' inhibit a grid container from being a subgrid. r=dholbert
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla69
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/16953 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: