Closed Bug 1157543 Opened 9 years ago Closed 6 years ago

nsComputedDOMStyle::DoGetMinWidth() shouldn't just convert "min-width:auto" to "min-content" on flex items (and DoGetMinHeight shouldn't just convert "auto" to 0)

Categories

(Core :: Layout, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1304636
Tracking Status
firefox40 --- affected

People

(Reporter: dholbert, Unassigned)

References

Details

In an older version of the flexbox spec, "min-width:auto" was defined as computing to either 0 or min-content, depending on whether we're a flex item. And that's how our getComputedStyle() code currently behaves.

https://mxr.mozilla.org/mozilla-central/source/layout/style/nsComputedDOMStyle.cpp?rev=da024a455adc&mark=4323-4334#4317

However, the spec has gotten more complicated, so this simple behavior isn't correct anymore.

Current spec text is at http://dev.w3.org/csswg/css-flexbox-1/#valdef-min-width-auto .
Blocks: 1015474
For the record, the old spec text (which this code is currently based on) is:
 "It is intended that this will compute to the
  ‘min-content’ keyword when the specification
  defining it (Writing Modes Appendix D) is
  sufficiently mature."
http://www.w3.org/TR/2012/WD-css3-flexbox-20120612/#min-size-auto
Similarly, we convert "min-height" to 0, regardless of whether the element is a flex item:
 https://mxr.mozilla.org/mozilla-central/source/layout/style/nsComputedDOMStyle.cpp?rev=da024a455adc&mark=4303-4309#4298

We should leave it at "auto" for each property, depending on our flex container's main axis, probably. (whichever property is in the main axis should preserve "auto")
Summary: nsComputedDOMStyle::DoGetMinWidth() shouldn't just convert "min-width:auto" to "min-content" on flex items → nsComputedDOMStyle::DoGetMinWidth() shouldn't just convert "min-width:auto" to "min-content" on flex items (and DoGetMinHeight shouldn't just convert "auto" to 0)
(In reply to Daniel Holbert [:dholbert] from comment #2)
> Similarly, we convert "min-height" to 0, regardless of whether the element
> is a flex item:
>  https://mxr.mozilla.org/mozilla-central/source/layout/style/
> nsComputedDOMStyle.cpp?rev=da024a455adc&mark=4303-4309#4298
> 
> We should leave it at "auto" for each property, depending on our flex
> container's main axis, probably. (whichever property is in the main axis
> should preserve "auto")

Looks like CSS WG just resolved that we should just preserve "auto" for both of these properties.

See: https://github.com/w3c/csswg-drafts/issues/2230 "Computing min-width/min-height: auto to zero #2230" to compute auto to auto.
This bug is pretty stale actually; the spec changed (in the past) after this bug was filed and we updated to that specced behavior in bug 1304636.

I'll dupe this forward and add a note over on that other bug.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.