diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
commit | da4c7e7ed675c3bf405668739c3012d140856109 (patch) | |
tree | cdd868dba063fecba609a1d819de271f0d51b23e /testing/web-platform/tests/css/css-grid | |
parent | Adding upstream version 125.0.3. (diff) | |
download | firefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip |
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-grid')
6 files changed, 185 insertions, 21 deletions
diff --git a/testing/web-platform/tests/css/css-grid/grid-fragmentation-between-rows-001-print-ref.tentative.html b/testing/web-platform/tests/css/css-grid/grid-fragmentation-between-rows-001-print-ref.tentative.html new file mode 100644 index 0000000000..78464712c5 --- /dev/null +++ b/testing/web-platform/tests/css/css-grid/grid-fragmentation-between-rows-001-print-ref.tentative.html @@ -0,0 +1,20 @@ +<!DOCTYPE html> +<div style="height:40vh"> + Test passes if there is two purple boxes on both page 1 and page 2 in print mode. (Ctrl+P, with "print backgrounds" enabled) +</div> +<div style="display:grid; grid-template-columns:1fr 1fr;"> + <div style="contain:size; height:40vh;"> + <div style="height:40vh; width: 20vw; background:purple;"></div> + </div> + <div style="contain:size; height:40vh;"> + <div style="height:40vh; width: 20vw; background:purple;"></div> + </div> +</div> +<div style="display:grid; grid-template-columns:1fr 1fr; break-before:page;"> + <div style="contain:size; height:40vh;"> + <div style="height:40vh; width: 20vw; background:purple;"></div> + </div> + <div style="contain:size; height:40vh;"> + <div style="height:40vh; width: 20vw; background:purple;"></div> + </div> +</div> diff --git a/testing/web-platform/tests/css/css-grid/grid-fragmentation-between-rows-001-print.tentative.html b/testing/web-platform/tests/css/css-grid/grid-fragmentation-between-rows-001-print.tentative.html new file mode 100644 index 0000000000..01fd97528f --- /dev/null +++ b/testing/web-platform/tests/css/css-grid/grid-fragmentation-between-rows-001-print.tentative.html @@ -0,0 +1,21 @@ +<!DOCTYPE html> +<link rel="author" title="Psychpsyo" href="mailto:psychpsyo@gmail.com"> +<link rel="help" href="https://www.w3.org/TR/css-grid-1/#pagination"> +<link rel="match" href="./grid-fragmentation-between-rows-001-print-ref.tentative.html"> +<div style="height: 40vh"> + Test passes if there is two purple boxes on both page 1 and page 2 in print mode. (Ctrl+P, with "print backgrounds" enabled) +</div> +<div style="display: grid; grid-template-columns: 1fr 1fr;"> + <div style="contain:size; height:40vh;"> + <div style="height:40vh; width: 20vw; background:purple;"></div> + </div> + <div style="contain:size; height:40vh;"> + <div style="height:40vh; width: 20vw; background:purple;"></div> + </div> + <div style="contain:size; height:40vh;"> + <div style="height:40vh; width: 20vw; background:purple;"></div> + </div> + <div style="contain:size; height:40vh;"> + <div style="height:40vh; width: 20vw; background:purple;"></div> + </div> +</div> diff --git a/testing/web-platform/tests/css/css-grid/layout-algorithm/grid-fit-content-percentage.html b/testing/web-platform/tests/css/css-grid/layout-algorithm/grid-fit-content-percentage.html index ab55502487..892dbe40b4 100644 --- a/testing/web-platform/tests/css/css-grid/layout-algorithm/grid-fit-content-percentage.html +++ b/testing/web-platform/tests/css/css-grid/layout-algorithm/grid-fit-content-percentage.html @@ -36,26 +36,30 @@ function clamp(value, min, max) { } const minContent = 50; const maxContent = 100; -for (const percentage of [0, 50, 75, 100, 150]) { - const container = document.createElement("div"); - container.className = "container"; - document.body.appendChild(container); - const grid = document.createElement("div"); - grid.className = "grid"; - grid.style.gridTemplateColumns = `fit-content(${percentage}%)`; - container.appendChild(grid); - const item = document.createElement("div"); - item.className = "item"; - grid.appendChild(item); - test(function() { - const colSize = clamp(percentage * maxContent / 100, minContent, maxContent); - const height = colSize < maxContent ? maxContent : minContent; - assert_equals(item.offsetWidth, colSize, "Grid item width"); - assert_equals(item.offsetHeight, height, "Grid item height"); - assert_equals(grid.offsetWidth, maxContent, "Grid container width"); - assert_equals(grid.offsetHeight, height, "Grid container height"); - assert_equals(getComputedStyle(grid).gridTemplateColumns, colSize + "px", - "Grid column size"); - }, `fit-content(${percentage}%)`); +for (const use_calc of [false, true]) { + for (const percentage of [0, 50, 75, 100, 150]) { + const value = use_calc ? `fit-content(calc(0px + ${percentage}%))` + : `fit-content(${percentage}%)`; + const container = document.createElement("div"); + container.className = "container"; + document.body.appendChild(container); + const grid = document.createElement("div"); + grid.className = "grid"; + grid.style.gridTemplateColumns = value; + container.appendChild(grid); + const item = document.createElement("div"); + item.className = "item"; + grid.appendChild(item); + test(function() { + const colSize = clamp(percentage * maxContent / 100, minContent, maxContent); + const height = colSize < maxContent ? maxContent : minContent; + assert_equals(item.offsetWidth, colSize, "Grid item width"); + assert_equals(item.offsetHeight, height, "Grid item height"); + assert_equals(grid.offsetWidth, maxContent, "Grid container width"); + assert_equals(grid.offsetHeight, height, "Grid container height"); + assert_equals(getComputedStyle(grid).gridTemplateColumns, colSize + "px", + "Grid column size"); + }, value); + } } </script> diff --git a/testing/web-platform/tests/css/css-grid/subgrid/placement-invalidation-001.html b/testing/web-platform/tests/css/css-grid/subgrid/placement-invalidation-001.html new file mode 100644 index 0000000000..954880e996 --- /dev/null +++ b/testing/web-platform/tests/css/css-grid/subgrid/placement-invalidation-001.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>CSS Grid Test: Subgridded item placement invalidation</title> +<link rel="author" title="Ethan Jimenez" href="mailto:ethavar@microsoft.com"> +<link rel="help" href="https://drafts.csswg.org/css-grid-2/#track-sizing"> +<style> +html, body { + margin: 0; + padding: 0; +} +#grid { + width: 200px; + display: grid; + background: lightgray; + grid-template-columns: [start] auto [end] 1fr; + grid-template-rows: 100px; +} +#subgrid { + display: grid; + grid-column: 1 / -1; + grid-template-columns: subgrid; +} +#item { + width: 50px; + background: lightblue; + border: 5px solid gray; + grid-column: start / end; +} +</style> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/check-layout-th.js"></script> +<div id="grid"> + <div id="subgrid"> + <div id="item" data-offset-x="140"></div> + </div> +</div> +<script> +"use strict"; + +let grid = document.getElementById("grid"); +let item = document.getElementById("item"); + +// Computing an offset forces layout. +let item_offset = item.offsetLeft; + +grid.style.gridTemplateColumns = "1fr [start] auto [end]"; +item_offset = item.offsetLeft; +checkLayout("#item"); +</script> diff --git a/testing/web-platform/tests/css/css-grid/subgrid/subgrid-button-ref.html b/testing/web-platform/tests/css/css-grid/subgrid/subgrid-button-ref.html new file mode 100644 index 0000000000..b6b5e6115c --- /dev/null +++ b/testing/web-platform/tests/css/css-grid/subgrid/subgrid-button-ref.html @@ -0,0 +1,33 @@ +<!doctype html> +<meta charset="utf-8"> +<title>CSS test reference</title> +<style> +.grid { + display: grid; + width: 400px; + grid-template-columns: auto auto 1fr; + background-color: #ccc; +} +.button { + display: grid; + grid-template-columns: subgrid; + grid-column: span 3; + text-align: initial; + + background: transparent; + padding: 5px 10px; + margin: 0; + border: 2px solid; + font: inherit; +} +.right { + text-align: right; +} +</style> +<div class="grid"> + <div class="button"> + <span>hello</span> + <span>,</span> + <span class="right">world</span> + </div> +</div> diff --git a/testing/web-platform/tests/css/css-grid/subgrid/subgrid-button.html b/testing/web-platform/tests/css/css-grid/subgrid/subgrid-button.html new file mode 100644 index 0000000000..774702238f --- /dev/null +++ b/testing/web-platform/tests/css/css-grid/subgrid/subgrid-button.html @@ -0,0 +1,36 @@ +<!doctype html> +<meta charset="utf-8"> +<link rel="help" href="https://drafts.csswg.org/css-grid-2/#subgrids"> +<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1887867"> +<link rel="match" href="subgrid-button-ref.html"> +<title>Button subgrid</title> +<style> +.grid { + display: grid; + width: 400px; + grid-template-columns: auto auto 1fr; + background-color: #ccc; +} +.button { + display: grid; + grid-template-columns: subgrid; + grid-column: span 3; + text-align: initial; + + background: transparent; + padding: 5px 10px; + margin: 0; + border: 2px solid; + font: inherit; +} +.right { + text-align: right; +} +</style> +<div class="grid"> + <button class="button"> + <span>hello</span> + <span>,</span> + <span class="right">world</span> + </button> +</div> |