blob: f32e2dd39c03b4a38f859944aae371c68518d5f9 [file] [log] [blame]
<!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>