File: flex-minimum-height-flex-items-023.html

package info (click to toggle)
firefox-esr 91.12.0esr-1~deb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,375,668 kB
  • sloc: cpp: 5,762,032; javascript: 5,481,714; ansic: 3,121,206; python: 851,492; asm: 331,174; xml: 178,949; java: 155,554; sh: 63,704; makefile: 20,127; perl: 12,825; yacc: 4,583; cs: 3,846; objc: 3,026; lex: 1,720; exp: 762; pascal: 635; php: 436; lisp: 260; awk: 231; ruby: 103; sed: 53; sql: 46; csh: 45
file content (55 lines) | stat: -rw-r--r-- 2,723 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!DOCTYPE html>
<title>Flex minimum height of image with intrinsic min-height specified</title>
<link rel="author" title="dgrogan@chromium.org" href="mailto:dgrogan@chromium.org" />
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#min-size-auto" />
<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#valdef-width-min-content" />
<link rel="match" href="../reference/ref-filled-green-100px-square-only.html" />
<link rel="bookmark" href="https://crbug.com/1088223">
<meta name="assert" content="Flex uses automatic minimum sizes when item specifies min-height:intrinsic, because that is treated as auto.">

<p>Test passes if there is a filled green square.</p>

<!--
Here's the spec trail why the height of this item is 100px.

1. The column flexbox has height:0, and the item has flex-shrink: 1. So
   min-height will determine the item's flexed height.

2. The min-content value of the min-height property is equivalent to the
   automatic size, per https://drafts.csswg.org/css-sizing-3/#valdef-width-min-content,
   because it's in the item's block dimension. (Blink legacy flex disagrees here)

3. Per https://drafts.csswg.org/css-flexbox/#min-size-auto, the used value of a
   main axis automatic minimum size on a flex item that is not a scroll container
   is a content-based minimum size.

4. The content-based min size of this item is min(content size suggestion,
   specified size suggestion). We ignore transferred size suggestion because
   this item has a specified size.

5. content size suggestion = 150, because 150 is the min-content size in the
   main axis.

6. specified size suggestion = 100px because that's what's specified.

7. So content-based min size = min(150, 100) = 100px. That becomes its flexed
   height (see #1).

8. Then, the item stretches its width to 100px. The item has an aspect ratio,
   so does the new width change the height? Not according to
   https://drafts.csswg.org/css-flexbox/#algo-stretch, which says "Note that
   this step does not affect the main size of the flex item, even if it has an
   intrinsic aspect ratio." The height remains 100px.

FF 77 gives the item height of 50px. It's probably due to a disagreement in #8;
I think FF applies the aspect ratio of the new stretched width to get a height.
But it might be a disagreement in #4.

Chrome <= 83 gives the item height 150 because it doesn't treat
min-height:min-content as min-height:auto. That makes the used min-height be
150px. That might change in Chrome 84 or 85 when FlexNG launches.

-->
<div style="display: flex; flex-direction: column; width:100px; height: 0px;">
  <img src="support/300x150-green.png" style="display: flex; min-height: min-content; height: 100px;" />
</div>