<!DOCTYPE html>
<link href="resources/grid.css" rel="stylesheet">
<link href="resources/grid-alignment.css" rel="stylesheet">
<link href="../css-intrinsic-dimensions/resources/width-keyword-classes.css" rel="stylesheet">
<style>
.grid { font: 20px/1 Ahem; }
.item { margin: 10px 5px 20px 15px; }
</style>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/check-layout-th.js"></script>
<body onload="checkLayout('.grid')">
<div id="log"></div>
<p>This test checks that grid items' margin is computed correctly for content-sized tracks when using different writing modes.</p>
<div style="position: relative">
<div class="grid fit-content itemsStart" data-expected-width="40" data-expected-height="200">
<div class="item verticalLR" data-offset-x="15" data-offset-y="10" data-expected-width="20" data-expected-height="20">X</div>
<div class="item verticalLR" data-offset-x="15" data-offset-y="60" data-expected-width="20" data-expected-height="20">X</div>
<div class="item verticalLR" data-offset-x="15" data-offset-y="110" data-expected-width="20" data-expected-height="20">X</div>
<div class="item verticalLR" data-offset-x="15" data-offset-y="160" data-expected-width="20" data-expected-height="20">X</div>
</div>
</div>
<br>
<div style="position: relative">
<div class="grid gridAutoFlowColumnSparse fit-content itemsStart" data-expected-width="160" data-expected-height="50">
<div class="item verticalLR" data-offset-x="15" data-offset-y="10" data-expected-width="20" data-expected-height="20">X</div>
<div class="item verticalLR" data-offset-x="55" data-offset-y="10" data-expected-width="20" data-expected-height="20">X</div>
<div class="item verticalLR" data-offset-x="95" data-offset-y="10" data-expected-width="20" data-expected-height="20">X</div>
<div class="item verticalLR" data-offset-x="135" data-offset-y="10" data-expected-width="20" data-expected-height="20">X</div>
</div>
</div>
<br>
<div style="position: relative">
<div class="grid fit-content verticalLR itemsStart" data-expected-width="160" data-expected-height="50">
<div class="item horizontalTB" data-offset-x="15" data-offset-y="10" data-expected-width="20" data-expected-height="20">X</div>
<div class="item horizontalTB" data-offset-x="55" data-offset-y="10" data-expected-width="20" data-expected-height="20">X</div>
<div class="item horizontalTB" data-offset-x="95" data-offset-y="10" data-expected-width="20" data-expected-height="20">X</div>
<div class="item horizontalTB" data-offset-x="135" data-offset-y="10" data-expected-width="20" data-expected-height="20">X</div>
</div>
</div>
<br>
<div style="position: relative">
<div class="grid gridAutoFlowColumnSparse fit-content verticalLR itemsStart" data-expected-width="40" data-expected-height="200">
<div class="item horizontalTB" data-offset-x="15" data-offset-y="10" data-expected-width="20" data-expected-height="20">X</div>
<div class="item horizontalTB" data-offset-x="15" data-offset-y="60" data-expected-width="20" data-expected-height="20">X</div>
<div class="item horizontalTB" data-offset-x="15" data-offset-y="110" data-expected-width="20" data-expected-height="20">X</div>
<div class="item horizontalTB" data-offset-x="15" data-offset-y="160" data-expected-width="20" data-expected-height="20">X</div>
</div>
</div>
</body>