| <!DOCTYPE html> |
| <html> |
| <head> |
| <link href="resources/grid.css" rel="stylesheet"> |
| <link href="resources/grid-alignment.css" rel="stylesheet"> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <script src="../../resources/check-layout-th.js"></script> |
| <style> |
| body { |
| margin: 0; |
| } |
| |
| .grid { |
| height: 600px; |
| grid-auto-columns: 1fr; |
| margin-bottom: 20px; |
| position: relative; |
| writing-mode: vertical-rl; |
| text-orientation: sideways-right; |
| } |
| |
| .grid :nth-child(1) { background-color: brown; } |
| .grid :nth-child(2) { background-color: green; } |
| .grid :nth-child(3) { background-color: red; } |
| .grid :nth-child(4) { background-color: yellow; } |
| .grid :nth-child(5) { background-color: purple; } |
| .grid :nth-child(6) { background-color: orange; } |
| .grid :nth-child(7) { background-color: lime; } |
| .grid :nth-child(8) { background-color: lightblue; } |
| .grid :nth-child(9) { background-color: darkred; } |
| .grid :nth-child(10) { background-color: gold; } |
| .grid :nth-child(11) { background-color: salmon; } |
| |
| .firstRowThirdColumn { |
| grid-row: 1; |
| grid-column: 3; |
| } |
| .firstRowFourthColumn { |
| grid-row: 1; |
| grid-column: 4; |
| } |
| .firstRowFifthColumn { |
| grid-row: 1; |
| grid-column: 5; |
| } |
| .grid > div { |
| min-width: 0px; |
| } |
| </style> |
| </head> |
| <body onload="checkLayout('.grid')"> |
| |
| <div class="grid"> |
| <div data-expected-width="20" data-offset-x="70" class="firstRowFirstColumn alignSelfBaseline" style="width: 20px;"></div> |
| <div data-expected-width="10" data-offset-x="70" class="firstRowSecondColumn alignSelfBaseline" style="width: 10px; margin: 0 20px 0 10px;"></div> |
| <div data-expected-width="10" data-offset-x="70" class="firstRowThirdColumn alignSelfBaseline" style="width: 10px; margin: 0 20px 0 0;"></div> |
| <div data-expected-width="100" data-offset-x="0" class="firstRowFourthColumn" style="width: 100px;"></div> |
| </div> |
| |
| <div class="grid"> |
| <div id="baseline1" class="firstRowFirstColumn alignSelfBaseline">ahem</div> |
| <div id="baseline2" class="firstRowSecondColumn-one alignSelfBaseline"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px;"></div> |
| <div data-expected-width="50" data-offset-x="25" class="firstRowThirdColumn alignSelfCenter"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px; vertical-align: middle"></div> |
| <div id="baseline3" data-expected-width="50" class="firstRowFourthColumn alignSelfBaseline"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px; vertical-align: middle"></div> |
| <div data-expected-width="100" data-offset-x="0" class="firstRowFifthColumn" style="width: 100px;"></div> |
| </div> |
| |
| <div class="grid"> |
| <div id="baseline4" class="firstRowFirstColumn alignSelfBaseline">ahem</div> |
| <div id="baseline5" class="firstRowSecondColumn alignSelfBaseline"><br><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px;"></div> |
| <div data-expected-width="50" data-offset-x="50" class="firstRowThirdColumn alignSelfBaseline"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px; vertical-align: middle"></div> |
| <div data-expected-width="100" data-offset-x="0" class="firstRowFourthColumn" style="width: 100px;"></div> |
| </div> |
| |
| <div class="grid" style="-webkit-writing-mode: vertical-lr"> |
| <div id="baseline6" data-offset-x="18" class="firstRowFirstColumn alignSelfBaseline">ahem</div> |
| <div id="baseline7" data-offset-x="18" class="firstRowSecondColumn alignSelfBaseline"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px;"></div> |
| <div data-expected-width="50" data-offset-x="25" class="firstRowThirdColumn alignSelfCenter"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px; vertical-align: middle"></div> |
| <div data-expected-width="50" data-offset-x="0" class="firstRowFourthColumn alignSelfBaseline"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px; vertical-align: middle"></div> |
| <div data-expected-width="100" data-offset-x="0" class="firstRowFifthColumn" style="width: 100px;"></div> |
| </div> |
| |
| <div class="grid" style="-webkit-writing-mode: vertical-lr"> |
| <div id="baseline8" class="firstRowFirstColumn alignSelfBaseline">ahem</div> |
| <div id="baseline9" class="firstRowSecondColumn alignSelfBaseline"><br><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px;"></div> |
| <div data-expected-width="50" data-offset-x="0" class="firstRowThirdColumn alignSelfBaseline"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px; vertical-align: middle"></div> |
| <div data-expected-width="100" data-offset-x="0" class="firstRowFourthColumn" style="width: 100px;"></div> |
| </div> |
| |
| <div id="results"></div> |
| |
| <script> |
| function additionalBaselineChecks() |
| { |
| var baseline1 = document.getElementById("baseline1"); |
| var baseline2 = document.getElementById("baseline2"); |
| var baseline3 = document.getElementById("baseline3"); |
| logIfFalse(baseline1.offsetLeft == baseline2.offsetLeft, |
| "baseline1 and baseline2 should have the same baseline."); |
| logIfFalse(baseline3.offsetLeft + baseline3.offsetWidth > 75, |
| "baseline3 should be above the center align-itemsed item."); |
| |
| var baseline4 = document.getElementById("baseline4"); |
| var baseline5 = document.getElementById("baseline5"); |
| logIfFalse(baseline4.offsetLeft + baseline4.offsetWidth == baseline5.offsetLeft + baseline5.offsetWidth, |
| "baseline4 and baseline5 should be right aligned with each other."); |
| logIfFalse(baseline4.offsetLeft + baseline4.offsetWidth < 100, |
| "baseline4 and baseline5 should be below baseline6."); |
| |
| var baseline6 = document.getElementById("baseline6"); |
| var baseline7 = document.getElementById("baseline7"); |
| logIfFalse(baseline6.offsetLeft == baseline7.offsetLeft, |
| "baseline6 and baseline7 should have the same baseline."); |
| |
| var baseline8 = document.getElementById("baseline8"); |
| var baseline9 = document.getElementById("baseline9"); |
| logIfFalse(baseline8.offsetLeft == baseline9.offsetLeft, |
| "baseline8 and baseline9 should be left aligned with each other."); |
| |
| } |
| |
| function logIfFalse(condition, msg) |
| { |
| if (!condition) |
| document.getElementById("results").innerHTML += msg + "<br/>"; |
| } |
| |
| additionalBaselineChecks(); |
| </script> |
| |
| </body> |
| </html> |