summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-tables/fixed-layout-1.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/css/css-tables/fixed-layout-1.html
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-tables/fixed-layout-1.html')
-rw-r--r--testing/web-platform/tests/css/css-tables/fixed-layout-1.html90
1 files changed, 90 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-tables/fixed-layout-1.html b/testing/web-platform/tests/css/css-tables/fixed-layout-1.html
new file mode 100644
index 0000000000..3e0d013af1
--- /dev/null
+++ b/testing/web-platform/tests/css/css-tables/fixed-layout-1.html
@@ -0,0 +1,90 @@
+<!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/#width-distribution-in-fixed-mode">
+<main>
+
+ <h1>Fixed Layout</h1>
+ <p>Checks whether fixed layout is implemented properly</p>
+
+ <hr/>
+ <p>This should be a 100px-wide blue square:</p>
+ <p>Width is distributed equally between columns of auto size</p>
+ <x-table style="table-layout: fixed; width: 200px; border-spacing: 0px">
+ <x-tr>
+ <x-td style="padding: 0; background: blue; height: 100px;"></x-td>
+ <x-td style="padding: 0"></x-td>
+ </x-tr>
+ </x-table>
+
+ <hr/>
+ <p>This should be a 100px-wide blue square:</p>
+ <p>Width is distributed equally between columns of auto size (even if they are defined by rows other than the first)</p>
+ <x-table style="table-layout: fixed; width: 200px; border-spacing: 0px">
+ <x-tr><x-td style="padding: 0; background: blue; height: 100px;"></x-td></x-tr>
+ <x-tr><x-td style="padding: 0; height: 0px"></x-td><x-td style="padding: 0"></x-td></x-tr>
+ </x-table>
+
+ <hr/>
+ <p>This should be a 100px-wide blue square:</p>
+ <p>Widths defined on cells that are not the first row are ignored</p>
+ <x-table style="table-layout: fixed; width: 200px; border-spacing: 0px">
+ <x-tr><x-td style="padding: 0; background: blue; height: 100px;"></x-td></x-tr>
+ <x-tr><x-td style="padding: 0; height: 0px; width: 200px;"></x-td><x-td style="padding: 0; width: 200px;"></x-td></x-tr>
+ </x-table>
+
+ <hr/>
+ <p>This should be a 100px-wide blue square:</p>
+ <p>The table has to grow to contain the widths defined for its columns</p>
+ <x-table style="table-layout: fixed; width: 50px; border-spacing: 0px">
+ <x-tr><x-td style="padding: 0; background: blue; height: 100px; width: 100px;"></x-td></x-tr>
+ <x-tr><x-td style="padding: 0; height: 0px"></x-td><x-td style="padding: 0"></x-td></x-tr>
+ </x-table>
+
+ <hr/>
+ <p>This should be a 100px-wide blue square:</p>
+ <p>The first row is based on the visual order, not the dom order</p>
+ <x-table style="table-layout: fixed; width: 100px; border-spacing: 0px">
+ <x-tr><x-td style="padding: 0; height: 0px"></x-td><x-td style="padding: 0"></x-td></x-tr>
+ <x-thead><x-tr><x-td style="padding: 0; background: blue; height: 100px; width: 100px;"></x-td></x-tr></x-thead>
+ </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);
+ }
+
+ generate_tests(assert_equals, [
+ [
+ "Table-layout:fixed distributes width equally to all auto-columns",
+ document.querySelector("x-table:nth-of-type(1) > x-tr:first-child > x-td:first-child").offsetWidth,
+ 100
+ ],
+ [
+ "Table-layout:fixed deals with columns generated by subsequent rows",
+ document.querySelector("x-table:nth-of-type(2) > x-tr:first-child > x-td:first-child").offsetWidth,
+ 100
+ ],
+ [
+ "Table-layout:fixed ignores sizes specified by subsequent rows",
+ document.querySelector("x-table:nth-of-type(3) > x-tr:first-child > x-td:first-child").offsetWidth,
+ 100
+ ],
+ [
+ "Table-layout:fixed grows the table if needed for minimum-width",
+ document.querySelector("x-table:nth-of-type(4) > x-tr:first-child > x-td:first-child").offsetWidth,
+ 100
+ ],
+ [
+ "Table-layout:fixed takes visual order into account, not dom order",
+ document.querySelector("x-table:nth-of-type(5) > x-tr:first-child > x-td:first-child").offsetWidth,
+ 100
+ ],
+ ])
+
+</script>