Closed Bug 1527539 Opened 6 years ago Closed 4 years ago

[css-grid] Include grid item's margins and grid container's padding in the grid container's overflow area

Categories

(Core :: Layout: Grid, defect)

defect

Tracking

()

RESOLVED FIXED
91 Branch
Tracking Status
firefox91 --- fixed

People

(Reporter: MatsPalmgren_bugz, Assigned: TYLin)

References

(Regressed 1 open bug)

Details

(Keywords: testcase)

Attachments

(5 files, 2 obsolete files)

Attached file Testcase #1 (obsolete) —

I haven't check the specs yet, but our rendering differs to Chrome
in both the grid and flexbox cases...

Daniel, can you take a look at the flexbox case?

Flags: needinfo?(dholbert)
Attached file Testcase #1

(slightly clearer version)

Attachment #9043504 - Attachment is obsolete: true

Oh, nice... :(

https://drafts.csswg.org/css-overflow-3/#scrollable
"The UA may additionally include the margin areas of boxes for which it is the containing block.
The conditions under which such margin areas are included is undefined in this level.
ISSUE 6. This needs further testing and investigation; is therefore deferred in this draft."

Flags: needinfo?(dholbert)

I'm guessing that the rendering in Chrome makes sense to authors,
since it's compatible with block layout at least for this trivial
example. I guess we'll have to reverse-engineer what they are
doing if we want to be compatible... Sigh.

Attached file Testcase #2 (obsolete) —

Slightly more complex test for grid/flex layout.
It looks like Chrome is using the margin-boxes of children when calculating the overflow.

Does anyone have an opinion about the spec issue (cited in comment 3)?
Otherwise, I'm leaning towards proposing to the CSSWG that we resolve
in favor of using margin-boxes.

I don't have a strong opinion.

Some background about this: we intentionally included margins in bug 665597
and then reverted that partially in bug 724352 and eventually backed it out
in bug 750293 due to regressions. The part that did survive lives in
nsBlockFrame::ComputeFinalSize in the form of 'blockEndEdgeOfChildren'
which we propagate to ConsiderBlockEndEdgeOfChildren for inclusion into
the overflow area. So it appears that we only include the block-end margin,
but maybe only in some cases? - I haven't looked at the details yet...
I'll try to file a spec issue to sort this out unless there is one already.

bug 1487927 is about the block-end margin rendering difference on columns.

Attached file Testcase #2
Attachment #9043510 - Attachment is obsolete: true

Fwiw spec issue concluded that margins/padding of flex/grid layout should always be included in scrollable overflow. (It's what authors expect, and as long as we're not constrained by webcompat, we should make it work as expected.)

Status: UNCONFIRMED → NEW
Ever confirmed: true
See Also: → 1697349

I morph this bug into adding grid item's margins and grid container's padding in the grid container's overflow area because there are some sample tests for grid in this bug. Flexbox is handling in bug 1697349.

Severity: normal → S3
Type: enhancement → defect
Priority: P3 → --
Summary: [css-grid][css-flexbox] item margins should be included in overflow? → [css-grid] Include grid item's margins and grid container's padding in the grid container's overflow area
See Also: → 748518

This patch updated the grid container's scrollable overflow areas to
match the spec. This also fixed Bug 1532383 - include space in empty
explicit grid tracks in the scrollable overflow area.

Depends on D111994

Assignee: nobody → aethanyc
Status: NEW → ASSIGNED
Attachment #9215695 - Attachment description: Bug 1527539 Part 2 - Incorporate grid item's margins and grid container's paddings when computing grid container's overflow area. → WIP: Bug 1527539 Part 2 - Incorporate grid items' margins and grid container's paddings when computing grid container's overflow area.
Attachment #9215695 - Attachment description: WIP: Bug 1527539 Part 2 - Incorporate grid items' margins and grid container's paddings when computing grid container's overflow area. → Bug 1527539 Part 2 - Incorporate grid items' margins and grid container's paddings when computing grid container's overflow area.
Depends on: 1709491
Depends on: 1711803
No longer depends on: 1711803
Pushed by aethanyc@gmail.com: https://hg.mozilla.org/integration/autoland/rev/6de6fc3205c0 Part 1 - Add helper functions to calculate the sum of grid tracks sizes (and gaps). r=dholbert https://hg.mozilla.org/integration/autoland/rev/3cac3147fcd5 Part 2 - Incorporate grid items' margins and grid container's paddings when computing grid container's overflow area. r=dholbert
Blocks: 1715154
Pushed by aethanyc@gmail.com: https://hg.mozilla.org/integration/autoland/rev/05e001cd9117 Part 1 - Add helper functions to calculate the sum of grid tracks sizes (and gaps). r=dholbert https://hg.mozilla.org/integration/autoland/rev/adc96c7ed268 Part 2 - Incorporate grid items' margins and grid container's paddings when computing grid container's overflow area. r=dholbert
Flags: needinfo?(aethanyc)
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/29270 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 91 Branch
Upstream PR merged by moz-wptsync-bot
See Also: 1697122
Regressions: 1797305
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: