blob: 820f8e367f5a8fdc4dab5be979de04ac76c1ebcd [file] [log] [blame]
<!DOCTYPE html>
<html>
<script>
if (window.testRunner)
testRunner.overridePreference("WebKitCSSGridLayoutEnabled", 1);
</script>
<link href="resources/grid.css" rel="stylesheet">
<style>
.grid {
-webkit-grid-definition-columns: 50px 100px;
-webkit-grid-definition-rows: 50px 100px;
}
</style>
<script src="../../resources/check-layout.js"></script>
<script>
function testRemoval(gridElementID, autoFlowElementID, size)
{
var gridElement = document.getElementById(gridElementID);
var autoFlowElement = document.getElementById(autoFlowElementID);
// Remove the white space and the first grid item.
gridElement.removeChild(gridElement.firstChild);
gridElement.removeChild(gridElement.firstChild);
autoFlowElement.setAttribute("data-expected-width", size.width);
autoFlowElement.setAttribute("data-expected-height", size.height);
checkLayout("#" + gridElementID);
}
function testRemovals()
{
checkLayout("#autoFlowColumnElement");
testRemoval("gridAutoFlowColumn", "autoFlowColumnElement", { 'width': '100', 'height': '100' });
testRemoval("gridAutoFlowColumn", "autoFlowColumnElement", { 'width': '100', 'height': '50' });
testRemoval("gridAutoFlowColumn", "autoFlowColumnElement", { 'width': '50', 'height': '100' });
testRemoval("gridAutoFlowColumn", "autoFlowColumnElement", { 'width': '50', 'height': '50' });
checkLayout("#autoFlowRowElement");
testRemoval("gridAutoFlowRow", "autoFlowRowElement", { 'width': '100', 'height': '100' });
testRemoval("gridAutoFlowRow", "autoFlowRowElement", { 'width': '100', 'height': '50' });
testRemoval("gridAutoFlowRow", "autoFlowRowElement", { 'width': '50', 'height': '50' });
testRemoval("gridAutoFlowRow", "autoFlowRowElement", { 'width': '50', 'height': '50' });
checkLayout("#gridAutoFlowColumnWithAutoItems");
testRemoval("gridAutoFlowColumnWithAutoItems", "autoFlowRowElementWithAutoItems", { 'width': '100', 'height': '100' });
testRemoval("gridAutoFlowColumnWithAutoItems", "autoFlowRowElementWithAutoItems", { 'width': '100', 'height': '50' });
testRemoval("gridAutoFlowColumnWithAutoItems", "autoFlowRowElementWithAutoItems", { 'width': '50', 'height': '100' });
testRemoval("gridAutoFlowColumnWithAutoItems", "autoFlowRowElementWithAutoItems", { 'width': '50', 'height': '50' });
checkLayout("#gridAutoFlowRowWithAutoAndFixedItems");
testRemoval("gridAutoFlowRowWithAutoAndFixedItems", "autoFlowRowElementWithAutoAndFixedItems", { 'width': '100', 'height': '100' });
testRemoval("gridAutoFlowRowWithAutoAndFixedItems", "autoFlowRowElementWithAutoAndFixedItems", { 'width': '100', 'height': '50' });
testRemoval("gridAutoFlowRowWithAutoAndFixedItems", "autoFlowRowElementWithAutoAndFixedItems", { 'width': '100', 'height': '50' });
testRemoval("gridAutoFlowRowWithAutoAndFixedItems", "autoFlowRowElementWithAutoAndFixedItems", { 'width': '50', 'height': '50' });
}
window.addEventListener("load", testRemovals, false);
</script>
<body>
<p>This test checks that the tracks' auto positions are recomputed after removing a grid item.</p>
<div class="unconstrainedContainer">
<div class="grid gridAutoFlowColumn" id="gridAutoFlowColumn">
<div class="sizedToGridArea secondRowSecondColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea firstRowSecondColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea secondRowFirstColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea firstRowFirstColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea autoRowAutoColumn" id="autoFlowColumnElement" data-expected-width="170" data-expected-height="50">XXXXX XXXXX XXXXX</div>
</div>
</div>
<div class="unconstrainedContainer">
<div class="grid gridAutoFlowRow" id="gridAutoFlowRow">
<div class="sizedToGridArea secondRowSecondColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea firstRowSecondColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea firstRowFirstColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea secondRowFirstColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea autoRowAutoColumn" id="autoFlowRowElement" data-expected-width="50" data-expected-height="30">XXXXX XXXXX XXXXX</div>
</div>
</div>
<div class="unconstrainedContainer">
<div class="grid gridAutoFlowColumn" id="gridAutoFlowColumnWithAutoItems">
<div class="sizedToGridArea autoRowFirstColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea autoRowSecondColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea secondRowAutoColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea firstRowAutoColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea autoRowAutoColumn" id="autoFlowRowElementWithAutoItems" data-expected-width="100" data-expected-height="100">XXXXX XXXXX XXXXX</div>
</div>
</div>
<div class="unconstrainedContainer">
<div class="grid gridAutoFlowRow" id="gridAutoFlowRowWithAutoAndFixedItems">
<div class="sizedToGridArea autoRowFirstColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea firstRowSecondColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea secondRowAutoColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea firstRowAutoColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea autoRowAutoColumn" id="autoFlowRowElementWithAutoAndFixedItems" data-expected-width="100" data-expected-height="100">XXXXX XXXXX XXXXX</div>
</div>
</div>
</body>
</html>