summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-grid/abspos/absolute-positioning-grid-container-containing-block-001.html
blob: 0e52b19997b3e7c587d3f697c9bcb9aae246d779 (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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Grid Layout Test: Absolute positioning grid container containing block</title>
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
<meta name="assert" content="This test checks the behavior of the absolutely positioned elements with a grid container as containing block.">
<link rel="stylesheet" href="/fonts/ahem.css">
<link rel="stylesheet" href="/css/support/grid.css">
<style>

.grid {
  grid-template-columns: 50px 100px 150px 200px;
  grid-template-rows: 50px 100px 150px 200px;
  width: 500px;
  height: 500px;
  border: 5px solid black;
  margin: 30px;
  padding: 15px;
  /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
  position: relative;
}

.absolute {
  position: absolute;
}

.thirdRowThirdColumnSpanning2Rows {
  grid-column: 3;
  grid-row: 3 / span 2;
  background-color: maroon;
}

.thirdRowThirdColumnSpanning2Rows2Columns {
  grid-column: 3 / span 2;
  grid-row: 3 / span 2;
  background-color: aqua;
}

.endFirstRowEndFirstColumn {
  background-color: blue;
  grid-column-end: 2;
  grid-row-end: 2;
}

.endFirstRowEndSecondColumn {
  background-color: lime;
  grid-column-end: 3;
  grid-row-end: 2;
}

.endSecondRowEndFirstColumn {
  background-color: purple;
  grid-column-end: 2;
  grid-row-end: 3;
}

.endThirdRowEndThirdColumnSpanning2Rows {
  grid-column-end: 4;
  grid-row: span 2 / 4;
  background-color: maroon;
}

.endThirdRowEndThirdColumnSpanning2Rows2Columns {
  grid-column: span 2 / 4;
  grid-row: span 2 / 4;
  background-color: aqua;
}

.onlyThirdRowOnlyThirdColumnSpanning2Rows {
  grid-column: 3 / 4;
  grid-row: 3 / 5;
  background-color: maroon;
}

.onlyThirdRowOnlyThirdColumnSpanning2Rows2Columns {
  grid-column: 3 / 5;
  grid-row: 3 / 5;
  background-color: aqua;
}

.offsetLeft25 {
  left: 25px;
}

.offsetRight50 {
  right: 50px;
}

.offsetTop75 {
  top: 75px;
}

.offsetBottom100 {
  bottom: 100px;
}

.offsetLeftMinus20 {
  left: -20px;
}

.offsetRightMinus40 {
  right: -40px;
}

.offsetTopMinus60 {
  top: -60px;
}

.offsetBottomMinus80 {
  bottom: -80px;
}

</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 id="log"></div>

<div class="grid">
  <div class="sizedToGridArea absolute autoRowAutoColumn"
    data-offset-x="0" data-offset-y="0" data-expected-width="530" data-expected-height="530">
  </div>
  <div class="sizedToGridArea absolute firstRowFirstColumn"
    data-offset-x="15" data-offset-y="15" data-expected-width="515" data-expected-height="515">
  </div>
  <div class="sizedToGridArea absolute secondRowFirstColumn"
    data-offset-x="15" data-offset-y="65" data-expected-width="515" data-expected-height="465">
  </div>
  <div class="sizedToGridArea absolute firstRowSecondColumn"
    data-offset-x="65" data-offset-y="15" data-expected-width="465" data-expected-height="515">
  </div>
  <div class="sizedToGridArea absolute secondRowSecondColumn"
    data-offset-x="65" data-offset-y="65" data-expected-width="465" data-expected-height="465">
  </div>
  <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows"
    data-offset-x="165" data-offset-y="165" data-expected-width="365" data-expected-height="350">
  </div>
  <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows2Columns"
    data-offset-x="165" data-offset-y="165" data-expected-width="350" data-expected-height="350">
  </div>
</div>

<div class="grid">
  <div class="sizedToGridArea absolute endThirdRowEndThirdColumnSpanning2Rows"
    data-offset-x="0" data-offset-y="65" data-expected-width="315" data-expected-height="250">
  </div>
  <div class="sizedToGridArea absolute endThirdRowEndThirdColumnSpanning2Rows2Columns"
    data-offset-x="65" data-offset-y="65" data-expected-width="250" data-expected-height="250">
  </div>
  <div class="sizedToGridArea absolute endSecondRowEndSecondColumn"
    data-offset-x="0" data-offset-y="0" data-expected-width="165" data-expected-height="165">
  </div>
  <div class="sizedToGridArea absolute endSecondRowEndFirstColumn"
    data-offset-x="0" data-offset-y="0" data-expected-width="65" data-expected-height="165">
  </div>
  <div class="sizedToGridArea absolute endFirstRowEndSecondColumn"
    data-offset-x="0" data-offset-y="0" data-expected-width="165" data-expected-height="65">
  </div>
  <div class="sizedToGridArea absolute endFirstRowEndFirstColumn"
    data-offset-x="0" data-offset-y="0" data-expected-width="65" data-expected-height="65">
  </div>
</div>

<div class="grid">
  <div class="sizedToGridArea absolute onlyFirstRowOnlyFirstColumn"
    data-offset-x="15" data-offset-y="15" data-expected-width="50" data-expected-height="50">
  </div>
  <div class="sizedToGridArea absolute onlySecondRowOnlyFirstColumn"
    data-offset-x="15" data-offset-y="65" data-expected-width="50" data-expected-height="100">
  </div>
  <div class="sizedToGridArea absolute onlyFirstRowOnlySecondColumn"
    data-offset-x="65" data-offset-y="15" data-expected-width="100" data-expected-height="50">
  </div>
  <div class="sizedToGridArea absolute onlySecondRowOnlySecondColumn"
    data-offset-x="65" data-offset-y="65" data-expected-width="100" data-expected-height="100">
  </div>
  <div class="sizedToGridArea absolute onlyThirdRowOnlyThirdColumnSpanning2Rows2Columns"
    data-offset-x="165" data-offset-y="165" data-expected-width="350" data-expected-height="350">
  </div>
  <div class="sizedToGridArea absolute onlyThirdRowOnlyThirdColumnSpanning2Rows"
    data-offset-x="165" data-offset-y="165" data-expected-width="150" data-expected-height="350">
  </div>
</div>

<div class="grid">
  <div class="sizedToGridArea absolute autoRowAutoColumn offsetLeft25 offsetTop75"
    data-offset-x="25" data-offset-y="75" data-expected-width="530" data-expected-height="530">
  </div>
  <div class="sizedToGridArea absolute firstRowFirstColumn offsetRightMinus40 offsetBottomMinus80"
    data-offset-x="55" data-offset-y="95" data-expected-width="515" data-expected-height="515">
  </div>
  <div class="sizedToGridArea absolute secondRowFirstColumn offsetRight50 offsetBottom100"
    data-offset-x="-35" data-offset-y="-35" data-expected-width="515" data-expected-height="465">
  </div>
  <div class="sizedToGridArea absolute firstRowSecondColumn offsetLeftMinus20 offsetTopMinus60"
    data-offset-x="45" data-offset-y="-45" data-expected-width="465" data-expected-height="515">
  </div>
  <div class="sizedToGridArea absolute secondRowSecondColumn offsetRight50 offsetTop75"
    data-offset-x="15" data-offset-y="140" data-expected-width="465" data-expected-height="465">
  </div>
  <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows offsetLeft25 offsetBottom100"
    data-offset-x="190" data-offset-y="65" data-expected-width="365" data-expected-height="350">
  </div>
  <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows2Columns offsetLeftMinus20 offsetRight50 offsetTopMinus60 offsetBottom100"
    data-offset-x="145" data-offset-y="105" data-expected-width="350" data-expected-height="350">
  </div>
</div>

<div class="grid">
  <div>
    <div class="sizedToGridArea absolute autoRowAutoColumn offsetLeft25 offsetTop75"
      data-offset-x="25" data-offset-y="75" data-expected-width="530" data-expected-height="530">
    </div>
    <div class="sizedToGridArea absolute firstRowFirstColumn offsetRightMinus40 offsetBottomMinus80"
      data-offset-x="55" data-offset-y="95" data-expected-width="515" data-expected-height="515">
    </div>
    <div class="sizedToGridArea absolute secondRowFirstColumn offsetRight50 offsetBottom100"
      data-offset-x="-35" data-offset-y="-35" data-expected-width="515" data-expected-height="465">
    </div>
    <div class="sizedToGridArea absolute firstRowSecondColumn offsetLeftMinus20 offsetTopMinus60"
      data-offset-x="45" data-offset-y="-45" data-expected-width="465" data-expected-height="515">
    </div>
    <div class="sizedToGridArea absolute secondRowSecondColumn offsetRight50 offsetTop75"
      data-offset-x="15" data-offset-y="140" data-expected-width="465" data-expected-height="465">
    </div>
    <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows offsetLeft25 offsetBottom100"
      data-offset-x="190" data-offset-y="65" data-expected-width="365" data-expected-height="350">
    </div>
    <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows2Columns offsetLeftMinus20 offsetRight50 offsetTopMinus60 offsetBottom100"
      data-offset-x="145" data-offset-y="105" data-expected-width="350" data-expected-height="350">
    </div>
  </div>
</div>

<div class="grid directionRTL">
  <div class="sizedToGridArea absolute autoRowAutoColumn"
    data-offset-x="0" data-offset-y="0" data-expected-width="530" data-expected-height="530">
  </div>
  <div class="sizedToGridArea absolute firstRowFirstColumn"
    data-offset-x="0" data-offset-y="15" data-expected-width="515" data-expected-height="515">
  </div>
  <div class="sizedToGridArea absolute secondRowFirstColumn"
    data-offset-x="0" data-offset-y="65" data-expected-width="515" data-expected-height="465">
  </div>
  <div class="sizedToGridArea absolute firstRowSecondColumn"
    data-offset-x="0" data-offset-y="15" data-expected-width="465" data-expected-height="515">
  </div>
  <div class="sizedToGridArea absolute secondRowSecondColumn"
    data-offset-x="0" data-offset-y="65" data-expected-width="465" data-expected-height="465">
  </div>
  <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows"
    data-offset-x="0" data-offset-y="165" data-expected-width="365" data-expected-height="350">
  </div>
  <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows2Columns"
    data-offset-x="15" data-offset-y="165" data-expected-width="350" data-expected-height="350">
  </div>
</div>

<div class="grid directionRTL">
  <div class="sizedToGridArea absolute endThirdRowEndThirdColumnSpanning2Rows"
    data-offset-x="215" data-offset-y="65" data-expected-width="315" data-expected-height="250">
  </div>
  <div class="sizedToGridArea absolute endThirdRowEndThirdColumnSpanning2Rows2Columns"
    data-offset-x="215" data-offset-y="65" data-expected-width="250" data-expected-height="250">
  </div>
  <div class="sizedToGridArea absolute endSecondRowEndSecondColumn"
    data-offset-x="365" data-offset-y="0" data-expected-width="165" data-expected-height="165">
  </div>
  <div class="sizedToGridArea absolute endSecondRowEndFirstColumn"
    data-offset-x="465" data-offset-y="0" data-expected-width="65" data-expected-height="165">
  </div>
  <div class="sizedToGridArea absolute endFirstRowEndSecondColumn"
    data-offset-x="365" data-offset-y="0" data-expected-width="165" data-expected-height="65">
  </div>
  <div class="sizedToGridArea absolute endFirstRowEndFirstColumn"
    data-offset-x="465" data-offset-y="0" data-expected-width="65" data-expected-height="65">
  </div>
</div>

<div class="grid directionRTL">
  <div class="sizedToGridArea absolute onlyFirstRowOnlyFirstColumn"
    data-offset-x="465" data-offset-y="15" data-expected-width="50" data-expected-height="50">
  </div>
  <div class="sizedToGridArea absolute onlySecondRowOnlyFirstColumn"
    data-offset-x="465" data-offset-y="65" data-expected-width="50" data-expected-height="100">
  </div>
  <div class="sizedToGridArea absolute onlyFirstRowOnlySecondColumn"
    data-offset-x="365" data-offset-y="15" data-expected-width="100" data-expected-height="50">
  </div>
  <div class="sizedToGridArea absolute onlySecondRowOnlySecondColumn"
    data-offset-x="365" data-offset-y="65" data-expected-width="100" data-expected-height="100">
  </div>
  <div class="sizedToGridArea absolute onlyThirdRowOnlyThirdColumnSpanning2Rows2Columns"
    data-offset-x="15" data-offset-y="165" data-expected-width="350" data-expected-height="350">
  </div>
  <div class="sizedToGridArea absolute onlyThirdRowOnlyThirdColumnSpanning2Rows"
    data-offset-x="215" data-offset-y="165" data-expected-width="150" data-expected-height="350">
  </div>
</div>

<div class="grid directionRTL">
  <div class="sizedToGridArea absolute autoRowAutoColumn offsetLeft25 offsetTop75"
    data-offset-x="25" data-offset-y="75" data-expected-width="530" data-expected-height="530">
  </div>
  <div class="sizedToGridArea absolute firstRowFirstColumn offsetRightMinus40 offsetBottomMinus80"
    data-offset-x="40" data-offset-y="95" data-expected-width="515" data-expected-height="515">
  </div>
  <div class="sizedToGridArea absolute secondRowFirstColumn offsetRight50 offsetBottom100"
    data-offset-x="-50" data-offset-y="-35" data-expected-width="515" data-expected-height="465">
  </div>
  <div class="sizedToGridArea absolute firstRowSecondColumn offsetLeftMinus20 offsetTopMinus60"
    data-offset-x="-20" data-offset-y="-45" data-expected-width="465" data-expected-height="515">
  </div>
  <div class="sizedToGridArea absolute secondRowSecondColumn offsetRight50 offsetTop75"
    data-offset-x="-50" data-offset-y="140" data-expected-width="465" data-expected-height="465">
  </div>
  <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows offsetLeft25 offsetBottom100"
    data-offset-x="25" data-offset-y="65" data-expected-width="365" data-expected-height="350">
  </div>
  <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows2Columns offsetLeftMinus20 offsetRight50 offsetTopMinus60 offsetBottom100"
    data-offset-x="-35" data-offset-y="105" data-expected-width="350" data-expected-height="350">
  </div>
</div>

<div class="grid directionRTL">
  <div>
    <div class="sizedToGridArea absolute autoRowAutoColumn offsetLeft25 offsetTop75"
      data-offset-x="25" data-offset-y="75" data-expected-width="530" data-expected-height="530">
    </div>
    <div class="sizedToGridArea absolute firstRowFirstColumn offsetRightMinus40 offsetBottomMinus80"
      data-offset-x="40" data-offset-y="95" data-expected-width="515" data-expected-height="515">
    </div>
    <div class="sizedToGridArea absolute secondRowFirstColumn offsetRight50 offsetBottom100"
      data-offset-x="-50" data-offset-y="-35" data-expected-width="515" data-expected-height="465">
    </div>
    <div class="sizedToGridArea absolute firstRowSecondColumn offsetLeftMinus20 offsetTopMinus60"
      data-offset-x="-20" data-offset-y="-45" data-expected-width="465" data-expected-height="515">
    </div>
    <div class="sizedToGridArea absolute secondRowSecondColumn offsetRight50 offsetTop75"
      data-offset-x="-50" data-offset-y="140" data-expected-width="465" data-expected-height="465">
    </div>
    <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows offsetLeft25 offsetBottom100"
      data-offset-x="25" data-offset-y="65" data-expected-width="365" data-expected-height="350">
    </div>
    <div class="sizedToGridArea absolute thirdRowThirdColumnSpanning2Rows2Columns offsetLeftMinus20 offsetRight50 offsetTopMinus60 offsetBottom100"
      data-offset-x="-35" data-offset-y="105" data-expected-width="350" data-expected-height="350">
    </div>
  </div>
</div>

</body>