blob: fdbde431c75fbdabd35e58c9dcdc2e7bcd7e94ed [file] [log] [blame]
<!DOCTYPE html>
<html>
<script>
if (window.testRunner)
testRunner.overridePreference("WebKitCSSGridLayoutEnabled", 1);
</script>
<link href="resources/grid.css" rel="stylesheet">
<style>
.grid {
grid-columns: 70% 30%;
grid-rows: 40% 60%;
width: 400px;
height: 300px;
}
.firstRowFirstColumn {
width: 100%;
height: 15px;
}
.firstRowSecondColumn {
width: 15px;
height: 100%;
}
.secondRowFirstColumn {
width: 50%;
height: 50%;
}
.secondRowSecondColumn {
width: -webkit-calc(100%);
height: -webkit-calc(100%);
}
</style>
<script src="../../resources/check-layout.js"></script>
<script>
function changeGridDefinitionsAndCheckValues()
{
var grid0 = document.getElementsByClassName("grid")[0];
var grid1 = document.getElementsByClassName("grid")[1];
var grid2 = document.getElementsByClassName("grid")[2];
document.body.offsetLeft;
grid0.style.gridColumns = "40% 60%";
grid1.style.gridRows = "30% 70%";
grid2.style.gridColumns = "40% 60%";
grid2.style.gridRows = "30% 70%";
checkLayout('.grid');
}
window.addEventListener("load", changeGridDefinitionsAndCheckValues, false);
</script>
<body>
<p>Test that changing percentage sized grid tracks make the grid items relayouts.</p>
<div style="position: relative">
<div class="grid" data-expected-width="400" data-expected-height="300">
<div class="firstRowFirstColumn" data-expected-width="160" data-expected-height="15"></div>
<div class="firstRowSecondColumn" data-expected-width="15" data-expected-height="120"></div>
<div class="secondRowFirstColumn" data-expected-width="80" data-expected-height="90"></div>
<div class="secondRowSecondColumn" data-expected-width="240" data-expected-height="180"></div>
</div>
</div>
<div style="position: relative">
<div class="grid" data-expected-width="400" data-expected-height="300">
<div class="firstRowFirstColumn" data-expected-width="280" data-expected-height="15"></div>
<div class="firstRowSecondColumn" data-expected-width="15" data-expected-height="90"></div>
<div class="secondRowFirstColumn" data-expected-width="140" data-expected-height="105"></div>
<div class="secondRowSecondColumn" data-expected-width="120" data-expected-height="210"></div>
</div>
</div>
<div style="position: relative">
<div class="grid" data-expected-width="400" data-expected-height="300">
<div class="firstRowFirstColumn" data-expected-width="160" data-expected-height="15"></div>
<div class="firstRowSecondColumn" data-expected-width="15" data-expected-height="90"></div>
<div class="secondRowFirstColumn" data-expected-width="80" data-expected-height="105"></div>
<div class="secondRowSecondColumn" data-expected-width="240" data-expected-height="210"></div>
</div>
</div>
</body>
</html>