summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-grid/grid-definition/flex-content-resolution-rows-001.html
blob: d10b84014de8a3f599a9448b4f070719662685f7 (plain)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
<!DOCTYPE html>
<html>
<title>CSS Grid Layout Test: Auto repeat tracks, grid-template-rows and flexible lengths.</title>
<link rel="author" title="Julien Chaffraix" href="mailto:jchaffraix@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#track-sizes">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#fr-unit">
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=235258">
<link rel="stylesheet" href="/fonts/ahem.css">
<link rel="stylesheet" href="/css/support/grid.css">
<meta name="assert" content="Test that resolving auto tracks on grid items using <flex> values with grid-template-rows works properly." />

<style>
.gridFlexContent {
    grid-template-columns: 50px;
    grid-template-rows: 1fr 1fr;
}
.gridMaxFlexContent {
    grid-template-columns: 50px;
    grid-template-rows: minmax(30px, 2fr);
}
.gridTwoMaxFlexContent {
    grid-template-columns: 50px;
    grid-template-rows: minmax(10px, 1fr) minmax(10px, 2fr);
}
.gridTwoDoubleMaxFlexContent {
    grid-template-columns: 50px;
    grid-template-rows: minmax(10px, 0.5fr) minmax(10px, 2fr);
}
.gridRespectBaseSize {
    grid-template-columns: 50px;
    grid-template-rows: minmax(75px, 1fr) minmax(0px, 2fr);
}
.gridRespectProportions {
    grid-template-columns: 50px;
    grid-template-rows: minmax(25px, .25fr) minmax(0px, .5fr) minmax(0px, 2fr);
}
.gridRespectBaseSizeProportions {
    grid-template-columns: 50px;
    grid-template-rows: minmax(50px, .25fr) minmax(0px, .5fr) minmax(0px, 1fr);
}
.gridRespectBaseSizeBeforeProportions {
    grid-template-columns: 50px;
    grid-template-rows: minmax(50px, .25fr) minmax(0px, .5fr) minmax(0px, 1fr);
}
.thirdRowFirstColumn {
    background-color: yellow;
    grid-column: 1;
    grid-row: 3;
}
</style>

<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>
<script type="text/javascript">
  setup({ explicit_done: true });
</script>

<body onload="document.fonts.ready.then(() => { checkLayout('.grid'); })">

<div class="grid gridFlexContent constrainedContainer" style="position: relative;">
    <div class="sizedToGridArea firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="30">X<br>X<br>X</div>
    <div class="sizedToGridArea secondRowFirstColumn" data-offset-x="0" data-offset-y="30" data-expected-width="50" data-expected-height="50">X<br>X<br>X<br>X<br>X</div>
</div>

<div class="constrainedContainer">
    <div class="grid gridMaxFlexContent">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="30"></div>
    </div>
</div>

<!-- Allow the extra logical space distribution to occur. -->
<div style="width: 10px; height: 40px">
    <div class="grid gridMaxFlexContent" style="height: 100%;">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="40"></div>
    </div>
</div>

<div style="width: 10px; height: 40px">
    <div class="grid gridMaxFlexContent">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="30"></div>
    </div>
</div>

<div style="width: 10px; height: 100px;">
    <div class="grid gridMaxFlexContent" style="height: 100%;">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="100"></div>
    </div>
</div>

<div style="width: 10px; height: 100px;">
    <div class="grid gridMaxFlexContent">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="30"></div>
    </div>
</div>

<div class="constrainedContainer">
    <div class="grid gridTwoMaxFlexContent" style="height: 100%">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="10"></div>
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="10"></div>
    </div>
</div>

<div class="constrainedContainer">
    <div class="grid gridTwoMaxFlexContent">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="10"></div>
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="20"></div>
    </div>
</div>

<!-- Allow the extra logical space distribution to occur. -->
<div style="width: 10px; height: 60px">
    <div class="grid gridTwoMaxFlexContent" style="height: 100%">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="20"></div>
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="40"></div>
    </div>
</div>

<div style="width: 10px; height: 60px">
    <div class="grid gridTwoMaxFlexContent">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="10"></div>
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="20"></div>
    </div>
</div>

<div style="width: 10px; height: 120px;">
    <div class="grid gridTwoMaxFlexContent" style="height: 100%">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="40"></div>
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="80"></div>
    </div>
</div>

<div style="width: 10px; height: 120px;">
    <div class="grid gridTwoMaxFlexContent">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="10"></div>
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="20"></div>
    </div>
</div>

<div class="constrainedContainer">
    <div class="grid gridTwoDoubleMaxFlexContent" style="height: 100%">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="10"></div>
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="10"></div>
    </div>
</div>

<!-- We normalize fraction flex factors to 1, so we don't keep exact proportions with >1 factors. -->
<div class="constrainedContainer">
    <div class="grid gridTwoDoubleMaxFlexContent">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="10"></div>
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="20"></div>
    </div>
</div>

<!-- Allow the extra logical space distribution to occur. -->
<div style="width: 10px; height: 60px">
    <div class="grid gridTwoDoubleMaxFlexContent" style="height: 100%">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="12"></div>
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="48"></div>
    </div>
</div>

<!-- We normalize fraction flex factors to 1, so we don't keep exact proportions with >1 factors. -->
<div style="width: 10px; height: 60px">
    <div class="grid gridTwoDoubleMaxFlexContent">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="10"></div>
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="20"></div>
    </div>
</div>

<div style="width: 10px; height: 120px;">
    <div class="grid gridTwoDoubleMaxFlexContent" style="height: 100%">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="24"></div>
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="96"></div>
    </div>
</div>

<!-- We normalize fraction flex factors to 1, so we don't keep exact proportions with >1 factors. -->
<div style="width: 10px; height: 120px;">
    <div class="grid gridTwoDoubleMaxFlexContent">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="10"></div>
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="20"></div>
    </div>
</div>

<!-- Flex track length must be at least its baseSize. -->
<div style="width: 10px; height: 100px;">
    <div class="grid gridRespectBaseSize" style="height: 100%;">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="75"></div>
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="25"></div>
    </div>
</div>

<div style="width: 10px; height: 100px;">
    <div class="grid gridRespectBaseSize">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="75"></div>
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="150"></div>
    </div>
</div>

<!-- Flex track lengths must be proportional to their flex factors.. -->
<div style="width: 10px; height: 275px;">
    <div class="grid gridRespectProportions" style="height: 100%;">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="25"></div>
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="50"></div>
        <div class="sizedToGridArea thirdRowFirstColumn" data-expected-width="50" data-expected-height="200"></div>
    </div>
</div>

<div style="width: 10px; height: 275px;">
    <div class="grid gridRespectProportions">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="25"></div>
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="13"></div>
        <div class="sizedToGridArea thirdRowFirstColumn" data-expected-width="50" data-expected-height="50"></div>
    </div>
</div>

<!-- Flex track lengths must be proportional but still respecting their base sizes. -->
<div style="width: 10px; height: 350px;">
    <div class="grid gridRespectBaseSizeProportions" style="height: 100%;">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="50"></div>
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="100"></div>
        <div class="sizedToGridArea thirdRowFirstColumn" data-expected-width="50" data-expected-height="200"></div>
    </div>
</div>

<div style="width: 10px; height: 350px;">
    <div class="grid gridRespectBaseSizeProportions">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="50"></div>
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="25"></div>
        <div class="sizedToGridArea thirdRowFirstColumn" data-expected-width="50" data-expected-height="50"></div>
    </div>
</div>

<!-- Not enough space to respect proportions, because minTrackBreadh it's a harder requirement -->
<div style="width: 10px; height: 275px;">
    <div class="grid gridRespectBaseSizeBeforeProportions" style="height: 100%;">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="50"></div>
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="75"></div>
        <div class="sizedToGridArea thirdRowFirstColumn" data-expected-width="50" data-expected-height="150"></div>
    </div>
</div>

<div style="width: 10px; height: 275px;">
    <div class="grid gridRespectBaseSizeBeforeProportions">
        <div class="sizedToGridArea firstRowFirstColumn" data-expected-width="50" data-expected-height="50"></div>
        <div class="sizedToGridArea secondRowFirstColumn" data-expected-width="50" data-expected-height="25"></div>
        <div class="sizedToGridArea thirdRowFirstColumn" data-expected-width="50" data-expected-height="50"></div>
    </div>
</div>

</body>
</html>