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
|
<!doctype html>
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<link rel='stylesheet' href='./support/base.css' />
<link rel="help" href="https://drafts.csswg.org/css-tables-3/#missing-cells-fixup">
<link rel="help" href="https://drafts.csswg.org/css-tables-3/#dimensioning-the-row-column-grid">
<main>
<h1>HTML5 Table Formatting algorithm (row/column grid computation)</h1>
<p>Verifies how browsers deal with implicit tracks from which no cell does originate</p>
<hr/>
<p>This should be a 100px by 100px blue square:</p>
<p>The table grid is 1x1, so the table is not empty and follows step 3A of the table layout algorithm (which adds anonymous cell boxes)</p>
<p>The consecutive tracks were merged together because they are not all defined explicitely by a table-column or a table-row, and share the same set of cells</p>
<p>Two 25px border-spacing causes the addition of 50px (track is 50x50)</p>
<x-table style="background: blue; border-spacing: 25px">
<x-tr><x-td style="padding: 25px"></x-td></x-tr>
</x-table>
<hr/>
<p>This should be a 100px by 100px blue square:</p>
<p>The table grid is 1x1, so the table is not empty and follows step 3A of the table layout algorithm (which adds anonymous cell boxes)</p>
<p>The consecutive tracks were merged together because they are not all defined explicitely by a table-column or a table-row, and share the same set of cells</p>
<p>Two 25px border-spacing causes the addition of 50px (track is 50x50)</p>
<x-table style="background: blue; border-spacing: 25px">
<x-tr><x-td style="padding: 25px" rowspan=2 colspan=2></x-td></x-tr>
</x-table>
<hr/>
<p>This should be a 75px by 75px blue square:</p>
<p>The table grid is 2x2, so the table is not empty and follows step 3A of the table layout algorithm (which adds anonymous cell boxes)</p>
<p>The consecutive tracks were not merged together because they are all defined explicitely by a table-column or a table-row</p>
<p>Three 25px border-spacing causes the addition of 75px (tracks are 0x0)</p>
<x-table style="background: blue; border-spacing: 25px">
<x-col></x-col>
<x-col></x-col>
<x-tr><x-td style="padding: 0px" rowspan=2 colspan=2></x-td></x-tr>
<x-tr></x-tr>
</x-table>
<hr/>
<p>This should be a 100px by 100px blue square:</p>
<p>The table grid is 2x2, so the table is not empty and follows step 3A of the table layout algorithm (which adds anonymous cell boxes)</p>
<p>The consecutive tracks were not merged together because they are all defined explicitely by a table-column or a table-row</p>
<p>Three 25px border-spacing causes the addition of 75px (tracks are 12.5x12.5)</p>
<x-table style="background: blue; border-spacing: 25px">
<x-col></x-col>
<x-col></x-col>
<x-tr><x-td style="padding: 25px" rowspan=2 colspan=2></x-td></x-tr>
<x-tr></x-tr>
</x-table>
</main>
<script>
while(true) {
var xtd = document.querySelector('x-td[rowspan], x-td[colspan]'); if(!xtd) break;
var td = document.createElement('td'); for(var i = xtd.attributes.length; i--;) { td.setAttribute(xtd.attributes[i].name,xtd.attributes[i].value) }
xtd.parentNode.replaceChild(td,xtd);
}
document.body.onload = () => {
generate_tests(assert_equals, [
[
"Control test for table-cell padding and border-spacing, etc (width)",
document.querySelector("x-table:nth-of-type(1)").offsetWidth,
100
],
[
"Control test for table-cell padding and border-spacing (height)",
document.querySelector("x-table:nth-of-type(1)").offsetHeight,
100
],
[
"Anonymous consecutive columns spanned by the same set of cells are merged",
document.querySelector("x-table:nth-of-type(2)").offsetWidth,
100
],
[
"Anonymous consecutive rows spanned by the same set of cells are merged",
document.querySelector("x-table:nth-of-type(2)").offsetHeight,
100
],
[
"Explicitely-defined consecutive columns spanned by the same set of cells are not merged",
document.querySelector("x-table:nth-of-type(3)").offsetWidth,
75
],
[
"Explicitely-defined consecutive rows spanned by the same set of cells are not merged",
document.querySelector("x-table:nth-of-type(3)").offsetHeight,
75
],
[
"Explicitely-defined consecutive columns spanned by the same set of cells are not merged, and cells span across border-spacing",
document.querySelector("x-table:nth-of-type(4) x-col").getBoundingClientRect().width,
12.5
],
[
"Explicitely-defined consecutive rows spanned by the same set of cells are not merged, and cells span across border-spacing",
document.querySelector("x-table:nth-of-type(4) x-tr").getBoundingClientRect().height,
12.5
],
])
}
</script>
|