diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/web-platform/tests/css/css-grid/placement/grid-container-change-named-grid-recompute-child-positions-001.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-grid/placement/grid-container-change-named-grid-recompute-child-positions-001.html')
-rw-r--r-- | testing/web-platform/tests/css/css-grid/placement/grid-container-change-named-grid-recompute-child-positions-001.html | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-grid/placement/grid-container-change-named-grid-recompute-child-positions-001.html b/testing/web-platform/tests/css/css-grid/placement/grid-container-change-named-grid-recompute-child-positions-001.html new file mode 100644 index 0000000000..d702d30b3b --- /dev/null +++ b/testing/web-platform/tests/css/css-grid/placement/grid-container-change-named-grid-recompute-child-positions-001.html @@ -0,0 +1,84 @@ +<!DOCTYPE html> +<html> +<title>CSS Grid: Change named grid lines.</title> +<link rel="author" title="Julien Chaffraix" href="mailto:jchaffraix@chromium.org"/> +<link rel="help" href="https://drafts.csswg.org/css-grid/#placement"/> +<meta name="assert" content="Checks that updating the named grid lines definitions in grid-template-{rows|columns} recomputes the positions of automatically placed grid items."/> +<link rel="issue" href="https://crbug.com/248151"/> +<link href="/css/support/grid.css" rel="stylesheet"/> +<link href="/css/support/alignment.css" rel="stylesheet"> +<link rel="stylesheet" type="text/css" href="/fonts/ahem.css"/> +<style> +.grid { + grid-auto-flow: row dense; +} +#firstGridItem { + grid-row: auto; + grid-column: column; +} + +#secondGridItem { + grid-row: row; + grid-column: auto; +} + +#thirdGridItem { + grid-row: auto; + grid-column: auto; +} +</style> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/check-layout-th.js"></script> +<script> +function testGridDefinitions(gridTemplateRows, gridTemplateColumns, firstGridItemData, secondGridItemData, thirdGridItemData) +{ + var gridElement = document.getElementsByClassName("grid")[0]; + gridElement.style.gridTemplateRows = gridTemplateRows; + gridElement.style.gridTemplateColumns = gridTemplateColumns; + + var firstGridItem = document.getElementById("firstGridItem"); + firstGridItem.setAttribute("data-expected-width", firstGridItemData.width); + firstGridItem.setAttribute("data-expected-height", firstGridItemData.height); + firstGridItem.setAttribute("data-offset-x", firstGridItemData.x); + firstGridItem.setAttribute("data-offset-y", firstGridItemData.y); + + var secondGridItem = document.getElementById("secondGridItem"); + secondGridItem.setAttribute("data-expected-width", secondGridItemData.width); + secondGridItem.setAttribute("data-expected-height", secondGridItemData.height); + secondGridItem.setAttribute("data-offset-x", secondGridItemData.x); + secondGridItem.setAttribute("data-offset-y", secondGridItemData.y); + + var thirdGridItem = document.getElementById("thirdGridItem"); + thirdGridItem.setAttribute("data-expected-width", thirdGridItemData.width); + thirdGridItem.setAttribute("data-expected-height", thirdGridItemData.height); + thirdGridItem.setAttribute("data-offset-x", thirdGridItemData.x); + thirdGridItem.setAttribute("data-offset-y", thirdGridItemData.y); + + checkLayout(".grid", false); +} + +function testChangingGridDefinitions() +{ + testGridDefinitions('10px [row] 20px', '30px [column]', { 'width': '0', 'height': '10', 'x': '30', 'y': '0' }, { 'width': '30', 'height': '20', 'x': '0', 'y': '10' }, { 'width': '30', 'height': '10', 'x': '0', 'y': '0' }); + testGridDefinitions('10px [row] 20px', '30px', { 'width': '0', 'height': '10', 'x': '30', 'y': '0' }, { 'width': '30', 'height': '20', 'x': '0', 'y': '10' }, { 'width': '30', 'height': '10', 'x': '0', 'y': '0' }); + testGridDefinitions('10px 20px [row]', '30px', { 'width': '0', 'height': '10', 'x': '30', 'y': '0' }, { 'width': '30', 'height': '0', 'x': '0', 'y': '30' }, { 'width': '30', 'height': '10', 'x': '0', 'y': '0' }); + testGridDefinitions('10px 20px [row]', '30px [column]', { 'width': '0', 'height': '10', 'x': '30', 'y': '0' }, { 'width': '30', 'height': '0', 'x': '0', 'y': '30' }, { 'width': '30', 'height': '10', 'x': '0', 'y': '0' }); + done(); +} + +</script> +<script type="text/javascript"> + setup({ explicit_done: true }); +</script> +<body onload="document.fonts.ready.then(() => { testChangingGridDefinitions(); })"> +<div style="position: relative"> + <div class="grid justifyContentStart"> + <div class="sizedToGridArea" id="firstGridItem"></div> + <div class="sizedToGridArea" id="secondGridItem"></div> + <div class="sizedToGridArea" id="thirdGridItem"></div> + </div> +</div> + +</body> +</html> |