Absolutely positioned flex item leaves a gap
Categories
(Core :: Layout: Flexbox, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox74 | --- | fixed |
People
(Reporter: fvsch, Assigned: TYLin)
References
Details
(Whiteboard: [layout:backlog:quality], [wptsync upstream])
Attachments
(3 files)
STR:
<div style="display: inline-flex; gap: 100px; background: lime;">
<span style="position: absolute;">A</span>
<span>B</span>
<span>C</span>
</div>
Expected result:
- A 100px gap between B and C.
Actual result:
- One 100px gap between B and C, and another one after C.
Note: I haven't checked the spec for what was supposed to happen (and not sure I would understand the language). That extra gap at the end just feels buggy. I expected that absolutely positioned elements would not participate in gaps.
Comment 1•5 years ago
•
|
||
Good catch! I think this is a valid bug. We're probably calculating the flex container's hypothetical size incorrectly here:
https://searchfox.org/mozilla-central/rev/2e355fa82aaa87e8424a9927c8136be184eeb6c7/layout/generic/nsFlexContainerFrame.cpp#5216-5236
We're adding n-1 gaps (where n=number of in-flow child frames), and we need to exclude the 0-sized nsPlaceHolderFrame children when we do that.
Comment 2•5 years ago
|
||
So in particular, that main loop in nsFlexContainerFrame::IntrinsicISize
(that I linked above) probably wants something like the following, near its start:
if (childFrame->IsPlaceholderFrame()) {
continue;
}
This is analogous to the similar placeholder check in nsFlexContainerFrame::GenerateFlexLines()
(where we're doing actual layout of the children).
I'll bet that change will fix this, or get it closer to fixed.
ni=sean to assign someone here, rather than fixing this myself, in the interests of spreading flex knowledge around. :) I'll gladly mentor here.
Updated•5 years ago
|
Assignee | ||
Comment 3•5 years ago
|
||
Updated•5 years ago
|
Comment 7•5 years ago
|
||
bugherder |
Description
•