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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
<!DOCTYPE html>
<html>
<title>CSS aspect-ratio: Test flex item's resolved height/min-height with border-box box-sizing in a column flex container</title>
<link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com">
<link rel="author" title="Mozilla" href="https://www.mozilla.org/">
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#aspect-ratio">
<link rel="help" href="https://drafts.csswg.org/css-sizing-4/#aspect-ratio-minimum">
<link rel="help" href="https://drafts.csswg.org/css-flexbox-1/#min-size-auto">
<link rel="match" href="../../reference/ref-filled-green-200px-square.html" />
<style>
.flexContainer {
display: flex;
flex-direction: column;
float: left;
height: 1px;
}
.item {
background: green;
padding-left: 15px;
padding-top: 10px;
box-sizing: border-box;
}
.item > div {
height: 190px; /* Set the content size suggestion for flex item. */
}
</style>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<!-- In all of the subtests here, each flex item's automatic minimum height is
resolved directly from its content size suggestion. Notably, these items
*do not* get a "transferred size suggestion", because they are all
*non-replaced* elements; and "transferred size suggestion" is only used
for resolving automatic minimum sizes on *replaced* elements. However,
note that we do "transfer" sizes through the aspect ratio, as part of
computing the content size suggestion and/or flex base size. -->
<!-- In the following four flex containers, the aspect-ratio works with border-box. -->
<div class="flexContainer" style="height: auto;">
<!-- The border-box width 25px is transferred to the main axis,
yielding a resolved flex base size (border-box) of 200px. -->
<div class="item" style="min-height:0; width: 25px; aspect-ratio: 1/8;"><div></div></div>
</div>
<div class="flexContainer">
<!-- The content size suggestion is 190px, i.e. the height of the item's
child div. -->
<div class="item" style="width: 25px; aspect-ratio: 1/1;"><div></div></div>
</div>
<div class="flexContainer">
<!-- The content size suggestion is 190px, i.e. the height of the item's
child div. -->
<div class="item" style="min-width: 25px; aspect-ratio: 1/1;"><div></div></div>
</div>
<div class="flexContainer">
<!-- The content size suggestion is 200px because the border-box max-width
25px is transferred to the main axis as the upper bound of its
border-box height. -->
<div class="item" style="max-width: 25px; width: 100px; aspect-ratio: 1/8;">
<div style="height: 500px"></div>
</div>
</div>
<!-- In the following four flex containers, the aspect-ratio works with content-box
because its value contains 'auto'. -->
<div class="flexContainer" style="height: auto;">
<!-- The content-box width 10px is transferred to the main axis,
yielding a resolved flex base size (content-box) of 190px. -->
<div class="item" style="min-height:0; width: 25px; aspect-ratio: auto 1/19;"><div></div></div>
</div>
<div class="flexContainer">
<!-- The content size suggestion is 190px, i.e. the height of the item's
child div. -->
<div class="item" style="width: 25px; aspect-ratio: auto 1/1;"><div></div></div>
</div>
<div class="flexContainer">
<!-- The content size suggestion is 190px, i.e. the height of the item's
child div. -->
<div class="item" style="min-width: 25px; aspect-ratio: auto 1/1;"><div></div></div>
</div>
<div class="flexContainer">
<!-- The content size suggestion is 190px because the content-box max-width
10px is transferred to the main axis as the upper bound of its
content-box height.-->
<div class="item" style="max-width: 25px; width: 100px; aspect-ratio: auto 1/19;">
<div style="height: 500px"></div>
</div>
</div>
</html>
|