blob: 3b042649bbd944970ec0d7e6c5a9e420832c2346 [file] [log] [blame]
<!DOCTYPE html>
<link href="resources/grid.css" rel="stylesheet">
<link href="../css-intrinsic-dimensions/resources/width-keyword-classes.css" rel=stylesheet>
<script src="../../resources/check-layout.js"></script>
<script src="../../resources/js-test.js"></script>
<style>
body { margin: 0px; }
.normalGap { grid-gap: normal; }
.gridGap { grid-gap: 16px; }
.gridRowColumnGaps {
grid-row-gap: 12px;
grid-column-gap: 23px;
}
.gridMultipleCols { grid-template-columns: 30px minmax(10px, 50px) 80px; }
.gridMultipleRows { grid-template-rows: 90px 70px min-content; }
.gridAutoAuto { grid-template: auto auto / auto auto; }
.gridMultipleFixed { grid-template: [first] 37px [foo] 57px [bar] 77px [last] / [first] 15px [foo] 25px [bar] 35px [last]; }
.gridFixed100 { grid-template: repeat(2, 100px) / repeat(2, 100px); }
.gridWithPercent { grid-template: 10% 10px / 10px 20% repeat(1, 30px); }
.gridWithDoublePercent { grid-template: 35% 65% / 60% 40%; }
.fixedSizeGrid {
width: 220px;
height: 300px;
}
.gridFixedAutoTracks {
grid-auto-rows: 20px;
grid-auto-columns: 40px;
}
.thirdRowThirdColumn { grid-area: 3 / 3; }
.firstRowThirdColumn { grid-area: 1 / 3; }
div.grid > div { font: 10px/1 Ahem; }
.gridItemMargins {
margin: 20px 30px 40px 50px;
width: 20px;
height: 40px;
}
</style>
<body onload="checkLayout('.grid')">
<!-- Check that gutters contribute to the size of the grid containers. -->
<div style="position: relative;">
<div class="grid normalGap gridMultipleCols fit-content" data-expected-width="160" data-expected-height="0"></div>
<div class="grid normalGap gridMultipleRows" style="width: 400px" data-expected-width="400" data-expected-height="160"></div>
</div>
<div style="position: relative">
<div class="grid gridRowColumnGaps fit-content" data-expected-width="93" data-expected-height="52">
<div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="20" data-expected-height="10">XX</div>
<div class="secondRowSecondColumn" data-offset-x="43" data-offset-y="22" data-expected-width="50" data-expected-height="30">XX<br>X<br>XX XX</div>
</div>
</div>
<div style="position: relative">
<div class="grid gridMultipleCols gridRowColumnGaps fit-content" data-expected-width="206" data-expected-height="84">
<div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="30" data-expected-height="10">XX</div>
<div class="secondRowSecondColumn" data-offset-x="53" data-offset-y="22" data-expected-width="50" data-expected-height="20">XX<br>XX XX</div>
<div class="thirdRowThirdColumn" data-offset-x="126" data-offset-y="54" data-expected-width="80" data-expected-height="30">XXXX XX<br>X<br>XX XX</div>
</div>
</div>
<div style="position: relative">
<div class="grid gridMultipleRows gridRowColumnGaps fit-content" data-expected-width="186" data-expected-height="214">
<div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="20" data-expected-height="90">XX</div>
<div class="secondRowSecondColumn" data-offset-x="43" data-offset-y="102" data-expected-width="50" data-expected-height="70">XX<br>XX XX</div>
<div class="thirdRowThirdColumn" data-offset-x="116" data-offset-y="184" data-expected-width="70" data-expected-height="30">XXXX XX<br>X<br>XX XX</div>
</div>
</div>
<!-- Check that gutters do not alter grid items positioning. -->
<div style="position: relative">
<div class="grid gridMultipleFixed gridRowColumnGaps">
<div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="15" data-expected-height="37">X X X</div>
<div class="secondRowSecondColumn" data-offset-x="38" data-offset-y="49" data-expected-width="25" data-expected-height="57">X X</div>
<div class="thirdRowThirdColumn" data-offset-x="86" data-offset-y="118" data-expected-width="35" data-expected-height="77">XXX XX X XX XX</div>
</div>
</div>
<div style="position: relative">
<div class="grid gridMultipleFixed gridRowColumnGaps">
<div style="grid-row: 2; grid-column: -2 / -1;" data-offset-x="86" data-offset-y="49" data-expected-width="35" data-expected-height="57">X X X</div>
<div style="grid-row: 1 / bar; grid-column: bar" data-offset-x="86" data-offset-y="0" data-expected-width="35" data-expected-height="106">X XX X XX XX XX X</div>
<div style="grid-row: -2; grid-column-end: foo" data-offset-x="0" data-offset-y="118" data-expected-width="15" data-expected-height="77">X X</div>
</div>
</div>
<!-- Check that gutters do not alter track sizing. -->
<div style="position: relative">
<div class="grid gridRowColumnGaps fit-content" data-expected-width="156" data-expected-height="84">
<div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="20" data-expected-height="10">XX</div>
<div class="secondRowSecondColumn" data-offset-x="43" data-offset-y="22" data-expected-width="30" data-expected-height="20">X X<br>X X</div>
<div class="thirdRowThirdColumn" data-offset-x="96" data-offset-y="54" data-expected-width="60" data-expected-height="30">XXX XX<br>X<br>XX XX</div>
</div>
</div>
<div style="position: relative">
<div class="grid gridRowColumnGaps gridMultipleCols gridMultipleRows fit-content" data-expected-width="206" data-expected-height="214">
<div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="30" data-expected-height="90">XX</div>
<div class="secondRowSecondColumn" data-offset-x="53" data-offset-y="102" data-expected-width="50" data-expected-height="70">X X<br>X X</div>
<div class="thirdRowThirdColumn" data-offset-x="126" data-offset-y="184" data-expected-width="80" data-expected-height="30">XXX XX<br>X<br>XX XX</div>
</div>
</div>
<div style="position: relative">
<div class="grid gridWithPercent fixedSizeGrid gridRowColumnGaps gridFixedAutoTracks" data-expected-width="220" data-expected-height="300">
<div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="10" data-expected-height="30"></div>
<div class="secondRowSecondColumn" data-offset-x="33" data-offset-y="42" data-expected-width="44" data-expected-height="10"></div>
<div class="thirdRowThirdColumn" data-offset-x="100" data-offset-y="64" data-expected-width="30" data-expected-height="20"></div>
</div>
</div>
<!-- Check that gutters contribute to the size of spanning items. -->
<div style="position: relative">
<div class="grid gridGap gridAutoAuto constrainedContainer">
<div class="secondRowBothColumn" data-offset-x="0" data-offset-y="26" data-expected-width="50" data-expected-height="10">XXXXX</div>
<div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="17" data-expected-height="10">X</div>
<div class="firstRowSecondColumn" data-offset-x="33" data-offset-y="0" data-expected-width="17" data-expected-height="10">X</div>
</div>
</div>
<div style="position: relative">
<div class="grid gridMultipleFixed gridRowColumnGaps">
<div style="grid-row: 2; grid-column: 1 / -1;" data-offset-x="0" data-offset-y="49" data-expected-width="121" data-expected-height="57">XXXX X XXXX</div>
<div style="grid-row: first / last; grid-column-start: 2" data-offset-x="38" data-offset-y="0" data-expected-width="25" data-expected-height="195">X XX X XX X</div>
<div style="grid-row: 1 / 3; grid-column: first / bar" data-offset-x="0" data-offset-y="0" data-expected-width="63" data-expected-height="106">XXX XX<br>XX<br>XXXXX</div>
</div>
</div>
<div style="position: relative">
<div class="grid gridWithDoublePercent fixedSizeGrid gridRowColumnGaps gridFixedAutoTracks" data-expected-width="220" data-expected-height="300">
<div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="132" data-expected-height="105"></div>
<div class="secondRowSecondColumn" data-offset-x="155" data-offset-y="117" data-expected-width="88" data-expected-height="195"></div>
<div class="secondRowBothColumn" data-offset-x="0" data-offset-y="117" data-expected-width="243" data-expected-height="195"></div>
</div>
</div>
<!-- Check that gutters do not interfere with margins computation. -->
<div style="position: relative">
<div class="grid gridFixed100 gridGap">
<div class="gridItemMargins firstRowFirstColumn" data-offset-x="50" data-offset-y="20" data-expected-width="20" data-expected-height="40"></div>
<div class="gridItemMargins firstRowSecondColumn" data-offset-x="166" data-offset-y="20" data-expected-width="20" data-expected-height="40"></div>
<div class="gridItemMargins secondRowFirstColumn" data-offset-x="50" data-offset-y="136" data-expected-width="20" data-expected-height="40"></div>
<div class="gridItemMargins secondRowSecondColumn" data-offset-x="166" data-offset-y="136" data-expected-width="20" data-expected-height="40"></div>
</div>
</div>
<div style="position: relative">
<div class="grid gridFixed100 verticalRL directionRTL gridGap">
<div class="gridItemMargins firstRowFirstColumn" data-offset-x="166" data-offset-y="136" data-expected-width="20" data-expected-height="40"></div>
<div class="gridItemMargins firstRowSecondColumn" data-offset-x="166" data-offset-y="20" data-expected-width="20" data-expected-height="40"></div>
<div class="gridItemMargins secondRowFirstColumn" data-offset-x="50" data-offset-y="136" data-expected-width="20" data-expected-height="40"></div>
<div class="gridItemMargins secondRowSecondColumn" data-offset-x="50" data-offset-y="20" data-expected-width="20" data-expected-height="40"></div>
</div>
</div>
</body>