flex item ends up the wrong size, in situation with several nested flex containers (related to layout.flexbox.item-final-reflow-optimization.enabled)
Categories
(Core :: Layout: Flexbox, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox154 | --- | fixed |
People
(Reporter: dholbert, Assigned: dshin)
References
Details
(Keywords: webcompat:platform-bug)
User Story
user-impact-score:300
Attachments
(2 files)
STR:
- Load attached testcase.
EXPECTED RESULTS:
No red (lime element should vertically grow to cover the red).
ACTUAL RESULTS:
Red is visible. (Lime element is short and doesn't cover the red.)
This is the root cause of bug 2011640.
This seems to be a bug with the optimization that's controlled by layout.flexbox.item-final-reflow-optimization.enabled -- if I turn off that pref, then we get expected results.
Also, if I make various minor changes in the testcase (e.g. removing one of the two col wrappers) then we get expected results.
Updated•5 months ago
|
| Reporter | ||
Comment 1•1 month ago
|
||
(In reply to Daniel Holbert [:dholbert] from comment #0)
This is the root cause of bug 2011640.
That site-report bug is not longer reproducible, as noted over in that bug just now - likely due to a site change.
Here's our reduced testcase from that bug (from which I reduced the testcase that I attached here in comment 0):
https://bugzilla.mozilla.org/attachment.cgi?id=9539227
When we fix this bug, we should check that that^ reduced testcase is fixed too.
| Assignee | ||
Updated•25 days ago
|
| Assignee | ||
Comment 2•21 days ago
•
|
||
So, one of the checks for bailing out of final reflow is FrameHasRelativeBSizeDependency, which checks for the flex container and its direct children having NS_FRAME_CONTAINS_RELATIVE_BSIZE.
So the general flow is
- Do the measuring reflow
- For each line:
- For each item:
- Check if the item frame has
NS_FRAME_CONTAINS_RELATIVE_BSIZE - Check if any of the item frame's children has
NS_FRAME_CONTAINS_RELATIVE_BSIZE - If 4. or 5. is true, the item requires the final reflow.
For this particular case, for .row, the item frame it looks at is the outer .col. It and its sole child (The inner .col) doesn't have NS_FRAME_CONTAINS_RELATIVE_BSIZE, so it doesn't do the final reflow.
If one of the .col containers are erased, .row looks at .col, which then looks at .elem-with-min-height, which has NS_FRAME_CONTAINS_RELATIVE_BSIZE set, so everything works as intended.
| Assignee | ||
Comment 3•21 days ago
|
||
:TYLin, do you know if there's a historical reason behind flexboxes not inheriting NS_FRAME_CONTAINS_RELATIVE_BSIZE from its children? Doc for the flag itself makes me think it should...
Comment 4•21 days ago
|
||
This sounds like NS_FRAME_CONTAINS_RELATIVE_BSIZE is not propagated properly. I'm wonder if we should generalize NS_FRAME_CONTAINS_RELATIVE_BSIZE bit, and always add it to the flexible flex item in a column-oriented flex container, because the item's block-size is somewhat depending on its parent flex container.
Comment 5•21 days ago
|
||
:TYLin, do you know if there's a historical reason behind flexboxes not inheriting NS_FRAME_CONTAINS_RELATIVE_BSIZE from its children? Doc for the flag itself makes me think it should...
I don't think there is any good reason for that. NS_FRAME_CONTAINS_RELATIVE_BSIZE for the percentage height was invented before flexbox ;)
| Assignee | ||
Comment 6•21 days ago
|
||
Hrm, digging further, there's probably more to this. The flag only propagates up to the containing block, which is deliberately kept as short as possible AFAICT.
| Assignee | ||
Comment 7•20 days ago
|
||
... Since the final reflow of the ancestor flex container may make the block size definite.
Updated•18 days ago
|
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/61055 for changes under testing/web-platform/tests
Comment 10•11 days ago
|
||
| bugherder | ||
Comment 11•11 days ago
|
||
Authored by https://github.com/dshin-moz
https://github.com/mozilla/enterprise-firefox/commit/5180854d6536e98dbc21901e35a3931961c978b8
[enterprise-main] Bug 2014220: Propagate up NS_FRAME_CONTAINS_RELATIVE_BSIZE from items in nested flex containers. r=layout-reviewers,TYLin
Upstream PR merged by moz-wptsync-bot
Description
•