Bug 1673469 [wpt PR 26293] - Port two css-grid test files to WPT, a=testonly

Automatic update from web-platform-tests
Port two css-grid test files to WPT

The test that fails in Chromium related to calc() serialization is due to:
https://bugs.chromium.org/p/chromium/issues/detail?id=1050968

The test that fails in Firefox related to resolving percentage grid rows is due to:
https://bugzilla.mozilla.org/show_bug.cgi?id=1481876

BUG=767015

R=jfernandez@igalia.com

Change-Id: Ie219396d0e62181056ddf6c84b7b60f8251aeb43
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2436821
Commit-Queue: Ziran Sun <zsun@igalia.com>
Reviewed-by: Oriol Brufau <obrufau@igalia.com>
Reviewed-by: Javier Fernandez <jfernandez@igalia.com>
Reviewed-by: Manuel Rego <rego@igalia.com>
Cr-Commit-Position: refs/heads/master@{#823932}

--

wpt-commits: 7a287c9e26fbc12c91e1dde91859fabed96254b6
wpt-pr: 26293
This commit is contained in:
Ziran Sun 2020-11-05 14:20:03 +00:00 коммит произвёл moz-wptsync-bot
Родитель dc145d14b4
Коммит 8392c44b01
2 изменённых файлов: 708 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,322 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="author" title="Julien Chaffraix" href="mailto:jchaffraix@webkit.org">
<link rel="help" href="https://bugs.webkit.org/show_bug.cgi?id=73272">
<link href="/css/support/width-keyword-classes.css" rel="stylesheet">
<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">
<link rel="help" href="https://drafts.csswg.org/css-grid/#track-sizing">
<meta name="assert" content="Test that setting and getting multiple grid-template-columns and grid-template-rows works as expected">
<style>
/* Give an explicit size to the grid so that percentage grid tracks have a consistent resolution. */
.definite {
width: 800px;
height: 600px;
}
.gridItem {
grid-column: 1;
grid-row: 1;
width: 7px;
height: 16px;
}
.gridItem2 {
grid-column: 2;
grid-row: 2;
width: 17px;
height: 3px;
}
.gridWithFixed {
grid-template-columns: 7px 11px;
grid-template-rows: 17px 2px;
}
.gridWithPercent {
grid-template-columns: 50% 100%;
grid-template-rows: 25% 75%;
}
.gridWithAuto {
grid-template-columns: auto auto;
grid-template-rows: auto auto;
}
.gridWithEM {
grid-template-columns: 10em 12em;
grid-template-rows: 15em 17em;
font: 10px Ahem;
}
.gridWithNoneAndAuto {
grid-template-columns: none auto;
grid-template-rows: none auto;
}
.gridNoneWithAndFixed {
grid-template-columns: none 15px;
grid-template-rows: none 22px;
}
.gridWithThreeItems {
grid-template-columns: 15px auto 10em;
grid-template-rows: 12em 18px auto;
font: 10px Ahem;
}
.gridWithFitContentAndFitAvailable {
grid-template-columns: -webkit-content-available;
grid-template-rows: -webkit-fit-content -webkit-fit-available;
}
.gridWithMinMaxContent {
grid-template-columns: min-content max-content;
grid-template-rows: max-content min-content;
}
.gridWithMinMaxAndFixed {
grid-template-columns: minmax(45px, 30%) 15px;
grid-template-rows: 12em minmax(35%, 10px);
font: 10px Ahem;
}
.gridWithMinMaxAndMinMaxContent {
grid-template-columns: minmax(min-content, 30%) 15px;
grid-template-rows: 12em minmax(35%, max-content);
font: 10px Ahem;
}
.gridWithFractionFraction {
grid-template-columns: 2fr 3fr;
grid-template-rows: 3fr 5fr;
}
.gridWithFractionMinMax {
grid-template-columns: minmax(min-content, 45px) 2fr;
grid-template-rows: 3fr minmax(14px, max-content);
}
.gridWithCalcCalc {
grid-template-columns: calc(200px) calc(10em);
grid-template-rows: calc(15em) calc(75px);
font: 10px Ahem;
}
.gridWithCalcAndFixed {
grid-template-columns: calc(50%) 8em;
grid-template-rows: 88px calc(25%);
font: 10px Ahem;
}
.gridWithCalcAndMinMax {
grid-template-columns: calc(30px + 20%) minmax(min-content, 80px);
grid-template-rows: minmax(25%, max-content) calc(10% - 7px);
}
.gridWithCalcInsideMinMax {
grid-template-columns: minmax(calc(23px + 10%), 400px) 12em;
grid-template-rows: calc(150px) minmax(5%, calc(50% - 125px));
font: 10px Ahem;
}
.gridWithAutoInsideMinMax {
grid-template-columns: minmax(auto, min-content) 30px;
grid-template-rows: calc(100px + 2em) minmax(10%, auto);
}
</style>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div class="grid definite gridWithFixed" id="gridWithFixedElement"></div>
<div class="grid definite gridWithPercent" id="gridWithPercentElement"></div>
<div class="grid min-content gridWithPercent" id="gridWithPercentWithoutSize">
<div class="gridItem"></div>
</div>
<div class="grid definite gridWithAuto contentStart" id="gridWithAutoElement">
<div class="gridItem2"></div>
</div>
<div class="grid definite gridWithEM" id="gridWithEMElement"></div>
<div class="grid definite gridWithNoneAndAuto" id="gridWithNoneAndAuto"></div>
<div class="grid definite gridWithNoneAndFixed" id="gridWithNoneAndFixed"></div>
<div class="grid definite gridWithThreeItems contentStart" id="gridWithThreeItems"></div>
<div class="grid definite gridWithFitContentAndFitAvailable" id="gridWithFitContentAndFitAvailable"></div>
<div class="grid definite gridWithMinMaxContent" id="gridWithMinMaxContent"></div>
<div class="grid definite gridWithMinMaxContent" id="gridWithMinMaxContentWithChildrenElement">
<div class="gridItem"></div>
<div class="gridItem2"></div>
</div>
<div class="grid definite gridWithMinMaxAndFixed" id="gridWithMinMaxAndFixed"></div>
<div class="grid definite gridWithMinMaxAndMinMaxContent" id="gridWithMinMaxAndMinMaxContent"></div>
<div class="grid definite gridWithFractionFraction" id="gridWithFractionFraction"></div>
<div class="grid definite gridWithFractionMinMax" id="gridWithFractionMinMax"></div>
<div class="grid definite gridWithCalcCalc" id="gridWithCalcCalc"></div>
<div class="grid definite gridWithCalcAndFixed" id="gridWithCalcAndFixed"></div>
<div class="grid definite gridWithCalcAndMinMax" id="gridWithCalcAndMinMax"></div>
<div class="grid definite gridWithCalcInsideMinMax" id="gridWithCalcInsideMinMax"></div>
<div class="grid definite gridWithAutoInsideMinMax contentStart" id="gridWithAutoInsideMinMax"></div>
<script>
function testGridDefinitionsValues(id, columnValue, rowValue)
{
test(function(){
var element = document.getElementById(id);
var readColumnValue = getComputedStyle(element).gridTemplateColumns;
var readRowValue = getComputedStyle(element).gridTemplateRows;
assert_equals(readColumnValue, columnValue);
assert_equals(readRowValue, rowValue);
}, `Test getting grid-template-columns and grid-template-rows set through CSS for element '${id}' : grid-template-columns = '${columnValue}', grid-template-rows = '${rowValue}'`);
}
function testGridDefinitionsSetJSValues(
columnValue,
rowValue,
computedColumnValue = columnValue,
computedRowValue = rowValue,
jsColumnValue = columnValue,
jsRowValue = rowValue)
{
test(function(){
window.element = document.createElement("div");
document.body.appendChild(element);
element.style.display = "grid";
element.style.width = "800px";
element.style.height = "600px";
element.style.justifyContent = "start";
element.style.alignContent = "start";
element.style.font = "10px Ahem"; // Used to resolve em font consistently.
element.style.gridTemplateColumns = columnValue;
element.style.gridTemplateRows = rowValue;
assert_equals(getComputedStyle(element).gridTemplateColumns, computedColumnValue);
assert_equals(element.style.gridTemplateColumns, jsColumnValue);
assert_equals(getComputedStyle(element).gridTemplateRows, computedRowValue);
assert_equals(element.style.gridTemplateRows, jsRowValue);
document.body.removeChild(element);
}, `Test getting and setting grid-template-rows and grid-template-columns through JS: grid-template-columns = '${computedColumnValue}', element.style.gridTemplateColumns = '${columnValue}', grid-template-rows = '${computedRowValue}', element.style.gridTemplateRows = '${rowValue}'`);
}
function testGridDefinitionsSetBadJSValues(columnValue, rowValue)
{
test(function(){
window.element = document.createElement("div");
document.body.appendChild(element);
element.style.gridTemplateColumns = columnValue;
element.style.gridTemplateRows = rowValue;
assert_equals(getComputedStyle(element).gridTemplateColumns, "none");
assert_equals(getComputedStyle(element).gridTemplateRows, "none");
document.body.removeChild(element);
}, `Test setting bad JS values: grid-template-columns = '${columnValue}', grid-template-rows = '${rowValue}'`);
}
function testDefaultValue()
{
test(function(){
var element = document.createElement("div");
document.body.appendChild(element);
assert_equals(getComputedStyle(element).gridTemplateColumns, "none");
assert_equals(getComputedStyle(element).gridTemplateRows, "none");
document.body.removeChild(element);
}, `Test the default value`);
}
function testWrongCSSValue()
{
test(function(){
var gridWithNoneAndAuto = document.getElementById("gridWithNoneAndAuto");
assert_equals(getComputedStyle(gridWithNoneAndAuto).gridTemplateColumns, "none");
assert_equals(getComputedStyle(gridWithNoneAndAuto).gridTemplateRows, "none");
var gridWithNoneAndFixed = document.getElementById("gridWithNoneAndFixed");
assert_equals(getComputedStyle(gridWithNoneAndFixed).gridTemplateColumns, "none");
assert_equals(getComputedStyle(gridWithNoneAndFixed).gridTemplateRows, "none");
}, `Test setting wrong/invalid values through CSS`);
}
function testInherit()
{
test(function(){
var parentElement = document.createElement("div");
document.body.appendChild(parentElement);
parentElement.style.display = "grid";
parentElement.style.width = "800px";
parentElement.style.height = "600px";
parentElement.style.font = "10px Ahem"; // Used to resolve em font consistently.
parentElement.style.gridTemplateColumns = "50px 1fr [last]";
parentElement.style.gridTemplateRows = "2em [middle] 45px";
assert_equals(getComputedStyle(parentElement).gridTemplateColumns, "50px 750px [last]");
assert_equals(getComputedStyle(parentElement).gridTemplateRows, "20px [middle] 45px");
element = document.createElement("div");
parentElement.appendChild(element);
element.style.display = "grid";
element.style.gridTemplateColumns = "inherit";
element.style.gridTemplateRows = "inherit";
assert_equals(getComputedStyle(element).gridTemplateColumns, "50px 0px [last]");
assert_equals(getComputedStyle(element).gridTemplateRows, "20px [middle] 45px");
document.body.removeChild(parentElement);
}, `Test setting grid-template-columns and grid-template-rows to 'inherit' through JS`);
}
function testInitial()
{
test(function(){
element = document.createElement("div");
document.body.appendChild(element);
element.style.display = "grid";
element.style.width = "800px";
element.style.height = "600px";
element.style.gridTemplateColumns = "150% [middle] 55px";
element.style.gridTemplateRows = "1fr [line] 2fr [line]";
assert_equals(getComputedStyle(element).gridTemplateColumns, "1200px [middle] 55px");
assert_equals(getComputedStyle(element).gridTemplateRows, "200px [line] 400px [line]");
element.style.gridTemplateColumns = "initial";
element.style.gridTemplateRows = "initial";
assert_equals(getComputedStyle(element).gridTemplateColumns, "none");
assert_equals(getComputedStyle(element).gridTemplateRows, "none");
document.body.removeChild(element);
}, `Test setting grid-template-columns and grid-template-rows to 'initial' through JS`);
}
setup({ explicit_done: true });
document.fonts.ready.then(() => {
testGridDefinitionsValues("gridWithFixedElement", "7px 11px", "17px 2px");
testGridDefinitionsValues("gridWithPercentElement", "400px 800px", "150px 450px");
// This test failing in Firefox is caused by https://bugzilla.mozilla.org/show_bug.cgi?id=1481876
testGridDefinitionsValues("gridWithPercentWithoutSize", "3.5px 7px", "4px 12px");
testGridDefinitionsValues("gridWithAutoElement", "0px 17px", "0px 3px");
testGridDefinitionsValues("gridWithEMElement", "100px 120px", "150px 170px");
testGridDefinitionsValues("gridWithThreeItems", "15px 0px 100px", "120px 18px 0px");
testGridDefinitionsValues("gridWithFitContentAndFitAvailable", "none", "none");
testGridDefinitionsValues("gridWithMinMaxContent", "0px 0px", "0px 0px");
testGridDefinitionsValues("gridWithMinMaxContentWithChildrenElement", "7px 17px", "16px 3px");
testGridDefinitionsValues("gridWithMinMaxAndFixed", "240px 15px", "120px 210px");
testGridDefinitionsValues("gridWithMinMaxAndMinMaxContent", "240px 15px", "120px 210px");
testGridDefinitionsValues("gridWithFractionFraction", "320px 480px", "225px 375px");
testGridDefinitionsValues("gridWithFractionMinMax", "45px 755px", "586px 14px");
testGridDefinitionsValues("gridWithCalcCalc", "200px 100px", "150px 75px");
testGridDefinitionsValues("gridWithCalcAndFixed", "400px 80px", "88px 150px");
testGridDefinitionsValues("gridWithCalcAndMinMax", "190px 80px", "150px 53px");
testGridDefinitionsValues("gridWithCalcInsideMinMax", "400px 120px", "150px 175px");
testGridDefinitionsValues("gridWithAutoInsideMinMax", "0px 30px", "132px 60px");
testGridDefinitionsSetJSValues("18px 22px", "66px 70px");
testGridDefinitionsSetJSValues("55% 80%", "40% 63%", "440px 640px", "240px 378px");
testGridDefinitionsSetJSValues("auto auto", "auto auto", "0px 0px", "0px 0px");
testGridDefinitionsSetJSValues("auto 16em 22px", "56% 10em auto", "0px 160px 22px", "336px 100px 0px");
testGridDefinitionsSetJSValues("16em minmax(16px, 20px)", "minmax(10%, 15%) auto", "160px 20px", "90px 0px");
testGridDefinitionsSetJSValues("16em 2fr", "14fr auto", "160px 640px", "600px 0px");
testGridDefinitionsSetJSValues("calc(25px) calc(2em)", "auto calc(10%)", "25px 20px", "0px 60px", "calc(25px) calc(2em)", "auto calc(10%)");
// This test failing in Chromium is caused by https://bugs.chromium.org/p/chromium/issues/detail?id=1050968
testGridDefinitionsSetJSValues("calc(25px + 40%) minmax(min-content, calc(10% + 12px))", "minmax(calc(75% - 350px), max-content) auto", "345px 92px", "100px 0px", "calc(40% + 25px) minmax(min-content, calc(10% + 12px))", "minmax(calc(75% - 350px), max-content) auto");
testWrongCSSValue();
testGridDefinitionsSetBadJSValues("none auto", "none auto");
testGridDefinitionsSetBadJSValues("none 16em", "none 56%");
testGridDefinitionsSetBadJSValues("none none", "none none");
testGridDefinitionsSetBadJSValues("auto none", "auto none");
testGridDefinitionsSetBadJSValues("auto none 16em", "auto 18em none");
testGridDefinitionsSetBadJSValues("-webkit-fit-content -webkit-fit-content", "-webkit-fit-available -webkit-fit-available");
// Negative values are not allowed.
testGridDefinitionsSetBadJSValues("-10px minmax(16px, 32px)", "minmax(10%, 15%) -10vw");
testGridDefinitionsSetBadJSValues("10px minmax(16px, -1vw)", "minmax(-1%, 15%) 10vw");
// Invalid expressions with calc
testGridDefinitionsSetBadJSValues("10px calc(16px 30px)", "calc(25px + auto) 2em");
testGridDefinitionsSetBadJSValues("minmax(min-content, calc() 250px", "calc(2em(");
testInherit();
testDefaultValue()
testInitial();
done();
});
</script>

Просмотреть файл

@ -0,0 +1,386 @@
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="author" title="Sergio Villar" href="mailto:svillar@igalia.com">
<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=392200">
<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">
<link rel="help" href="https://drafts.csswg.org/css-grid/#track-sizing">
<meta name="assert" content="Checks resolution of content sized grid columns and verifies that items are processed by ascending span to compute column breadths">
<style>
.grid {
font: 10px/1 Ahem;
}
.gridWidth300 {
width: 300px;
}
.gridMinContentFixedAndAuto {
grid-template-columns: minmax(min-content, 15px) auto;
}
.gridMaxContentFixedAndAuto {
grid-template-columns: minmax(max-content, 15px) auto;
}
.gridAutoAndAuto {
grid-template-columns: auto auto;
}
.gridMinContentAndMinContentFixed {
grid-template-columns: min-content minmax(min-content, 30px);
}
.gridMinContentAndMaxContentFixed {
grid-template-columns: min-content minmax(max-content, 30px);
}
.gridMaxContentAndMinContent {
grid-template-columns: max-content min-content;
}
.gridFixedMinContentAndMaxContent {
grid-template-columns: minmax(10px, min-content) max-content;
}
.gridFixedMaxContentAndMinContent {
grid-template-columns: minmax(10px, max-content) min-content;
}
.gridAutoMinContent {
grid-template-columns: auto min-content;
}
.gridAutoMaxContent {
grid-template-columns: auto max-content;
}
.gridMaxContentAndMinContentFixed {
grid-template-columns: max-content minmax(min-content, 35px);
}
.gridMaxContentAndMaxContentFixed {
grid-template-columns: max-content minmax(max-content, 35px);
}
.gridMinContentFixedAndFixedFixedAndAuto {
grid-template-columns: minmax(min-content, 20px) minmax(20px, 30px) auto;
}
.gridAutoAndFixedFixedAndMaxContentFixed {
grid-template-columns: auto minmax(20px, 30px) minmax(max-content, 20px);
}
.gridMaxContentAndMaxContentFixedAndMaxContent {
grid-template-columns: max-content minmax(max-content, 20px) max-content;
}
.gridAutoAndMinContentFixedAndMinContent {
grid-template-columns: auto minmax(min-content, 30px) min-content;
}
</style>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div class="grid gridMinContentFixedAndAuto justifyContentStart" id="gridMinContentFixedAndAuto">
<div class="firstRowBothColumn">XXXX XXXX</div>
</div>
<div class="grid gridAutoAndAuto justifyContentStart" id="gridAutoAndAuto">
<div class="firstRowBothColumn">XXXX XXXX</div>
</div>
<div class="grid gridMinContentAndMinContentFixed" id="gridMinContentAndMinContentFixed">
<div class="firstRowBothColumn">XXXX XXXX</div>
</div>
<div class="grid gridMaxContentAndMinContent" id="gridMaxContentAndMinContent">
<div class="firstRowBothColumn">XXXX XXXX</div>
</div>
<div class="grid gridFixedMinContentAndMaxContent" id="gridFixedMinContentAndMaxContent">
<div class="firstRowBothColumn">XXXX XXXX</div>
</div>
<div class="grid gridFixedMaxContentAndMinContent" id="gridFixedMaxContentAndMinContent">
<div class="firstRowBothColumn">XXXX XXXX</div>
</div>
<div class="grid gridMinContentAndMaxContentFixed" id="gridMinContentAndMaxContentFixed">
<div class="firstRowBothColumn">XXXX XXXX</div>
</div>
<div class="constrainedContainer">
<div class="grid gridMaxContentFixedAndAuto" id="gridMaxContentFixedAndAuto">
<div class="firstRowBothColumn">XXXX XXXX</div>
</div>
</div>
<div class="grid gridAutoMinContent justifyContentStart" id="gridAutoMinContent">
<div class="firstRowBothColumn">XXXX XXXX</div>
</div>
<div class="grid gridAutoMaxContent justifyContentStart" id="gridAutoMaxContent">
<div class="firstRowBothColumn">XXXX XXXX</div>
</div>
<div class="constrainedContainer">
<div class="grid gridMaxContentAndMinContentFixed" id="gridMaxContentAndMinContentFixed">
<div class="firstRowBothColumn">XXXX XXXX</div>
</div>
</div>
<div class="grid gridMaxContentAndMaxContentFixed" id="gridMaxContentAndMaxContentFixed">
<div class="firstRowBothColumn">XXXX XXXX</div>
</div>
<!-- Check that items are processed by ascending span instead of going track by track forbidding extra space distribution. -->
<div class="constrainedContainer">
<div class="grid gridMinContentFixedAndAuto" id="gridMinContentFixedAndAutoUnsortedConstrained">
<div class="firstRowBothColumn">XXXX XXXX</div>
<div class="firstRowSecondColumn">XXXX XXXX</div>
</div>
</div>
<div class="constrainedContainer">
<div class="grid gridAutoAndAuto" id="gridAutoAndAutoUnsortedConstrained">
<div class="firstRowBothColumn">XXXX XXXX</div>
<div class="firstRowSecondColumn">XXX</div>
</div>
</div>
<div class="constrainedContainer">
<div class="grid gridMinContentAndMinContentFixed" id="gridMinContentAndMinContentFixedUnsortedConstrained">
<div class="firstRowBothColumn">XXXX XXXX</div>
<div class="firstRowBothColumn">XX XX XX</div>
<div class="firstRowSecondColumn">XXXX XXXX</div>
</div>
</div>
<div class="constrainedContainer">
<div class="grid gridMaxContentAndMinContent" id="gridMaxContentAndMinContentUnsortedConstrained">
<div class="firstRowBothColumn">XXX XXX</div>
<div class="firstRowSecondColumn">XXXXXXX</div>
</div>
</div>
<div class="constrainedContainer">
<div class="grid gridFixedMinContentAndMaxContent" id="gridFixedMinContentAndMaxContentUnsortedConstrained">
<div class="firstRowBothColumn">XXXXX XX</div>
<div class="firstRowSecondColumn">XXX</div>
<div class="firstRowSecondColumn">XXXXX</div>
</div>
</div>
<div class="constrainedContainer">
<div class="grid gridFixedMaxContentAndMinContent" id="gridFixedMaxContentAndMinContentUnsortedConstrained">
<div class="firstRowBothColumn">XXXX XXXX</div>
<div class="firstRowBothColumn">X X</div>
<div class="firstRowSecondColumn">XXXX</div>
</div>
</div>
<div class="constrainedContainer">
<div class="grid gridMinContentAndMaxContentFixed" id="gridMinContentAndMaxContentFixedUnsortedConstrained">
<div class="firstRowBothColumn">XXXX XXXX</div>
<div class="firstRowSecondColumn">XXXX XXXX</div>
</div>
</div>
<div class="constrainedContainer">
<div class="grid gridMaxContentFixedAndAuto" id="gridMaxContentFixedAndAutoUnsortedConstrained">
<div class="firstRowBothColumn">XX XX</div>
<div class="firstRowSecondColumn">XXXX</div>
<div class="firstRowSecondColumn">XXX XXX</div>
</div>
</div>
<div class="constrainedContainer">
<div class="grid gridAutoMinContent" id="gridAutoMinContentUnsortedConstrained">
<div class="firstRowBothColumn">XX XX XX XX</div>
<div class="firstRowSecondColumn">XXXXXX XXXXXX</div>
</div>
</div>
<div class="constrainedContainer">
<div class="grid gridAutoMaxContent" id="gridAutoMaxContentUnsortedConstrained">
<div class="firstRowBothColumn">XXXX XXXX</div>
<div class="firstRowBothColumn">XXX XXX</div>
<div class="firstRowSecondColumn">XXXXX</div>
</div>
</div>
<div class="constrainedContainer">
<div class="grid gridMaxContentAndMinContentFixed" id="gridMaxContentAndMinContentFixedUnsortedConstrained">
<div class="firstRowBothColumn">XXX XXX</div>
<div class="firstRowBothColumn">XXXX XXXX</div>
<div class="firstRowSecondColumn">XXXX XXXX</div>
<div class="firstRowSecondColumn">XX</div>
</div>
</div>
<div class="constrainedContainer">
<div class="grid gridMaxContentAndMaxContentFixed" id="gridMaxContentAndMaxContentFixedUnsortedConstrained">
<div class="firstRowBothColumn">XXXX XXXX</div>
<div class="firstRowBothColumn">XX XX XX XX</div>
<div class="firstRowSecondColumn">XXXXXXX</div>
</div>
</div>
<!-- Check that items are processed by ascending span instead of going track by track allowing extra space distribution. -->
<div class="grid gridMinContentFixedAndAuto justifyContentStart" id="gridMinContentFixedAndAutoUnsorted">
<div class="firstRowBothColumn">XXXX XXXX</div>
<div class="firstRowSecondColumn">XXXX XXXX</div>
</div>
<div class="grid gridAutoAndAuto justifyContentStart" id="gridAutoAndAutoUnsorted">
<div class="firstRowBothColumn">XXXX XXXX</div>
<div class="firstRowSecondColumn">XXX</div>
</div>
<div class="grid gridMinContentAndMinContentFixed" id="gridMinContentAndMinContentFixedUnsorted">
<div class="firstRowBothColumn">XXXX XXXX</div>
<div class="firstRowBothColumn">XX XX XX XX</div>
<div class="firstRowSecondColumn">XXXX XXXX</div>
</div>
<div class="grid gridMaxContentAndMinContent" id="gridMaxContentAndMinContentUnsorted">
<div class="firstRowBothColumn">XXX XXX</div>
<div class="firstRowSecondColumn">XXXXXXX</div>
</div>
<div class="grid gridFixedMinContentAndMaxContent" id="gridFixedMinContentAndMaxContentUnsorted">
<div class="firstRowBothColumn">XXXXX XX</div>
<div class="firstRowSecondColumn">XXX</div>
<div class="firstRowSecondColumn">XXXXX</div>
</div>
<div class="grid gridFixedMaxContentAndMinContent" id="gridFixedMaxContentAndMinContentUnsorted">
<div class="firstRowBothColumn">XXXX XXXX</div>
<div class="firstRowBothColumn">X X</div>
<div class="firstRowSecondColumn">XXXX</div>
</div>
<div class="grid gridMinContentAndMaxContentFixed" id="gridMinContentAndMaxContentFixedUnsorted">
<div class="firstRowBothColumn">XXXX XXXX</div>
<div class="firstRowSecondColumn">XXXX XXXX</div>
</div>
<div class="grid gridMaxContentFixedAndAuto justifyContentStart" id="gridMaxContentFixedAndAutoUnsorted">
<div class="firstRowBothColumn">XX XX</div>
<div class="firstRowSecondColumn">XXXX</div>
<div class="firstRowSecondColumn">XXX XXX</div>
</div>
<div class="grid gridAutoMinContent justifyContentStart" id="gridAutoMinContentUnsorted">
<div class="firstRowBothColumn">XX XX XX XX</div>
<div class="firstRowSecondColumn">XXXXXX XXXXXX</div>
</div>
<div class="grid gridAutoMaxContent justifyContentStart" id="gridAutoMaxContentUnsorted">
<div class="firstRowBothColumn">XXXX XXXX</div>
<div class="firstRowBothColumn">XXX XXX</div>
<div class="firstRowSecondColumn">XXXXX</div>
</div>
<div class="grid gridMaxContentAndMinContentFixed" id="gridMaxContentAndMinContentFixedUnsorted">
<div class="firstRowBothColumn">XXX XXX</div>
<div class="firstRowBothColumn">XXXX XXXX</div>
<div class="firstRowSecondColumn">XXXX XXXX</div>
<div class="firstRowSecondColumn">XX</div>
</div>
<div class="grid gridMaxContentAndMaxContentFixed" id="gridMaxContentAndMaxContentFixedUnsorted">
<div class="firstRowBothColumn">XXXX XXXX</div>
<div class="firstRowBothColumn">XX XX XX XX</div>
<div class="firstRowSecondColumn">XXXXXXX</div>
</div>
<!-- The next four force the grid to grow only a particular subset of tracks above the limits -->
<div class="constrainedContainer">
<div class="grid gridMinContentFixedAndAuto justifyContentStart" id="gridMinContentFixedAndAutoAboveLimits">
<div class="firstRowBothColumn">XXXX XXXX</div>
<div class="firstRowBothColumn">XXXXXXXXXXX</div>
</div>
</div>
<div class="constrainedContainer">
<div class="grid gridMaxContentFixedAndAuto" id="gridMaxContentFixedAndAutoAboveLimits">
<div class="firstRowBothColumn">XXXX XXXX</div>
<div class="firstRowBothColumn">XXXXXXXXXXXXXXX</div>
</div>
</div>
<div class="constrainedContainer">
<div class="grid gridMinContentFixedAndFixedFixedAndAuto" id="gridMinContentFixedAndFixedFixedAndAuto">
<div class="firstRowBothColumn">XXXX XXXX</div>
<div class="firstRowBothColumn">XXXXXXXXXX</div>
</div>
</div>
<div class="constrainedContainer">
<div class="grid gridAutoAndFixedFixedAndMaxContentFixed" id="gridAutoAndFixedFixedAndMaxContentFixed">
<div class="firstRowBothColumn">XXXX XXXX</div>
<div class="firstRowBothColumn">XXXXXXXXXXXXXXX</div>
</div>
</div>
<div class="grid gridMaxContentAndMaxContentFixedAndMaxContent" id="gridMaxContentAndMaxContentFixedAndMaxContent">
<div style="grid-row: 1; grid-column: 1;">X X X</div>
<div style="grid-row: 1; grid-column: 3;">X X</div>
<div style="grid-row: 1; grid-column: 1 / -1;">XX XX XX XX XX</div>
</div>
<div class="grid gridAutoAndMinContentFixedAndMinContent justifyContentStart" id="gridAutoAndMinContentFixedAndMinContent">
<div style="grid-row: 1; grid-column: 1;">XX</div>
<div style="grid-row: 1; grid-column: 1 / -1;">XXXXXXXXXXXXXXX</div>
<div style="grid-row: 1; grid-column: 3;">XXX XXX</div>
</div>
<script>
function testGridColumnsValues(id, computedColumnValue) {
test(function(){
var div = document.getElementById(id);
var readValue = getComputedStyle(div).gridTemplateColumns;
assert_equals(readValue, computedColumnValue);
}, `Element '${id}' grid-template-columns value computes to '${computedColumnValue}'`);
}
setup({ explicit_done: true });
document.fonts.ready.then(() => {
testGridColumnsValues("gridMinContentFixedAndAuto", "15px 75px");
testGridColumnsValues("gridAutoAndAuto", "45px 45px");
testGridColumnsValues("gridMinContentAndMinContentFixed", "20px 30px");
testGridColumnsValues("gridMaxContentAndMinContent", "70px 20px");
testGridColumnsValues("gridFixedMinContentAndMaxContent", "10px 80px");
testGridColumnsValues("gridFixedMaxContentAndMinContent", "60px 30px");
testGridColumnsValues("gridMinContentAndMaxContentFixed", "20px 70px");
testGridColumnsValues("gridMaxContentFixedAndAuto", "65px 25px");
testGridColumnsValues("gridAutoMinContent", "70px 20px");
testGridColumnsValues("gridAutoMaxContent", "20px 70px");
testGridColumnsValues("gridMaxContentAndMinContentFixed", "70px 20px");
testGridColumnsValues("gridMaxContentAndMaxContentFixed", "55px 35px");
// Check that items are processed by ascending span to compute track breadths forbidding extra space distribution.
testGridColumnsValues("gridMinContentFixedAndAutoUnsortedConstrained", "0px 40px");
testGridColumnsValues("gridAutoAndAutoUnsortedConstrained", "10px 30px");
testGridColumnsValues("gridMinContentAndMinContentFixedUnsortedConstrained", "0px 40px");
testGridColumnsValues("gridMaxContentAndMinContentUnsortedConstrained", "0px 70px");
testGridColumnsValues("gridFixedMinContentAndMaxContentUnsortedConstrained", "10px 70px");
testGridColumnsValues("gridFixedMaxContentAndMinContentUnsortedConstrained", "10px 40px");
testGridColumnsValues("gridMinContentAndMaxContentFixedUnsortedConstrained", "0px 90px");
testGridColumnsValues("gridMaxContentFixedAndAutoUnsortedConstrained", "10px 40px");
testGridColumnsValues("gridAutoMinContentUnsortedConstrained", "0px 60px");
testGridColumnsValues("gridAutoMaxContentUnsortedConstrained", "0px 90px");
testGridColumnsValues("gridMaxContentAndMinContentFixedUnsortedConstrained", "50px 40px");
testGridColumnsValues("gridMaxContentAndMaxContentFixedUnsortedConstrained", "40px 70px");
// Check that items are processed by ascending span to compute track breadths allowing extra space distribution.
testGridColumnsValues("gridMinContentFixedAndAutoUnsorted", "15px 90px");
testGridColumnsValues("gridAutoAndAutoUnsorted", "60px 30px");
testGridColumnsValues("gridMinContentAndMinContentFixedUnsorted", "0px 40px");
testGridColumnsValues("gridMaxContentAndMinContentUnsorted", "0px 70px");
testGridColumnsValues("gridFixedMinContentAndMaxContentUnsorted", "10px 70px");
testGridColumnsValues("gridFixedMaxContentAndMinContentUnsorted", "50px 40px");
testGridColumnsValues("gridMinContentAndMaxContentFixedUnsorted", "0px 90px");
testGridColumnsValues("gridMaxContentFixedAndAutoUnsorted", "15px 70px");
testGridColumnsValues("gridAutoMinContentUnsorted", "50px 60px");
testGridColumnsValues("gridAutoMaxContentUnsorted", "0px 90px");
testGridColumnsValues("gridMaxContentAndMinContentFixedUnsorted", "50px 40px");
testGridColumnsValues("gridMaxContentAndMaxContentFixedUnsorted", "40px 70px");
// Check that only a subset of tracks grow above track limits.
testGridColumnsValues("gridMinContentFixedAndAutoAboveLimits", "15px 95px");
testGridColumnsValues("gridMaxContentFixedAndAutoAboveLimits", "15px 135px");
testGridColumnsValues("gridMinContentFixedAndFixedFixedAndAuto", "20px 20px 60px");
testGridColumnsValues("gridAutoAndFixedFixedAndMaxContentFixed", "110px 20px 20px");
testGridColumnsValues("gridMaxContentAndMaxContentFixedAndMaxContent", "70px 20px 50px");
testGridColumnsValues("gridAutoAndMinContentFixedAndMinContent", "55px 30px 65px");
done();
});
</script>