<!DOCTYPE html>
<html>
<head>
<link href="resources/grid.css" rel="stylesheet">
<style>
.grid {
    grid-auto-columns: 5px;
    grid-auto-rows: 5px;
}

.gridWithoutRepeat {
    grid-template-columns: [a] 50px [b] 100px [c] 200px [d];
    grid-template-rows: [e] 50px [f] 100px [g] 200px [h];
}

.gridWithRepeat {
    grid-template-columns: [b] 50px [b] 100px [b] 200px [b];
    grid-template-rows: [g] 50px [g] 100px [g] 200px [g];
}

.gridFromSpecs {
    grid-template-columns: [A] 10px [B] 20px [C] 30px [A] 40px [B] 50px [C] 60px [A] 70px [B] 80px [C];
    grid-template-rows: 100px;
}

.gridItemBToD {
    grid-column: b / d;
    grid-row: 1;
}

.gridItemGToH {
    grid-column: 1;
    grid-row: g / h;
}

.gridItemInvalidPositiveGridLine {
    grid-column: nonexistent / span 2;
    grid-row: span 2 / nonexistent;
}

.gridItemInvalidNegativeGridLine {
    grid-column: 1 / -1 nonexistent;
    grid-row: span 2 / -10 nonexistent;
}

.gridItemAToSpanC {
    grid-column: a / span c;
    grid-row: 1;
}

.gridItemFToSpanH {
    grid-column: 1;
    grid-row: f span / h;
}

.gridItem2BSpan2B {
    grid-column: 2 b / span 2 b;
    grid-row: 1;
}

.gridItemSpan2GNegativeG {
    grid-column: 1;
    grid-row: span 2 g / -1 g;
}
</style>
<script src="../../resources/check-layout.js"></script>
</head>
<body onload="checkLayout('.grid')">

<p>This test checks that we resolve named grid line per the specification.</p>

<div style="position: relative">
    <div class="grid gridWithoutRepeat">
        <div class="sizedToGridArea gridItemBToD" data-offset-x="50" data-offset-y="0" data-expected-width="300" data-expected-height="50"></div>
    </div>
</div>

<div style="position: relative">
    <div class="grid gridWithoutRepeat">
        <div class="sizedToGridArea gridItemGToH" data-offset-x="0" data-offset-y="150" data-expected-width="50" data-expected-height="200"></div>
    </div>
</div>


<div style="position: relative">
    <div class="grid gridWithRepeat">
        <div class="sizedToGridArea gridItemBToD" data-offset-x="0" data-offset-y="0" data-expected-width="355" data-expected-height="50"></div>
    </div>
</div>

<div style="position: relative">
    <div class="grid gridWithRepeat">
        <div class="sizedToGridArea gridItemGToH" data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="355"></div>
    </div>
</div>

<div style="position: relative">
    <div class="grid gridWithoutRepeat">
        <div class="sizedToGridArea gridItemInvalidPositiveGridLine" data-offset-x="355" data-offset-y="150" data-expected-width="10" data-expected-height="205"></div>
    </div>
</div>
</div>

<div style="position: relative">
    <div class="grid gridWithoutRepeat">
        <div class="sizedToGridArea gridItemInvalidNegativeGridLine" data-offset-x="0" data-offset-y="0" data-expected-width="5" data-expected-height="10"></div>
    </div>
</div>
</div>

<div style="position: relative">
    <div class="grid gridWithoutRepeat">
        <div class="sizedToGridArea gridItemAToSpanC" data-offset-x="0" data-offset-y="0" data-expected-width="150" data-expected-height="50"></div>
    </div>
</div>

<div style="position: relative">
    <div class="grid gridWithoutRepeat">
        <div class="sizedToGridArea gridItemFToSpanH" data-offset-x="0" data-offset-y="50" data-expected-width="50" data-expected-height="300"></div>
    </div>
</div>

<div style="position: relative">
    <div class="grid gridWithoutRepeat">
        <!-- Consider all the implicit lines to be called 'b' too. -->
        <div class="sizedToGridArea gridItem2BSpan2B" data-offset-x="355" data-offset-y="0" data-expected-width="10" data-expected-height="50"></div>
    </div>
</div>

<div style="position: relative">
    <div class="grid gridWithoutRepeat">
        <!-- Consider all the implicit lines to be called 'g' too. -->
        <div class="sizedToGridArea gridItemSpan2GNegativeG" data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="160"></div>
    </div>
</div>

<div style="position: relative">
    <div class="grid gridWithRepeat">
        <!-- There is no 'a' or 'c' so all the implicit lines are considered to have those names. -->
        <div class="sizedToGridArea gridItemAToSpanC" data-offset-x="355" data-offset-y="0" data-expected-width="5" data-expected-height="50"></div>
    </div>
</div>

<div style="position: relative">
    <div class="grid gridWithRepeat">
        <!-- There is no 'f' or 'h' so all the implicit lines are considered to have those names. -->
        <div class="sizedToGridArea gridItemFToSpanH" data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="360"></div>
    </div>
</div>

<div style="position: relative">
    <div class="grid gridWithRepeat">
        <div class="sizedToGridArea gridItem2BSpan2B" data-offset-x="50" data-offset-y="0" data-expected-width="300" data-expected-height="50"></div>
    </div>
</div>

<div style="position: relative">
    <div class="grid gridWithRepeat">
        <div class="sizedToGridArea gridItemSpan2GNegativeG" data-offset-x="0" data-offset-y="50" data-expected-width="50" data-expected-height="300"></div>
    </div>
</div>

<div style="position: relative">
    <div class="grid gridFromSpecs">
      <div class="sizedToGridArea" style="grid-column: 4 / auto;" data-offset-x="60px" data-expected-width="40px"></div>
    </div>
</div>

<div style="position: relative">
    <div class="grid gridFromSpecs">
      <div class="sizedToGridArea" style="grid-column: auto / 6;" data-offset-x="100px" data-expected-width="50px"></div>
    </div>
</div>

<div style="position: relative">
    <div class="grid gridFromSpecs">
      <div class="sizedToGridArea" style="grid-column: C / C -1;" data-offset-x="30px" data-expected-width="330px"></div>
    </div>
</div>

<div style="position: relative">
    <div class="grid gridFromSpecs">
      <div class="sizedToGridArea" style="grid-column: C / span C;" data-offset-x="30px" data-expected-width="120px"></div>
    </div>
</div>

<div style="position: relative">
    <div class="grid gridFromSpecs">
      <div class="sizedToGridArea" style="grid-column: span C / C -1;" data-offset-x="150px" data-expected-width="210px"></div>
    </div>
</div>

<div style="position: relative">
    <div class="grid gridFromSpecs">
      <div class="sizedToGridArea" style="grid-column: span C / span C;" data-offset-x="0px" data-expected-width="10px"></div>
    </div>
</div>

<div style="position: relative">
    <div class="grid gridFromSpecs">
      <div class="sizedToGridArea" style="grid-column: 5 / C -1;" data-offset-x="100px" data-expected-width="260px"></div>
    </div>
</div>

<div style="position: relative">
    <div class="grid gridFromSpecs">
      <div class="sizedToGridArea" style="grid-column: 5 / span C;" data-offset-x="100px" data-expected-width="50px"></div>
    </div>
</div>

<div style="position: relative">
    <div class="grid gridFromSpecs">
      <div class="sizedToGridArea" style="grid-column: 8 / 8;" data-offset-x="280px" data-expected-width="80px"></div>
    </div>
</div>

<div style="position: relative">
    <div class="grid gridFromSpecs">
      <div class="sizedToGridArea" style="grid-column: B 2 / span 1;" data-offset-x="100px" data-expected-width="50px"></div>
    </div>
</div>

</body>
</html>
