| <!DOCTYPE html> |
| <html> |
| <link href="resources/flexbox.css" rel="stylesheet"> |
| <style> |
| body { |
| margin: 0; |
| } |
| .flexbox { |
| height: 100px; |
| background-color: #aaa; |
| position: relative; |
| writing-mode: vertical-rl; |
| -webkit-text-orientation: sideways-right; |
| } |
| .flexbox div { |
| border: 0; |
| } |
| |
| .flexbox :nth-child(1) { |
| background-color: blue; |
| } |
| .flexbox :nth-child(2) { |
| background-color: green; |
| } |
| .flexbox :nth-child(3) { |
| background-color: red; |
| } |
| .flexbox :nth-child(4) { |
| background-color: yellow; |
| } |
| .flexbox :nth-child(5) { |
| background-color: purple; |
| } |
| .flexbox :nth-child(6) { |
| background-color: orange; |
| } |
| .flexbox :nth-child(7) { |
| background-color: lime; |
| } |
| .flexbox :nth-child(8) { |
| background-color: lightblue; |
| } |
| .flexbox :nth-child(9) { |
| background-color: darkred; |
| } |
| .flexbox :nth-child(10) { |
| background-color: gold; |
| } |
| .flexbox :nth-child(11) { |
| background-color: salmon; |
| } |
| </style> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <script src="../../resources/check-layout-th.js"></script> |
| <body onload="checkLayout('.flexbox')"> |
| <div id=log></div> |
| |
| <!-- stretch is the default align-items so these flexitems should all have the same height. --> |
| <div class="flexbox"> |
| <div data-expected-width="100" class="flex-one"></div> |
| <div data-expected-width="100" class="flex-one" style="width: 100px"></div> |
| <div data-expected-width="100" class="flex-one"></div> |
| </div> |
| |
| <div class="flexbox"> |
| <div data-expected-width="60" data-offset-x="60" class="flex-one" style="width: 60px;"></div> |
| <div data-expected-width="120" data-offset-x="0" class="flex-one"></div> |
| <div data-expected-width="60" data-offset-x="30" class="flex-one" style="width: 60px; margin: auto;"></div> |
| <div data-expected-width="0" data-offset-x="60" class="flex-one" style="margin: 0 auto;"></div> |
| <div data-expected-width="100" data-offset-x="10" class="flex-one" style="width: 100px; margin: 0 10px;"></div> |
| <div data-expected-width="50" data-offset-x="50" class="flex-one" style="width: 50px; margin: 0 20px 0 10px;"></div> |
| <div data-expected-width="90" data-offset-x="10" class="flex-one" style="margin: 0 20px 0 10px;"></div> |
| <div data-expected-width="120" data-offset-x="0" class="flex-one"> |
| <div data-expected-width="120" style="width: 100%; background-color:black"></div> |
| </div> |
| </div> |
| |
| <div class="flexbox" style="width: 100px;"> |
| <div data-expected-width="50" data-offset-x="50" class="flex-one" style="width: 50px;"></div> |
| <div data-expected-width="100" data-offset-x="0" class="flex-one"></div> |
| <div data-expected-width="100" data-offset-x="0" class="flex-one" style="width: 100%;"> |
| <div data-expected-width="100" style="width: 100%; background-color:black"></div> |
| </div> |
| </div> |
| |
| <div class="flexbox" style="width: 100px;"> |
| <div data-expected-width="50" data-offset-x="50" class="flex-one" style="width: 50px;"></div> |
| <div data-expected-width="100" data-offset-x="0" class="flex-one"></div> |
| </div> |
| |
| <div class="flexbox"> |
| <div data-expected-width="0" data-offset-x="100" class="flex-one align-self-flex-start"></div> |
| <div data-expected-width="50" data-offset-x="50" class="flex-one align-self-flex-start" style="width: 50px;"></div> |
| <div data-expected-width="50" data-offset-x="25" class="flex-one align-self-flex-start" style="width: 50px; margin: 0 auto"></div> |
| <div data-expected-width="50" data-offset-x="0" class="flex-one align-self-flex-start" style="width: 50px; margin: 0 auto 0 0"></div> |
| <div data-expected-width="50" data-offset-x="50" class="flex-one align-self-flex-start" style="width: 50px; margin: 0 0 0 auto"></div> |
| <div data-expected-width="50" data-offset-x="25" class="flex-one align-self-flex-start" style="width: 50px; margin: 0 25px"></div> |
| <div data-expected-width="50" data-offset-x="30" class="flex-one align-self-flex-start" style="width: 50px; margin: 0 20px 0 10px;"></div> |
| <div data-expected-width="100" data-offset-x="0" class="flex-one" style="width: 100px;"></div> |
| </div> |
| |
| <div class="flexbox"> |
| <div data-expected-width="0" data-offset-x="0" class="flex-one align-self-flex-end"></div> |
| <div data-expected-width="50" data-offset-x="0" class="flex-one align-self-flex-end" style="width: 50px;"></div> |
| <div data-expected-width="50" data-offset-x="25" class="flex-one align-self-flex-end" style="width: 50px; margin: 0 auto"></div> |
| <div data-expected-width="50" data-offset-x="0" class="flex-one align-self-flex-end" style="width: 50px; margin: 0 auto 0 0"></div> |
| <div data-expected-width="50" data-offset-x="50" class="flex-one align-self-flex-end" style="width: 50px; margin: 0 0 0 auto"></div> |
| <div data-expected-width="50" data-offset-x="25" class="flex-one align-self-flex-end" style="width: 50px; margin: 0 25px"></div> |
| <div data-expected-width="50" data-offset-x="10" class="flex-one align-self-flex-end" style="width: 50px; margin: 0 20px 0 10px;"></div> |
| <div data-expected-width="100" data-offset-x="0" class="flex-one" style="width: 100px;"></div> |
| </div> |
| |
| <div class="flexbox"> |
| <div data-expected-width="0" data-offset-x="50" class="flex-one align-self-center"></div> |
| <div data-expected-width="50" data-offset-x="25" class="flex-one align-self-center" style="width: 50px;"></div> |
| <div data-expected-width="50" data-offset-x="25" class="flex-one align-self-center" style="width: 50px; margin: 0 auto"></div> |
| <div data-expected-width="50" data-offset-x="0" class="flex-one align-self-center" style="width: 50px; margin: 0 auto 0 0"></div> |
| <div data-expected-width="50" data-offset-x="50" class="flex-one align-self-center" style="width: 50px; margin: 0 0 0 auto"></div> |
| <div data-expected-width="50" data-offset-x="25" class="flex-one align-self-center" style="width: 50px; margin: 0 25px"></div> |
| <div data-expected-width="50" data-offset-x="20" class="flex-one align-self-center" style="width: 50px; margin: 0 20px 0 10px;"></div> |
| <div data-expected-width="100" data-offset-x="0" class="flex-one" style="width: 100px;"></div> |
| </div> |
| |
| <div class="flexbox"> |
| <div data-expected-width="50" data-offset-x="50" class="flex-one align-self-flex-start" style="width: 50px;"></div> |
| <div data-expected-width="50" data-offset-x="25" class="flex-one align-self-center" style="width: 50px;"></div> |
| <div data-expected-width="50" data-offset-x="0" class="flex-one align-self-flex-end" style="width: 50px;"></div> |
| <div data-expected-width="50" data-offset-x="50" class="flex-one" style="width: 50px; margin: auto 0"></div> |
| <div data-expected-width="100" data-offset-x="0" class="flex-one"></div> |
| <div data-expected-width="100" data-offset-x="0" class="flex-one" style="width: 100px;"></div> |
| </div> |
| |
| <div class="flexbox"> |
| <div data-expected-width="50" data-offset-x="50" class="flex-one align-self-flex-start" style="width: 50px; writing-mode: horizontal-tb;"></div> |
| <div data-expected-width="50" data-offset-x="25" class="flex-one align-self-center" style="width: 50px; writing-mode: horizontal-tb;"></div> |
| <div data-expected-width="50" data-offset-x="0" class="flex-one align-self-flex-end" style="width: 50px; writing-mode: horizontal-tb;"></div> |
| <div data-expected-width="50" data-offset-x="50" class="flex-one" style="width: 50px; margin: auto 0; writing-mode: horizontal-tb;"></div> |
| <div data-expected-width="100" data-offset-x="0" class="flex-one" style="width: 100px; writing-mode: horizontal-tb;"></div> |
| </div> |
| |
| <div class="flexbox"> |
| <div data-expected-width="20" data-offset-x="70" class="flex-one align-self-baseline" style="width: 20px;"></div> |
| <div data-expected-width="10" data-offset-x="70" class="flex-one align-self-baseline" style="width: 10px; margin: 0 20px 0 10px;"></div> |
| <div data-expected-width="10" data-offset-x="70" class="flex-one align-self-baseline" style="width: 10px; margin: 0 20px 0 0;"></div> |
| <div data-expected-width="100" data-offset-x="0" class="flex-one" style="width: 100px;"></div> |
| </div> |
| |
| <div class="flexbox"> |
| <div id="baseline1" class="flex-one align-self-baseline">ahem</div> |
| <div id="baseline2" class="flex-one align-self-baseline"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px;"></div> |
| <div data-expected-width="50" data-offset-x="25" class="flex-one align-self-center"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px; vertical-align: middle"></div> |
| <div id="baseline3" data-expected-width="50" class="flex-one align-self-baseline"><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="flex-one" style="width: 100px;"></div> |
| </div> |
| |
| <div class="flexbox"> |
| <div id="baseline4" class="flex-one align-self-baseline">ahem</div> |
| <div id="baseline5" class="flex-one align-self-baseline"><br><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px;"></div> |
| <div data-expected-width="50" data-offset-x="50" class="flex-one align-self-baseline"><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="flex-one" style="width: 100px;"></div> |
| </div> |
| |
| <div class="flexbox" style="writing-mode: vertical-lr"> |
| <div id="baseline6" class="flex-one align-self-baseline">ahem</div> |
| <div id="baseline7" class="flex-one align-self-baseline"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px;"></div> |
| <div data-expected-width="50" data-offset-x="25" class="flex-one align-self-center"><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="flex-one align-self-baseline"><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="flex-one" style="width: 100px;"></div> |
| </div> |
| |
| <div class="flexbox" style="writing-mode: vertical-lr"> |
| <div id="baseline8" class="flex-one align-self-baseline">ahem</div> |
| <div id="baseline9" class="flex-one align-self-baseline"><br><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px;"></div> |
| <div data-expected-width="50" data-offset-x="0" class="flex-one align-self-baseline"><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="flex-one" 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> |