Firefox incorrectly resolves percent heights on child of auto-sized multicol element, inside auto-sized flex or grid container
Categories
(Core :: Layout: Columns, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox162 | --- | fixed |
People
(Reporter: dholbert, Assigned: dholbert, NeedInfo)
References
Details
(Keywords: webcompat:platform-bug)
Attachments
(9 files, 1 external file, 1 obsolete file)
STR:
- Load attached testcase.
ACTUAL RESULTS:
The purple-bordered elements are the same height as their container (i.e. they honor their 100% height)
EXPECTED RESULTS:
The purple-bordered elements are the height of their content (cyan box).
This is the root cause of webcompat site-issue bug 2088487.
Chrome/Safari give EXPECTED RESULTS.
Firefox (release and Nightly) give ACTUAL RESULTS.
| Assignee | ||
Comment 1•16 days ago
|
||
| Assignee | ||
Comment 2•16 days ago
|
||
Just to illustrate that this isn't specific to column-oriented flex containers -- here's the same testcase with flex-direction:column removed. The layout ends up slightly different but the behavior-difference vs. Chrome/Safari remains.
| Assignee | ||
Comment 3•16 days ago
|
||
| Assignee | ||
Comment 4•16 days ago
|
||
This also isn't specific to flexbox; it happens if the outer container is a grid, too, as shown in this testcase.
| Assignee | ||
Comment 5•16 days ago
|
||
(er, adjusting a class name in testcase 3 for clarity)
| Assignee | ||
Comment 6•16 days ago
|
||
| Assignee | ||
Updated•16 days ago
|
| Assignee | ||
Comment 7•16 days ago
|
||
For completeness, here's a testcase with display:block on the outer wrapper. This produces the expected rendering, with the percent size not being resolved.
| Assignee | ||
Comment 8•16 days ago
|
||
Hmm, here's a variant of testcase 1 where I removed the multicol styling.
In this case, browsers agree that we do treat the percent height as resolvable.
| Assignee | ||
Updated•16 days ago
|
| Assignee | ||
Updated•16 days ago
|
| Assignee | ||
Comment 9•16 days ago
|
||
| Assignee | ||
Comment 10•16 days ago
•
|
||
note:
- testcase 6 is like testcase 1, with multicol removed.
- testcase 5 is like testcase 2, with multicol removed.
- Chrome, Safari, and Firefox agree with each other on how to render testcase 4, 5, and 6.
- The fact that there's consensus to not resolve percentages in testcase 6 implies that we also shouldn't resolve percentages in testcase 1 (which confirms that we're wrong on that one). Fixing that (i.e. not-resolving-percentages in testcase 1) would fix the associated webcompat bug.
- Having said that... the fact that browsers do resolve percentages in testcase 5 implies that Firefox is correct to resolve percentages in testcase 2 (and I think 3). Perhaps we should spin off Chrome/WebKit bugs for that. But that's followup; it just helps to properly-scope what beahvior should change here, which is perhaps just testcase 1.
| Assignee | ||
Comment 11•16 days ago
|
||
hackbot: come up with a patch that makes Firefox treat the multicol container as having an indefinite height (for the purposes of resolving percent heights in its children), in testcase 1.
(The height should be treated as indefinite per css-flexbox-1 section 9.8 -- it's the main size of a flex item, and the flex item has an indefinite flex-basis, and is in a flex container with an indefinite main size.)
Comment 12•16 days ago
|
||
The percentage basis for content inside a multicol container came from the ColumnSetWrapper's ComputedBSize(), in two places:
- nsBlockFrame::ReflowBlockFrame(): containing-block size for children of ::-moz-column-content.
- nsColumnSetFrame::ReflowColumns(): containing-block size for the column boxes.
Neither checked ReflowInput::mFlags.mTreatBSizeAsIndefinite. nsFlexContainerFrame sets that flag on a flex item whose main size must be treated as indefinite (css-flexbox-1 §9.8: indefinite flex basis in a container with an indefinite main size). So percent heights inside a multicol flex item in an auto-height column flex container resolved against the item's flexed height instead of behaving as auto. Chrome and Safari treat them as auto, and so does Firefox when the item is a plain block.
Both places now use ComputedBSizeAsPercentageBasis(). That helper honors mTreatBSizeAsIndefinite and also mPercentageBasisInBlockAxis, the definite basis flex sets for fragmented flex items. This matches how ComputeContainingBlockRectangle() treats regular blocks.
Row flex and grid containers (testcases 2 and 3) don't change: no indefinite flag is set there, and comment 10 says Firefox's current rendering of those agrees with the non-multicol consensus.
| Assignee | ||
Comment 13•16 days ago
|
||
at first glance, hackbot's patch looks reasonable. ni=me to get it finalized + landed, barring issues.
Updated•15 days ago
|
Updated•15 days ago
|
Comment 14•15 days ago
|
||
Updated•15 days ago
|
Comment 15•15 days ago
|
||
| bugherder | ||
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/64898 for changes under testing/web-platform/tests
Upstream PR merged by moz-wptsync-bot
Description
•