tony@chromium.org | 16a286f | 2011-10-27 20:30:08 +0000 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <html> |
tony@chromium.org | da559b2 | 2012-10-05 04:37:39 +0000 | [diff] [blame] | 3 | <link href="resources/flexbox.css" rel="stylesheet"> |
tony@chromium.org | 16a286f | 2011-10-27 20:30:08 +0000 | [diff] [blame] | 4 | <style> |
| 5 | body { |
| 6 | margin: 0; |
| 7 | } |
| 8 | |
| 9 | .flexbox { |
tony@chromium.org | 16a286f | 2011-10-27 20:30:08 +0000 | [diff] [blame] | 10 | background-color: #aaa; |
| 11 | position: relative; |
| 12 | } |
| 13 | .horizontal { |
| 14 | width: 400px; |
| 15 | } |
| 16 | |
| 17 | .horizontal div { |
| 18 | width: 100%; |
| 19 | } |
| 20 | .vertical { |
hyatt@apple.com | 247170f | 2017-02-28 16:23:15 +0000 | [diff] [blame] | 21 | writing-mode: vertical-rl; |
tony@chromium.org | 16a286f | 2011-10-27 20:30:08 +0000 | [diff] [blame] | 22 | height: 50px; |
| 23 | } |
| 24 | .vertical div { |
| 25 | height: 100%; |
| 26 | } |
| 27 | |
| 28 | .flexbox > :nth-child(1) { |
| 29 | background-color: blue; |
| 30 | } |
| 31 | .flexbox > :nth-child(2) { |
| 32 | background-color: green; |
| 33 | } |
| 34 | .flexbox > :nth-child(3) { |
| 35 | background-color: red; |
| 36 | } |
| 37 | .flexbox > :nth-child(4) { |
| 38 | background-color: orange; |
| 39 | } |
| 40 | .child-div { |
| 41 | background-color: yellow; |
| 42 | } |
| 43 | </style> |
hyatt@apple.com | 247170f | 2017-02-28 16:23:15 +0000 | [diff] [blame] | 44 | <script src="../../resources/testharness.js"></script> |
| 45 | <script src="../../resources/testharnessreport.js"></script> |
| 46 | <script src="../../resources/check-layout-th.js"></script> |
tony@chromium.org | b1541ca | 2012-07-13 19:58:47 +0000 | [diff] [blame] | 47 | <body onload="checkLayout('.flexbox')"> |
hyatt@apple.com | 247170f | 2017-02-28 16:23:15 +0000 | [diff] [blame] | 48 | <div id=log></div> |
tony@chromium.org | da559b2 | 2012-10-05 04:37:39 +0000 | [diff] [blame] | 49 | <div class="flexbox column horizontal"> |
hyatt@apple.com | 247170f | 2017-02-28 16:23:15 +0000 | [diff] [blame] | 50 | <div data-expected-height="10" data-offset-y="0" style="flex: 1 0 10px;"></div> |
tony@chromium.org | 16a286f | 2011-10-27 20:30:08 +0000 | [diff] [blame] | 51 | <div data-expected-height="10" data-offset-y="10" style="height: 10px;"></div> |
| 52 | <div data-expected-height="10" data-offset-y="20"><div data-expected-height="10" data-offset-y="20" style="height: 10px"></div></div> |
| 53 | </div> |
| 54 | |
| 55 | <!-- The last div is sized to 0 because there is no available space, however its child overflows. --> |
tony@chromium.org | da559b2 | 2012-10-05 04:37:39 +0000 | [diff] [blame] | 56 | <div class="flexbox column horizontal"> |
hyatt@apple.com | 247170f | 2017-02-28 16:23:15 +0000 | [diff] [blame] | 57 | <div data-expected-height="0" data-offset-y="0" style="flex: 1;"></div> |
tony@chromium.org | 16a286f | 2011-10-27 20:30:08 +0000 | [diff] [blame] | 58 | <div data-expected-height="10" data-offset-y="0" style="height: 10px;"></div> |
hyatt@apple.com | 247170f | 2017-02-28 16:23:15 +0000 | [diff] [blame] | 59 | <div data-expected-height="10" data-offset-y="10" style="flex: 1 auto;"><div style="height: 10px"></div></div> |
| 60 | <div data-expected-height="10" data-offset-y="20" style="min-height: 0; flex: 1;"><div data-expected-height="10" data-offset-y="20" class="child-div" style="height: 10px"></div></div> |
tony@chromium.org | 16a286f | 2011-10-27 20:30:08 +0000 | [diff] [blame] | 61 | </div> |
| 62 | |
tony@chromium.org | da559b2 | 2012-10-05 04:37:39 +0000 | [diff] [blame] | 63 | <div class="flexbox column horizontal"> |
hyatt@apple.com | 247170f | 2017-02-28 16:23:15 +0000 | [diff] [blame] | 64 | <div data-expected-height="10" data-offset-y="10" style="flex: 1 0 10px; margin-top: 10px;"></div> |
tony@chromium.org | 16a286f | 2011-10-27 20:30:08 +0000 | [diff] [blame] | 65 | <div data-expected-height="10" data-offset-y="20" style="height: 10px; margin-bottom: 20px;"></div> |
| 66 | <div data-expected-height="20" data-offset-y="50" style="padding-top: 10px"><div data-expected-height="10" data-offset-y="60" style="height: 10px"></div></div> |
| 67 | </div> |
| 68 | |
tony@chromium.org | 730973c | 2012-06-01 23:18:21 +0000 | [diff] [blame] | 69 | <!-- Same as previous test case but with a justify-content set. Since there's no |
tony@chromium.org | 16a286f | 2011-10-27 20:30:08 +0000 | [diff] [blame] | 70 | available space, it should layout the same. --> |
tony@chromium.org | da559b2 | 2012-10-05 04:37:39 +0000 | [diff] [blame] | 71 | <div class="flexbox column horizontal justify-content-space-between"> |
hyatt@apple.com | 247170f | 2017-02-28 16:23:15 +0000 | [diff] [blame] | 72 | <div data-expected-height="10" data-offset-y="10" style="flex: 1 0 10px; margin-top: 10px;"></div> |
tony@chromium.org | 16a286f | 2011-10-27 20:30:08 +0000 | [diff] [blame] | 73 | <div data-expected-height="10" data-offset-y="20" style="height: 10px; margin-bottom: 20px;"></div> |
| 74 | <div data-expected-height="20" data-offset-y="50" style="padding-top: 10px"><div data-expected-height="10" data-offset-y="60" style="height: 10px"></div></div> |
| 75 | </div> |
| 76 | |
tony@chromium.org | da559b2 | 2012-10-05 04:37:39 +0000 | [diff] [blame] | 77 | <div class="flexbox column horizontal" data-expected-height="20"> |
hyatt@apple.com | 247170f | 2017-02-28 16:23:15 +0000 | [diff] [blame] | 78 | <div data-expected-height="10" data-offset-y="0" style="flex: 0 1 auto;"><div style="height: 10px"></div></div> |
| 79 | <div data-expected-height="10" data-offset-y="10" style="flex: 0 2 auto;"><div style="height: 10px"></div></div> |
tony@chromium.org | dcdb107 | 2012-03-14 22:56:15 +0000 | [diff] [blame] | 80 | </div> |
| 81 | |
tony@chromium.org | da559b2 | 2012-10-05 04:37:39 +0000 | [diff] [blame] | 82 | <div class="flexbox column horizontal" style="min-height: 10px" data-expected-height="20"> |
hyatt@apple.com | 247170f | 2017-02-28 16:23:15 +0000 | [diff] [blame] | 83 | <div data-expected-height="10" data-offset-y="0" style="flex: 0 1 auto;"><div style="height: 10px"></div></div> |
| 84 | <div data-expected-height="10" data-offset-y="10" style="flex: 0 2 auto;"><div style="height: 10px"></div></div> |
tony@chromium.org | dcdb107 | 2012-03-14 22:56:15 +0000 | [diff] [blame] | 85 | </div> |
| 86 | |
tony@chromium.org | da559b2 | 2012-10-05 04:37:39 +0000 | [diff] [blame] | 87 | <div class="flexbox column horizontal" style="min-height: 5px; max-height: 17px;" data-expected-height="17"> |
hyatt@apple.com | 247170f | 2017-02-28 16:23:15 +0000 | [diff] [blame] | 88 | <div data-expected-height="9" data-offset-y="0" style="min-height: 0; flex: 0 1 auto;"><div style="height: 10px"></div></div> |
| 89 | <div data-expected-height="8" data-offset-y="9" style="min-height: 0; flex: 0 2 auto;"><div style="height: 10px"></div></div> |
tony@chromium.org | dcdb107 | 2012-03-14 22:56:15 +0000 | [diff] [blame] | 90 | </div> |
| 91 | |
tony@chromium.org | da559b2 | 2012-10-05 04:37:39 +0000 | [diff] [blame] | 92 | <div class="flexbox column horizontal" style="min-height: 5px; max-height: 30px; padding-top: 1px; padding-bottom: 2px;" data-expected-height="33"> |
hyatt@apple.com | 247170f | 2017-02-28 16:23:15 +0000 | [diff] [blame] | 93 | <div data-expected-height="15" data-offset-y="1" style="min-height: 0; flex: 0 1 auto;"><div style="height: 20px"></div></div> |
| 94 | <div data-expected-height="15" data-offset-y="16" style="min-height: 0; flex: 0 1 auto;"><div style="height: 20px"></div></div> |
tony@chromium.org | dcdb107 | 2012-03-14 22:56:15 +0000 | [diff] [blame] | 95 | </div> |
| 96 | |
tony@chromium.org | da559b2 | 2012-10-05 04:37:39 +0000 | [diff] [blame] | 97 | <div class="flexbox column horizontal"> |
tony@chromium.org | 00a34ec | 2012-03-16 20:16:17 +0000 | [diff] [blame] | 98 | <div data-expected-client-height="10" data-offset-y="0" style="overflow: scroll"><div data-expected-height=10 style="height: 10px"></div></div> |
| 99 | </div> |
| 100 | |
tony@chromium.org | da559b2 | 2012-10-05 04:37:39 +0000 | [diff] [blame] | 101 | <div class="flexbox column vertical"> |
hyatt@apple.com | 247170f | 2017-02-28 16:23:15 +0000 | [diff] [blame] | 102 | <div data-expected-width="10" data-offset-x="20" style="flex: 1 0 10px;"></div> |
tony@chromium.org | 16a286f | 2011-10-27 20:30:08 +0000 | [diff] [blame] | 103 | <div data-expected-width="10" data-offset-x="10" style="width: 10px;"></div> |
| 104 | <div data-expected-width="10" data-offset-x="0"><div data-expected-width="10" data-offset-x="0" style="width: 10px"></div></div> |
| 105 | </div> |
| 106 | |
| 107 | <!-- The first div overflows to the left, so give it a margin-left so we can see box it paints. --> |
tony@chromium.org | da559b2 | 2012-10-05 04:37:39 +0000 | [diff] [blame] | 108 | <div class="flexbox column vertical" style="margin-left: 100px;"> |
hyatt@apple.com | 247170f | 2017-02-28 16:23:15 +0000 | [diff] [blame] | 109 | <div data-expected-width="50" data-offset-x="20" style="min-width: 0; flex: 1;"><div data-expected-width="50" data-offset-x="20" class="child-div" style="width: 50px"></div></div> |
| 110 | <div data-expected-width="0" data-offset-x="20" style="flex: 1;"></div> |
tony@chromium.org | 16a286f | 2011-10-27 20:30:08 +0000 | [diff] [blame] | 111 | <div data-expected-width="10" data-offset-x="10" style="width: 10px;"></div> |
hyatt@apple.com | 247170f | 2017-02-28 16:23:15 +0000 | [diff] [blame] | 112 | <div data-expected-width="10" data-offset-x="0" style="flex: 1 auto;"><div style="width: 10px"></div></div> |
tony@chromium.org | 16a286f | 2011-10-27 20:30:08 +0000 | [diff] [blame] | 113 | </div> |
| 114 | |
| 115 | </body> |
| 116 | </html> |