blob: 43c6b389a46238f55738c566b17801e9d8bfcccf [file] [log] [blame]
<!DOCTYPE html>
<html>
<script>
if (window.testRunner)
testRunner.overridePreference("WebKitCSSGridLayoutEnabled", 1);
</script>
<link href="resources/grid.css" rel="stylesheet">
<script src="../../resources/check-layout.js"></script>
<style>
.grid {
grid-columns: 50px 100px;
grid-rows: 50px 100px;
}
</style>
<script>
function testGrid(flow, positionAndSize)
{
var gridElement = document.getElementsByClassName("grid")[0];
gridElement.style.gridAutoFlow = flow;
var gridItem = document.getElementById("autoItem");
gridItem.setAttribute("data-offset-x", positionAndSize.offsetX);
gridItem.setAttribute("data-offset-y", positionAndSize.offsetY);
gridItem.setAttribute("data-expected-width", positionAndSize.width);
gridItem.setAttribute("data-expected-height", positionAndSize.height);
checkLayout(".grid");
}
function updateAutoFlow()
{
checkLayout(".grid");
testGrid("row", { 'offsetX': '50', 'offsetY': '0', 'width': '100', 'height': '50' });
testGrid("column", { 'offsetX': '0', 'offsetY': '50', 'width': '50', 'height': '100' });
testGrid("invalid", { 'offsetX': '0', 'offsetY': '50', 'width': '50', 'height': '100' });
testGrid("none", { 'offsetX': '0', 'offsetY': '0', 'width': '50', 'height': '50' });
}
window.addEventListener("load", updateAutoFlow, false);
</script>
<body>
<div>This test checks that updating the grid's element's grid-auto-flow property recomputes the grid.</div>
<div style="position: relative">
<div class="grid">
<div class="sizedToGridArea autoRowAutoColumn" id="autoItem" data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50"></div>
<div class="sizedToGridArea firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50"></div>
</div>
</div>
</body>
</html>