Intrinsically-sized flex container has the wrong intrinsic ISize, if it has a definite BSize that stretches a child with an aspect ratio
Categories
(Core :: Layout: Flexbox, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox132 | --- | verified |
People
(Reporter: dholbert, Assigned: TYLin)
References
(Blocks 1 open bug)
Details
Attachments
(6 files)
STR:
- Load attached testcase.
EXPECTED RESULTS:
Orange should be contained in blue border.
ACTUAL RESULTS:
Orange overflows blue border.
Firefox Nightly (as of today) and Chrome both give versions of EXPECTED RESULTS, though they disagree -- Firefox renders the blue box as being 46px wide (40px-wide content area), and Chrome renders it as 106px wide (100px-wide content area).
Firefox Nightly with bug 1735589's fixes (which I suspect are landing soon) produces ACTUAL RESULTS -- the orange area is 100px wide, but the blue box is 46px wide (40px-wide content area).
This differing size reflects a difference between how the flex container computes its own intrinsic size based on its children, vs. how its flex items actually compute their own sizes (and automatic minimum sizes) during layout. The latter phase is changing in bug 1735589. We might need to change the former as well to avoid triggering unexpected overflow for cases like this, because it's a bit odd for a max-content-sized element (like the flex container in this example) to nonetheless have its content spill out of it.
Assignee | ||
Comment 1•3 years ago
•
|
||
Thanks for filing this bug. Could you attach the testcase?
I can take a look at this bug and coordinate the landing of bug 1735589. In other words, if this is hard to fix in a short time frame, we probably shouldn't land bug 1735589 for now.
Reporter | ||
Comment 2•3 years ago
|
||
oops, sorry for forgetting the testcase! yup, I'll attach shortly (I had it in /tmp and have since rebooted, so I'll need to regenerate it)
Reporter | ||
Comment 3•3 years ago
|
||
Reporter | ||
Comment 4•3 years ago
|
||
Here's a screenshot of the testcase in:
- Nightly 96.0a1 (2021-11-19)
- Local build with bug 1735589's patches
- Chrome
Assignee | ||
Comment 5•3 years ago
|
||
Ah, yet another bug that the stretched cross-size of the flex items affects the flex container's intrinsic size. I think this is similar to bug 1740658.
Assignee | ||
Comment 6•2 years ago
|
||
FWIW, Safari Technology Preview 17.0 (Release 172) behaves like Google Chrome for testcase 1.
Assignee | ||
Updated•7 months ago
|
Assignee | ||
Comment 7•6 months ago
|
||
We only ever set mIsStretched
to true
in
FlexItem::ResolveStretchedCrossSize()
[1]. However, we cannot use
SetIsStretched()
there because FlexItem::ResolveStretchedCrossSize()
is
called within GenerateFlexItemForChild()
, where the main size has not yet been
resolved. This triggers the assertion in SetIsStretched()
.
Updated•6 months ago
|
Assignee | ||
Comment 8•6 months ago
|
||
Assignee | ||
Comment 9•6 months ago
|
||
We are going to use StyleSizeOverrides
in nsLayoutUtils.h in Part 4 that
requires a full definition of StyleSizeOverrides
. but we don't want to include
the entire ReflowInput.h in nsLayoutUtils.h that can add unnecessary header
dependency.
We could also move it into LayoutConstants.h that has been included by
nsLayoutUtils.h, but the header is a home for layout constants. Therefore, I
create a new header for layout helper classes and structs.
Assignee | ||
Comment 10•6 months ago
|
||
For flex items with an aspect-ratio, the stretched cross-sizes can be
transferred to the main axis, affecting their intrinsic inline-size contribution
to the flex container's intrinsic inline-size.
Add aspect-ratio-intrinsic-size-008.html
(adapted from 003.html) to test a
flex item with border and padding since the existing tests do not cover this.
Comment 11•6 months ago
|
||
Comment 13•6 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/ea37bd55d9cf
https://hg.mozilla.org/mozilla-central/rev/35769cab3573
https://hg.mozilla.org/mozilla-central/rev/8475273664b3
https://hg.mozilla.org/mozilla-central/rev/426eef56bc22
Assignee | ||
Updated•6 months ago
|
Updated•5 months ago
|
Comment 17•5 months ago
|
||
I was able to reproduce the issue with an affected Firefox 130.0b1 build, using WIndows 11 and the test case from Comment 3.
Verified as fixed using Firefox 132.0b2, on macOS 14.6, Windows 11 and Ubuntu 22.04.
Description
•