Skip to content

Truly independent web browser

Tests/LibWeb: Import grid WPT tests with fractional item offsets

Andreas Kling735d4a0b2a62
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-grid/abspos/grid-sizing-positioned-items-001.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-grid/abspos/grid-sizing-positioned-items-001.txt
new file mode 100644
index 00000000000..491a7ad8f0c
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-grid/abspos/grid-sizing-positioned-items-001.txt
@@ -0,0 +1,14 @@
+Harness status: OK
+
+Found 8 tests
+
+7 Pass
+1 Fail
+Pass .grid 1
+Pass .grid 2
+Pass .grid 3
+Pass .grid 4
+Pass .grid 5
+Pass .grid 6
+Fail .grid 7
+Pass .grid 8
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-grid/alignment/grid-content-alignment-second-pass-002.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-grid/alignment/grid-content-alignment-second-pass-002.txt
new file mode 100644
index 00000000000..491a7ad8f0c
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-grid/alignment/grid-content-alignment-second-pass-002.txt
@@ -0,0 +1,14 @@
+Harness status: OK
+
+Found 8 tests
+
+7 Pass
+1 Fail
+Pass .grid 1
+Pass .grid 2
+Pass .grid 3
+Pass .grid 4
+Pass .grid 5
+Pass .grid 6
+Fail .grid 7
+Pass .grid 8
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-grid/alignment/grid-self-alignment-positioned-items-with-margin-border-padding-016.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-grid/alignment/grid-self-alignment-positioned-items-with-margin-border-padding-016.txt
new file mode 100644
index 00000000000..ab17fce13de
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-grid/alignment/grid-self-alignment-positioned-items-with-margin-border-padding-016.txt
@@ -0,0 +1,10 @@
+Harness status: OK
+
+Found 4 tests
+
+3 Pass
+1 Fail
+Pass .grid 1
+Fail .grid 2
+Pass .grid 3
+Pass .grid 4
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-grid/abspos/grid-sizing-positioned-items-001.html b/Tests/LibWeb/Text/input/wpt-import/css/css-grid/abspos/grid-sizing-positioned-items-001.html
new file mode 100644
index 00000000000..b12065aade3
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-grid/abspos/grid-sizing-positioned-items-001.html
@@ -0,0 +1,204 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Grid sizing positioned items</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos" title="9. Absolute Positioning">
+<meta name="assert" content="This test checks the different size options for absolutely positioned grid items.">
+<link rel="stylesheet" href="../../../fonts/ahem.css">
+<link href="../../../css/support/grid.css" rel="stylesheet">
+<style>
+
+.grid {
+ grid-template-columns: 100px 200px;
+ grid-template-rows: 50px 150px;
+ width: 100%;
+ height: 100%;
+ border: 5px solid black;
+ margin: 30px;
+ padding: 15px;
+ /* Ensures that the grid container is the containing block of the absolutely positioned grid children. */
+ position: relative;
+}
+
+.absolute {
+ position: absolute;
+}
+
+.lengthSize {
+ width: 50px;
+ height: 20px;
+}
+
+.percentageSize {
+ width: 50%;
+ height: 20%;
+}
+
+.offsets {
+ left: 5px;
+ right: 10px;
+ top: 15px;
+ bottom: 20px;
+}
+
+.onlyFirstRowOnlyFirstColumn {
+ background-color: blue;
+ grid-column: 1 / 2;
+ grid-row: 1 / 2;
+}
+
+.endSecondRowEndSecondColumn {
+ background-color: orange;
+ grid-column-end: 3;
+ grid-row-end: 3;
+}
+
+</style>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../resources/check-layout-th.js"></script>
+<script type="text/javascript">
+ setup({ explicit_done: true });
+</script>
+
+<body onload="document.fonts.ready.then(() => { checkLayout('.grid'); })">
+
+<div id="log"></div>
+
+<div class="unconstrainedContainer">
+ <div class="grid">
+ <div class="absolute autoRowAutoColumn sizedToGridArea"
+ data-offset-x="0" data-offset-y="0" data-expected-width="1030" data-expected-height="1030">
+ </div>
+ <div class="absolute secondRowSecondColumn sizedToGridArea"
+ data-offset-x="115" data-offset-y="65" data-expected-width="915" data-expected-height="965">
+ </div>
+ <div class="absolute onlyFirstRowOnlyFirstColumn sizedToGridArea"
+ data-offset-x="15" data-offset-y="15" data-expected-width="100" data-expected-height="50">
+ </div>
+ <div class="absolute endSecondRowEndSecondColumn sizedToGridArea"
+ data-offset-x="0" data-offset-y="0" data-expected-width="315" data-expected-height="215">
+ </div>
+ </div>
+</div>
+
+<div class="unconstrainedContainer">
+ <div class="grid">
+ <div class="absolute autoRowAutoColumn lengthSize"
+ data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="20">
+ </div>
+ <div class="absolute secondRowSecondColumn lengthSize"
+ data-offset-x="115" data-offset-y="65" data-expected-width="50" data-expected-height="20">
+ </div>
+ <div class="absolute onlyFirstRowOnlyFirstColumn lengthSize"
+ data-offset-x="15" data-offset-y="15" data-expected-width="50" data-expected-height="20">
+ </div>
+ <div class="absolute endSecondRowEndSecondColumn lengthSize"
+ data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="20">
+ </div>
+ </div>
+</div>
+
+<div class="unconstrainedContainer">
+ <div class="grid">
+ <div class="absolute autoRowAutoColumn percentageSize"
+ data-offset-x="0" data-offset-y="0" data-expected-width="515" data-expected-height="206">
+ </div>
+ <div class="absolute secondRowSecondColumn percentageSize"
+ data-offset-x="115" data-offset-y="65" data-expected-width="457.5" data-expected-height="193">
+ </div>
+ <div class="absolute onlyFirstRowOnlyFirstColumn percentageSize"
+ data-offset-x="15" data-offset-y="15" data-expected-width="50" data-expected-height="10">
+ </div>
+ <div class="absolute endSecondRowEndSecondColumn percentageSize"
+ data-offset-x="0" data-offset-y="0" data-expected-width="157.5" data-expected-height="43">
+ </div>
+ </div>
+</div>
+
+<div class="unconstrainedContainer">
+ <div class="grid">
+ <div class="absolute autoRowAutoColumn offsets"
+ data-offset-x="5" data-offset-y="15" data-expected-width="1015" data-expected-height="995">
+ </div>
+ <div class="absolute secondRowSecondColumn offsets"
+ data-offset-x="120" data-offset-y="80" data-expected-width="900" data-expected-height="930">
+ </div>
+ <div class="absolute onlyFirstRowOnlyFirstColumn offsets"
+ data-offset-x="20" data-offset-y="30" data-expected-width="85" data-expected-height="15">
+ </div>
+ <div class="absolute endSecondRowEndSecondColumn offsets"
+ data-offset-x="5" data-offset-y="15" data-expected-width="300" data-expected-height="180">
+ </div>
+ </div>
+</div>
+
+<div class="unconstrainedContainer">
+ <div class="grid directionRTL">
+ <div class="absolute autoRowAutoColumn sizedToGridArea"
+ data-offset-x="0" data-offset-y="0" data-expected-width="1030" data-expected-height="1030">
+ </div>
+ <div class="absolute secondRowSecondColumn sizedToGridArea"
+ data-offset-x="0" data-offset-y="65" data-expected-width="915" data-expected-height="965">
+ </div>
+ <div class="absolute onlyFirstRowOnlyFirstColumn sizedToGridArea"
+ data-offset-x="915" data-offset-y="15" data-expected-width="100" data-expected-height="50">
+ </div>
+ <div class="absolute endSecondRowEndSecondColumn sizedToGridArea"
+ data-offset-x="715" data-offset-y="0" data-expected-width="315" data-expected-height="215">
+ </div>
+ </div>
+</div>
+
+<div class="unconstrainedContainer">
+ <div class="grid directionRTL">
+ <div class="absolute autoRowAutoColumn lengthSize"
+ data-offset-x="980" data-offset-y="0" data-expected-width="50" data-expected-height="20">
+ </div>
+ <div class="absolute secondRowSecondColumn lengthSize"
+ data-offset-x="865" data-offset-y="65" data-expected-width="50" data-expected-height="20">
+ </div>
+ <div class="absolute onlyFirstRowOnlyFirstColumn lengthSize"
+ data-offset-x="965" data-offset-y="15" data-expected-width="50" data-expected-height="20">
+ </div>
+ <div class="absolute endSecondRowEndSecondColumn lengthSize"
+ data-offset-x="980" data-offset-y="0" data-expected-width="50" data-expected-height="20">
+ </div>
+ </div>
+</div>
+
+<div class="unconstrainedContainer">
+ <div class="grid directionRTL">
+ <div class="absolute autoRowAutoColumn percentageSize"
+ data-offset-x="515" data-offset-y="0" data-expected-width="515" data-expected-height="206">
+ </div>
+ <div class="absolute secondRowSecondColumn percentageSize"
+ data-offset-x="457.5" data-offset-y="65" data-expected-width="457.5" data-expected-height="193">
+ </div>
+ <div class="absolute onlyFirstRowOnlyFirstColumn percentageSize"
+ data-offset-x="965" data-offset-y="15" data-expected-width="50" data-expected-height="10">
+ </div>
+ <div class="absolute endSecondRowEndSecondColumn percentageSize"
+ data-offset-x="873" data-offset-y="0" data-expected-width="157.5" data-expected-height="43">
+ </div>
+ </div>
+</div>
+
+<div class="unconstrainedContainer">
+ <div class="grid directionRTL">
+ <div class="absolute autoRowAutoColumn offsets"
+ data-offset-x="5" data-offset-y="15" data-expected-width="1015" data-expected-height="995">
+ </div>
+ <div class="absolute secondRowSecondColumn offsets"
+ data-offset-x="5" data-offset-y="80" data-expected-width="900" data-expected-height="930">
+ </div>
+ <div class="absolute onlyFirstRowOnlyFirstColumn offsets"
+ data-offset-x="920" data-offset-y="30" data-expected-width="85" data-expected-height="15">
+ </div>
+ <div class="absolute endSecondRowEndSecondColumn offsets"
+ data-offset-x="720" data-offset-y="15" data-expected-width="300" data-expected-height="180">
+ </div>
+ </div>
+</div>
+
+</body>
diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-grid/alignment/grid-content-alignment-second-pass-002.html b/Tests/LibWeb/Text/input/wpt-import/css/css-grid/alignment/grid-content-alignment-second-pass-002.html
new file mode 100644
index 00000000000..d4c1638539e
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-grid/alignment/grid-content-alignment-second-pass-002.html
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Content alignment second pass</title>
+<link rel="author" title="Manuel Rego Casasnovas" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#grid-align">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#algo-overview">
+<meta name="flags" content="ahem dom">
+<meta name="assert" content="This test checks that content alignment is properly applied when the size of the tracks changes in the second pass of the track sizing algorithm.">
+<link rel="stylesheet" href="../../../css/support/grid.css">
+<link rel="stylesheet" href="../../support/alignment.css">
+
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<style>
+.grid {
+ position: relative;
+ font: 20px/1 Ahem;
+ margin: 10px;
+ display: inline-grid;
+ grid: 50% / 70%;
+}
+</style>
+
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../resources/check-layout-th.js"></script>
+<script type="text/javascript">
+ setup({ explicit_done: true });
+</script>
+
+<body onload="document.fonts.ready.then(() => { checkLayout('.grid'); })">
+
+<div id="log"></div>
+
+<div class="grid" data-expected-width="100" data-expected-height="40">
+ <div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="70" data-expected-height="20">XXX X</div>
+</div>
+
+<div class="grid contentStretch" data-expected-width="100" data-expected-height="40">
+ <div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="70" data-expected-height="20">XXX X</div>
+</div>
+
+<div class="grid contentStart" data-expected-width="100" data-expected-height="40">
+ <div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="70" data-expected-height="20">XXX X</div>
+</div>
+
+<div class="grid contentCenter" data-expected-width="100" data-expected-height="40">
+ <div class="firstRowFirstColumn" data-offset-x="15" data-offset-y="10" data-expected-width="70" data-expected-height="20">XXX X</div>
+</div>
+
+<div class="grid contentEnd" data-expected-width="100" data-expected-height="40">
+ <div class="firstRowFirstColumn" data-offset-x="30" data-offset-y="20" data-expected-width="70" data-expected-height="20">XXX X</div>
+</div>
+
+<div class="grid contentSpaceBetween" data-expected-width="100" data-expected-height="60">
+ <div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="70" data-expected-height="30">XXX X</div>
+ <div class="secondRowFirstColumn" data-offset-x="0" data-offset-y="40" data-expected-width="70" data-expected-height="20">X</div>
+</div>
+
+<div class="grid contentSpaceEvenly" style="grid-template-rows: 30%;" data-expected-width="100" data-expected-height="80">
+ <div class="firstRowFirstColumn" data-offset-x="15" data-offset-y="5" data-expected-width="70" data-expected-height="24">XXX X</div>
+ <div class="secondRowFirstColumn" data-offset-x="15" data-offset-y="35" data-expected-width="70" data-expected-height="40">X<br>X</div>
+</div>
+
+<div class="grid contentSpaceAround" style="grid-template-rows: 25%;" data-expected-width="100" data-expected-height="80">
+ <div class="firstRowFirstColumn" data-offset-x="15" data-offset-y="5" data-expected-width="70" data-expected-height="20">XXX X</div>
+ <div class="secondRowFirstColumn" data-offset-x="15" data-offset-y="35" data-expected-width="70" data-expected-height="40">X<br>X</div>
+</div>
+
+</body>
diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-grid/alignment/grid-self-alignment-positioned-items-with-margin-border-padding-016.html b/Tests/LibWeb/Text/input/wpt-import/css/css-grid/alignment/grid-self-alignment-positioned-items-with-margin-border-padding-016.html
new file mode 100644
index 00000000000..d29de746486
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-grid/alignment/grid-self-alignment-positioned-items-with-margin-border-padding-016.html
@@ -0,0 +1,112 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Grid Layout Test: Self-Alignment of absolute positioned items with 'auto' grid positions and margin, border and padding</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#column-align">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#abspos-items">
+<link rel="help" href="https://drafts.csswg.org/css-grid-1/#augmented-grid">
+<link rel="help" href="https://drafts.csswg.org/css-align-3/#propdef-justify-self">
+<link rel="help" href="https://drafts.csswg.org/css-align-3/#propdef-align-self">
+<meta name="assert" content="Absolute positioned grid items alignment works as expected when the grid and its items have margins, borders and paddings.">
+<link rel="stylesheet" type="text/css" href="../../../fonts/ahem.css" />
+<style>
+.grid {
+ position: relative;
+ display: inline-grid;
+ grid-template-columns: 100px 150px;
+ grid-template-rows: 150px 100px;
+ font: 10px/1 Ahem;
+ background: grey;
+ justify-content: center;
+}
+.grid.LTR, .grid.RTL { width: 450px; }
+.grid.verticalLR, .grid.verticalRL { height: 450px; }
+.grid > div { position: absolute; }
+.grid > :nth-child(1) { background: green; }
+.grid > :nth-child(2) { background: blue; }
+.grid > :nth-child(3) { background: yellow; }
+.grid > :nth-child(4) { background: red; }
+
+.grid {
+ margin: 4px 2px 8px 3px;
+ padding: 1px 4px 2px 3px;
+ border-color: silver;
+ border-style: solid;
+ border-width: 5px 6px 4px 8px;
+}
+
+.grid > div {
+ margin: 2px 4px 6px 8px;
+ padding: 3px 2px 4px 5px;
+ border-color: silver;
+ border-style: solid;
+ border-width: 1px 6px 2px 3px;
+}
+
+.LTR { direction: ltr; }
+.RTL { direction: rtl; }
+.verticalLR { writing-mode: vertical-lr; }
+.verticalRL { writing-mode: vertical-rl; }
+
+.firstRowFirstColumn {
+ grid-row: 1 / 2;
+ grid-column: auto / 1;
+ align-self: start;
+ justify-self: right;
+}
+.firstRowSecondColumn {
+ grid-row: 1 / 2;
+ grid-column: 2 / auto;
+ align-self: end;
+ justify-self: center;
+}
+.secondRowFirstColumn {
+ grid-row: 2 / 3;
+ grid-column: auto / auto;
+ align-self: center;
+ justify-self: self-start;
+}
+.secondRowSecondColumn {
+ grid-row: 2 / 3;
+ grid-column: 1 / 2;
+ align-self: self-end;
+ justify-self: left;
+}
+</style>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script src="../../../resources/check-layout-th.js"></script>
+<script type="text/javascript">
+ setup({ explicit_done: true });
+</script>
+<body onload="document.fonts.ready.then(() => { checkLayout('.grid'); })">
+<div class="grid LTR">
+ <div data-offset-x="23" data-offset-y="3" data-expected-width="76" data-expected-height="20" class="firstRowFirstColumn">X XX X</div>
+ <div data-offset-x="289" data-offset-y="105" data-expected-width="86" data-expected-height="40" class="firstRowSecondColumn">XX X<br>X XXX X<br>XX XXX</div>
+ <div data-offset-x="8" data-offset-y="189" data-expected-width="76" data-expected-height="20" class="secondRowFirstColumn">X XX X</div>
+ <div data-offset-x="111" data-offset-y="195" data-expected-width="76" data-expected-height="50" class="secondRowSecondColumn">XX X<br>X XXX<br>X<br>XX XXX</div>
+</div>
+
+<div class="grid RTL">
+ <div data-offset-x="377" data-offset-y="3" data-expected-width="76" data-expected-height="20" class="firstRowFirstColumn">X XX X</div>
+ <div data-offset-x="86" data-offset-y="105" data-expected-width="86" data-expected-height="40" class="firstRowSecondColumn">XX X<br>X XXX X<br>XX XXX</div>
+ <div data-offset-x="377" data-offset-y="189" data-expected-width="76" data-expected-height="20" class="secondRowFirstColumn">X XX X</div>
+ <div data-offset-x="261" data-offset-y="195" data-expected-width="76" data-expected-height="50" class="secondRowSecondColumn">XX X<br>X XXX<br>X<br>XX XXX</div>
+</div>
+
+<br><br>
+
+<div class="grid verticalLR">
+ <div data-offset-x="11" data-offset-y="25" data-expected-width="26" data-expected-height="70" class="firstRowFirstColumn">X XX X</div>
+ <div data-offset-x="103" data-offset-y="285" data-expected-width="46" data-expected-height="80" class="firstRowSecondColumn">XX X<br>X XXX X<br>XX XXX</div>
+ <div data-offset-x="192" data-offset-y="2" data-expected-width="26" data-expected-height="70" class="secondRowFirstColumn">X XX X</div>
+ <div data-offset-x="193" data-offset-y="103" data-expected-width="56" data-expected-height="70" class="secondRowSecondColumn">XX X<br>X XXX<br>X<br>XX XXX</div>
+</div>
+
+<div class="grid verticalRL">
+ <div data-offset-x="223" data-offset-y="25" data-expected-width="26" data-expected-height="70" class="firstRowFirstColumn">X XX X</div>
+ <div data-offset-x="111" data-offset-y="285" data-expected-width="46" data-expected-height="80" class="firstRowSecondColumn">XX X<br>X XXX X<br>XX XXX</div>
+ <div data-offset-x="42" data-offset-y="2" data-expected-width="26" data-expected-height="70" class="secondRowFirstColumn">X XX X</div>
+ <div data-offset-x="11" data-offset-y="103" data-expected-width="56" data-expected-height="70" class="secondRowSecondColumn">XX X<br>X XXX<br>X<br>XX XXX</div>
+</div>
+</body>