Closed Bug 1760658 Opened 2 years ago Closed 2 years ago

Height does not grow to fit content, on element with aspect-ratio and explicit width, when element has display:flex or grid

Categories

(Core :: Layout, defect)

Firefox 98
defect

Tracking

()

RESOLVED FIXED
102 Branch
Tracking Status
firefox-esr91 --- wontfix
firefox98 --- wontfix
firefox99 --- wontfix
firefox100 --- wontfix
firefox101 --- wontfix
firefox102 --- fixed

People

(Reporter: jivetheuniversal, Assigned: boris)

References

Details

(Keywords: parity-chrome, parity-edge)

Attachments

(6 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:98.0) Gecko/20100101 Firefox/98.0

Steps to reproduce:

Create a flex container and set an aspect-ratio on the flex items. Add content inside these flex items such that it should force the box to expand. See it failing here -- https://codepen.io/JiveDig/pen/YzYwENd. Screenshot also attached below.

Actual results:

The content overflows the aspect-ratio container.

Expected results:

The container should no longer keep the aspect ration and expand.

The Bugbug bot thinks this bug should belong to the 'Core::Layout' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Layout
Product: Firefox → Core
Attached file testcase 1

Here's a reduced testcase.

In Chrome, the black-bordered box is tall enough to contain the green box. In Firefox, it is not.

(Firefox has the same behavior if I use display:grid on the container instead of display:flex, too.)

The original testcase happened to use a column-oriented flexbox, but this happens if we use a row-oriented flexbox too.

Boris, I think you've got a bundle of aspect-ratio work that you're planning in the near future - maybe worth including this as part of that? (or maybe this is a dupe of a known bug?)

Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(boris.chiou)
Summary: Aspect-ratio does not grow correctly when element has flex display → Height does not grow to fit content, on element with aspect-ratio and explicit width, when element has display:flex or grid
Blocks: aspect-ratio
Flags: needinfo?(boris.chiou)

Sure. May take a look at this in H1. :)

Assignee: nobody → boris.chiou

This is related to https://drafts.csswg.org/css-sizing-4/#aspect-ratio-minimum, and we added this for block frame, but not for flex and grid container frame. My bad.

(In reply to Boris Chiou [:boris] from comment #8)

This is related to https://drafts.csswg.org/css-sizing-4/#aspect-ratio-minimum, and we added this for block frame, but not for flex and grid container frame. My bad.

We should add a similar implementation like this: https://searchfox.org/mozilla-central/rev/0ffae75b690219858e5a45a39f8759a8aee7b9a2/layout/generic/nsBlockFrame.cpp#1930-1941.

Basides, factor out the utility function to AspectRatio so everyone can
use it.

Pushed by bchiou@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/739f65a44331
Part 1: Apply automatic content-based minimum on flex container. r=emilio
https://hg.mozilla.org/integration/autoland/rev/cf1c104f05d7
Part 2: Apply automatic content-based minimum on grid container. r=emilio
https://hg.mozilla.org/integration/autoland/rev/59770e5a8ff2
Part 3: Apply automatic content-based minimum on fieldset element. r=emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/33901 for changes under testing/web-platform/tests
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 102 Branch
Upstream PR merged by moz-wptsync-bot

Since the status are different for nightly and release, what's the status for beta?
For more information, please visit auto_nag documentation.

I'm not planning to uplift these patch for now. So mark it wontfix

Blocks: 1769575
No longer blocks: 1769575
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: