| <!DOCTYPE html> |
| <link href="resources/grid.css" rel="stylesheet"> |
| <link href="resources/grid-alignment.css" rel="stylesheet"> |
| <style> |
| body { margin: 0; } |
| .container { |
| position: relative; |
| font: 10px/1 Ahem; |
| border: 5px solid; |
| width: 470px; |
| } |
| .grid { |
| display: inline-grid; |
| grid-template-columns: 50px 50px; |
| width: 150px; |
| background-color: transparent; |
| position: relative; |
| } |
| .twoRows { grid-template-rows: 50px 50px; } |
| .threeRows { grid-template-rows: 50px 50px 50px; } |
| .empty { |
| border-color: black; |
| border-style: solid; |
| margin: 15px 0px 30px; |
| border-width: 5px 0px 10px; |
| padding: 10px 0px 20px; |
| } |
| .item { |
| height: 25px; |
| border-color: black; |
| border-style: solid; |
| } |
| .style1 { |
| border-width: 5px 0px 10px; |
| padding: 10px 0px 20px; |
| } |
| .style2 { |
| border-width: 10px 0px 5px; |
| padding: 20px 0px 10px; |
| margin-top: 10px; |
| } |
| .style3 { |
| border-width: 10px 0px 20px; |
| padding: 5px 0px 10px; |
| margin-top: 20px; |
| } |
| |
| .bothRowFirstColumn, .secondRowSecondColumn { |
| margin-right: 10px; |
| margin-top: 10px; |
| margin-bottom: 10px; |
| background-color: pink; |
| } |
| .firstRowBothColumn, .secondRowBothColumn { |
| margin-top: 15px; |
| margin-bottom: 15px; |
| background-color: green; |
| } |
| </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, container')"> |
| <div id="log"></div> |
| <p> |
| The test shows 3 grids each of them with 3 items sorted differently in the DOM.<br> |
| Each grid container must use its first (grid order) item to compute its baseline, and using document-oder in case of element with same grid-order. Hence they might be baseline aligned each other accordingly. |
| </p> |
| |
| <p> |
| This case shows 3 items located along the first row and in different columns, so grid baseline is computed using the one located at first column (blue item). |
| </p> |
| <div class="container" data-expected-width="480" data-expected-height="120"> |
| <div class="grid" data-offset-x="0" data-offset-y="20"> |
| <div class="item style1 firstRowFirstColumn" data-offset-x="0" data-offset-y="0"></div> |
| <div class="item style2 firstRowSecondColumn" data-offset-x="50" data-offset-y="10"></div> |
| <div class="item style3 firstRowThirdColumn" data-offset-x="100" data-offset-y="20"></div> |
| </div> |
| <div class="grid" data-offset-x="160" data-offset-y="10"> |
| <div class="item style1 firstRowThirdColumn" data-offset-x="100" data-offset-y="0"></div> |
| <div class="item style2 firstRowFirstColumn" data-offset-x="0" data-offset-y="10"></div> |
| <div class="item style3 firstRowSecondColumn" data-offset-x="50" data-offset-y="20"></div> |
| </div> |
| <div class="grid" data-offset-x="320" data-offset-y="0"> |
| <div class="item style1 firstRowSecondColumn" data-offset-x="50" data-offset-y="0"></div> |
| <div class="item style2 firstRowThirdColumn" data-offset-x="100" data-offset-y="10"></div> |
| <div class="item style3 firstRowFirstColumn" data-offset-x="0" data-offset-y="20"></div> |
| </div> |
| </div> |
| |
| <p> |
| This case shows 3 items located along the first row and in different columns, so such item is used to determine the grid's baseline instead of using the grid order. |
| </p> |
| <div class="container" data-expected-width="480" data-expected-height="120"> |
| <div class="grid" data-offset-x="0" data-offset-y="0"> |
| <div class="item style1 firstRowFirstColumn" data-offset-x="0" data-offset-y="0"></div> |
| <div class="item style2 firstRowSecondColumn" data-offset-x="50" data-offset-y="10"></div> |
| <div class="item style3 firstRowThirdColumn alignSelfBaseline" data-offset-x="100" data-offset-y="20"></div> |
| </div> |
| <div class="grid" data-offset-x="160" data-offset-y="0"> |
| <div class="item style1 firstRowThirdColumn" data-offset-x="100" data-offset-y="0"></div> |
| <div class="item style2 firstRowFirstColumn" data-offset-x="0" data-offset-y="10"></div> |
| <div class="item style3 firstRowSecondColumn alignSelfBaseline" data-offset-x="50" data-offset-y="20"></div> |
| </div> |
| <div class="grid" data-offset-x="320" data-offset-y="20"> |
| <div class="item style1 firstRowSecondColumn alignSelfBaseline" data-offset-x="50" data-offset-y="0"></div> |
| <div class="item style2 firstRowThirdColumn" data-offset-x="100" data-offset-y="10"></div> |
| <div class="item style3 firstRowFirstColumn" data-offset-x="0" data-offset-y="20"></div> |
| </div> |
| </div> |
| |
| <p> |
| This case shows 3 items' areas intersecting the first row and first column, so the dom order must be used to determine each grid's baseline. |
| </p> |
| <div class="container" data-expected-width="480" data-expected-height="165"> |
| <div class="grid twoRows" data-offset-x="0" data-offset-y="40"> |
| <div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0"></div> |
| <div class="firstRowBothColumn" data-offset-x="0" data-offset-y="15"></div> |
| <div class="bothRowFirstColumn" data-offset-x="0" data-offset-y="10"></div> |
| </div> |
| <div class="grid twoRows" data-offset-x="160" data-offset-y="0"> |
| <div class="bothRowFirstColumn" data-offset-x="0" data-offset-y="10"></div> |
| <div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0"></div> |
| <div class="firstRowBothColumn" data-offset-x="0" data-offset-y="15"></div> |
| </div> |
| <div class="grid twoRows" data-offset-x="320" data-offset-y="55"> |
| <div class="firstRowBothColumn" data-offset-x="0" data-offset-y="15"></div> |
| <div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0"></div> |
| <div class="bothRowFirstColumn" data-offset-x="0" data-offset-y="10"></div> |
| </div> |
| </div> |
| |
| <p> |
| This case shows 3 items' areas intersecting the first row and first column, but one of the items participates in baseline alignment, so such item is used to determine the grid's baseline instead of using the dom order. |
| </p> |
| <div class="container" data-expected-width="480" data-expected-height="165"> |
| <div class="grid twoRows" data-offset-x="0" data-offset-y="55"> |
| <div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0"></div> |
| <div class="firstRowBothColumn alignSelfBaseline" style="width: 100px; height: 20px;" data-offset-x="0" data-offset-y="15"></div> |
| <div class="bothRowFirstColumn" data-offset-x="0" data-offset-y="10"></div> |
| </div> |
| <div class="grid twoRows" data-offset-x="160" data-offset-y="40"> |
| <div class="bothRowFirstColumn" data-offset-x="0" data-offset-y="10"></div> |
| <div class="firstRowFirstColumn alignSelfBaseline" style="width: 50px; height: 50px;" data-offset-x="0" data-offset-y="0"></div> |
| <div class="firstRowBothColumn" data-offset-x="0" data-offset-y="15"></div> |
| </div> |
| <div class="grid twoRows" data-offset-x="320" data-offset-y="0"> |
| <div class="firstRowBothColumn" data-offset-x="0" data-offset-y="15"></div> |
| <div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0"></div> |
| <div class="bothRowFirstColumn alignSelfBaseline" style="width: 40px; height: 80px;" data-offset-x="0" data-offset-y="10"></div> |
| </div> |
| </div> |
| |
| <p> |
| This case shows one of the grids with no items, hence its baseline must be synthesized. |
| </p> |
| <div class="container" data-expected-width="480" data-expected-height="250"> |
| <div class="grid twoRows" data-offset-x="0" data-offset-y="140"> |
| <div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0"></div> |
| <div class="firstRowBothColumn" data-offset-x="0" data-offset-y="15"></div> |
| <div class="bothRowFirstColumn" data-offset-x="0" data-offset-y="10"></div> |
| </div> |
| <div class="grid twoRows" data-offset-x="160" data-offset-y="100"> |
| <div class="bothRowFirstColumn" data-offset-x="0" data-offset-y="10"></div> |
| <div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0"></div> |
| <div class="firstRowBothColumn" data-offset-x="0" data-offset-y="15"></div> |
| </div> |
| <div class="grid empty twoRows" data-offset-x="320" data-offset-y="15"> |
| </div> |
| </div> |
| |
| <p> |
| This case shows one of the grids with no items in the first row, hence its baseline must be synthesized. |
| </p> |
| <div class="container" data-expected-width="480" data-expected-height="300"> |
| <div class="grid twoRows" data-offset-x="0" data-offset-y="190"> |
| <div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0"></div> |
| <div class="firstRowBothColumn" data-offset-x="0" data-offset-y="15"></div> |
| <div class="bothRowFirstColumn" data-offset-x="0" data-offset-y="10"></div> |
| </div> |
| <div class="grid twoRows" data-offset-x="160" data-offset-y="150"> |
| <div class="bothRowFirstColumn" data-offset-x="0" data-offset-y="10"></div> |
| <div class="firstRowFirstColumn" data-offset-x="0" data-offset-y="0"></div> |
| <div class="firstRowBothColumn" data-offset-x="0" data-offset-y="15"></div> |
| </div> |
| <div class="grid empty threeRows" data-offset-x="320" data-offset-y="15"> |
| <div class="secondRowFirstColumn" data-offset-x="0" data-offset-y="60"></div> |
| <div class="thirdRowSecondColumn" data-offset-x="50" data-offset-y="110"></div> |
| <div class="secondRowBothColumn" data-offset-x="0" data-offset-y="75"></div> |
| </div> |
| </div> |
| |
| </body> |