9 display: -webkit-flexbox;
10 background-color: #aaa;
17 .flexbox :nth-child(1) {
18 background-color: blue;
20 .flexbox :nth-child(2) {
21 background-color: green;
23 .flexbox :nth-child(3) {
24 background-color: red;
26 .flexbox :nth-child(4) {
27 background-color: yellow;
29 .flexbox :nth-child(5) {
30 background-color: purple;
32 .flexbox :nth-child(6) {
33 background-color: orange;
35 .flexbox :nth-child(7) {
36 background-color: lime;
40 src: url(../../resources/Ahem.ttf);
44 if (window.layoutTestController)
45 layoutTestController.dumpAsText();
47 <script src="resources/flexbox.js"></script>
48 <body onload="checkFlexBoxen()">
50 <!-- stretch is the default flex-align so these flexitems should all have the same height. -->
52 <div data-expected-height="100" style="width: -webkit-flex(1 0 0);"></div>
53 <div data-expected-height="100" style="width: -webkit-flex(1 0 0); height: 100px"></div>
54 <div data-expected-height="100" style="width: -webkit-flex(1 0 0);"></div>
58 <div data-expected-height="60" data-offset-y="0" style="width: -webkit-flex(1 0 0); height: 60px; margin: auto 0;"></div>
59 <div data-expected-height="120" data-offset-y="0" style="width: -webkit-flex(1 0 0); margin: auto 0 0;"></div>
60 <div data-expected-height="120" data-offset-y="0" style="width: -webkit-flex(1 0 0); margin: auto 0;"></div>
61 <div data-expected-height="100" data-offset-y="10" style="width: -webkit-flex(1 0 0); height: 100px; margin: 10px 0;"></div>
62 <div data-expected-height="50" data-offset-y="20" style="width: -webkit-flex(1 0 0); height: 50px; margin: 20px 0 10px;"></div>
63 <div data-expected-height="90" data-offset-y="20" style="width: -webkit-flex(1 0 0); margin: 20px 0 10px;"></div>
64 <div data-expected-height="120" data-offset-y="0" style="width: -webkit-flex(1 0 0);">
65 <!-- Since no parent has a fixed height, this div shrink-wraps. -->
66 <div data-expected-height="0" style="height: 100%; background-color:black"></div>
70 <div class="flexbox" style="height: 100px;">
71 <div data-expected-height="50" data-offset-y="0" style="width: -webkit-flex(1 0 0); height: 50px;"></div>
72 <div data-expected-height="100" data-offset-y="0" style="width: -webkit-flex(1 0 0);"></div>
73 <div data-expected-height="100" data-offset-y="0" style="width: -webkit-flex(1 0 0); height: 100%;">
74 <div data-expected-height="100" style="height: 100%; background-color:black"></div>
78 <div class="flexbox" style="height: 100px;">
79 <div data-expected-height="50" data-offset-y="0" style="width: -webkit-flex(1 0 0); height: 50px;"></div>
80 <div data-expected-height="100" data-offset-y="0" style="width: -webkit-flex(1 0 0);"></div>
84 <div data-expected-height="50" data-offset-y="0" style="width: -webkit-flex(1 0 0); height: 50px; margin: auto 0 0;"></div>
85 <div data-expected-height="70" data-offset-y="0" style="width: -webkit-flex(1 0 0); height: 70px; margin: 0 0 auto"></div>
86 <div data-expected-height="70" data-offset-y="0" style="width: -webkit-flex(1 0 0); height: 70px;"></div>
87 <div data-expected-height="100" data-offset-y="0" style="width: -webkit-flex(1 0 0); height: 100px;"></div>
91 <div data-expected-height="0" data-offset-y="0" style="width: -webkit-flex(1 0 0); -webkit-flex-align: start;"></div>
92 <div data-expected-height="50" data-offset-y="0" style="width: -webkit-flex(1 0 0); -webkit-flex-align: start; height: 50px;"></div>
93 <div data-expected-height="50" data-offset-y="0" style="width: -webkit-flex(1 0 0); -webkit-flex-align: start; height: 50px; margin: auto 0"></div>
94 <div data-expected-height="50" data-offset-y="0" style="width: -webkit-flex(1 0 0); -webkit-flex-align: start; height: 50px; margin: auto 0 0"></div>
95 <div data-expected-height="50" data-offset-y="25" style="width: -webkit-flex(1 0 0); -webkit-flex-align: start; height: 50px; margin: 25px 0"></div>
96 <div data-expected-height="50" data-offset-y="20" style="width: -webkit-flex(1 0 0); -webkit-flex-align: start; height: 50px; margin: 20px 0 10px;"></div>
97 <div data-expected-height="100" data-offset-y="0" style="width: -webkit-flex(1 0 0); height: 100px;"></div>
100 <div class="flexbox">
101 <div data-expected-height="0" data-offset-y="100" style="width: -webkit-flex(1 0 0); -webkit-flex-align: end;"></div>
102 <div data-expected-height="50" data-offset-y="50" style="width: -webkit-flex(1 0 0); -webkit-flex-align: end; height: 50px;"></div>
103 <div data-expected-height="50" data-offset-y="50" style="width: -webkit-flex(1 0 0); -webkit-flex-align: end; height: 50px; margin: auto 0"></div>
104 <div data-expected-height="50" data-offset-y="50" style="width: -webkit-flex(1 0 0); -webkit-flex-align: end; height: 50px; margin: auto 0 0"></div>
105 <div data-expected-height="50" data-offset-y="25" style="width: -webkit-flex(1 0 0); -webkit-flex-align: end; height: 50px; margin: 25px 0"></div>
106 <div data-expected-height="50" data-offset-y="40" style="width: -webkit-flex(1 0 0); -webkit-flex-align: end; height: 50px; margin: 20px 0 10px;"></div>
107 <div data-expected-height="100" data-offset-y="0" style="width: -webkit-flex(1 0 0); height: 100px;"></div>
110 <div class="flexbox">
111 <div data-expected-height="0" data-offset-y="50" style="width: -webkit-flex(1 0 0); -webkit-flex-align: center;"></div>
112 <div data-expected-height="50" data-offset-y="25" style="width: -webkit-flex(1 0 0); -webkit-flex-align: center; height: 50px;"></div>
113 <div data-expected-height="50" data-offset-y="25" style="width: -webkit-flex(1 0 0); -webkit-flex-align: center; height: 50px; margin: auto 0"></div>
114 <div data-expected-height="50" data-offset-y="25" style="width: -webkit-flex(1 0 0); -webkit-flex-align: center; height: 50px; margin: auto 0 0"></div>
115 <div data-expected-height="50" data-offset-y="25" style="width: -webkit-flex(1 0 0); -webkit-flex-align: center; height: 50px; margin: 25px 0"></div>
116 <div data-expected-height="50" data-offset-y="30" style="width: -webkit-flex(1 0 0); -webkit-flex-align: center; height: 50px; margin: 20px 0 10px;"></div>
117 <div data-expected-height="100" data-offset-y="0" style="width: -webkit-flex(1 0 0); height: 100px;"></div>
120 <div class="flexbox">
121 <div data-expected-height="50" data-offset-y="0" style="width: -webkit-flex(1 0 0); -webkit-flex-align: start; height: 50px; -webkit-writing-mode: vertical-rl;"></div>
122 <div data-expected-height="50" data-offset-y="25" style="width: -webkit-flex(1 0 0); -webkit-flex-align: center; height: 50px; -webkit-writing-mode: vertical-rl;"></div>
123 <div data-expected-height="50" data-offset-y="50" style="width: -webkit-flex(1 0 0); -webkit-flex-align: end; height: 50px; -webkit-writing-mode: vertical-rl;"></div>
124 <div data-expected-height="50" data-offset-y="0" style="width: -webkit-flex(1 0 0); height: 50px; margin: auto 0; -webkit-writing-mode: vertical-rl;"></div>
125 <div data-expected-height="100" data-offset-y="0" style="width: -webkit-flex(1 0 0); height: 100px; -webkit-writing-mode: vertical-rl;"></div>
128 <div class="flexbox">
129 <div data-expected-height="50" data-offset-y="0" style="width: -webkit-flex(1 0 0); -webkit-flex-align: start; height: 50px;"></div>
130 <div data-expected-height="50" data-offset-y="25" style="width: -webkit-flex(1 0 0); -webkit-flex-align: center; height: 50px;"></div>
131 <div data-expected-height="50" data-offset-y="50" style="width: -webkit-flex(1 0 0); -webkit-flex-align: end; height: 50px;"></div>
132 <div data-expected-height="50" data-offset-y="0" style="width: -webkit-flex(1 0 0); height: 50px; margin: auto 0"></div>
133 <div data-expected-height="100" data-offset-y="0" style="width: -webkit-flex(1 0 0);"></div>
134 <div data-expected-height="100" data-offset-y="0" style="width: -webkit-flex(1 0 0); height: 100px;"></div>
137 <div class="flexbox">
138 <div data-expected-height="20" data-offset-y="20" style="width: -webkit-flex(1 0 0); -webkit-flex-align: baseline; height: 20px;"></div>
139 <div data-expected-height="10" data-offset-y="20" style="width: -webkit-flex(1 0 0); -webkit-flex-align: baseline; height: 10px; margin: 20px 0 10px;"></div>
140 <div data-expected-height="10" data-offset-y="30" style="width: -webkit-flex(1 0 0); -webkit-flex-align: baseline; height: 10px; margin: 20px 0 0;"></div>
141 <div data-expected-height="100" data-offset-y="0" style="width: -webkit-flex(1 0 0); height: 100px;"></div>
144 <div class="flexbox" style="font-family: test;">
145 <div id="baseline1" style="width: -webkit-flex(1 0 0); -webkit-flex-align: baseline;">ahem</div>
146 <div id="baseline2" data-offset-y="0" style="width: -webkit-flex(1 0 0); -webkit-flex-align: baseline;"><img src="../../fast/replaced/resources/1x1-blue.png" style="height: 50px;"></div>
147 <div data-expected-height="50" data-offset-y="25" style="width: -webkit-flex(1 0 0); -webkit-flex-align: center;"><img src="../../fast/replaced/resources/1x1-blue.png" style="height: 50px; vertical-align: middle"></div>
148 <div id="baseline3" data-expected-height="50" style="width: -webkit-flex(1 0 0); -webkit-flex-align: baseline;"><img src="../../fast/replaced/resources/1x1-blue.png" style="height: 50px; vertical-align: middle"></div>
149 <div data-expected-height="100" data-offset-y="0" style="width: -webkit-flex(1 0 0); height: 100px;"></div>
152 <div class="flexbox" style="font-family: test;">
153 <div id="baseline4" style="width: -webkit-flex(1 0 0); -webkit-flex-align: baseline;">ahem</div>
154 <div id="baseline5" style="width: -webkit-flex(1 0 0); -webkit-flex-align: baseline;"><br><img src="../../fast/replaced/resources/1x1-blue.png" style="height: 50px;"></div>
155 <div data-expected-height="50" data-offset-y="0" style="width: -webkit-flex(1 0 0); -webkit-flex-align: baseline;"><img src="../../fast/replaced/resources/1x1-blue.png" style="height: 50px; vertical-align: middle"></div>
156 <div data-expected-height="100" data-offset-y="0" style="width: -webkit-flex(1 0 0); height: 100px;"></div>
159 <div id="results"></div>
162 function additionalBaselineChecks()
164 var baseline1 = document.getElementById("baseline1");
165 var baseline2 = document.getElementById("baseline2");
166 var baseline3 = document.getElementById("baseline3");
167 logIfFalse(baseline1.offsetTop + baseline1.offsetHeight == baseline2.offsetTop + baseline2.offsetHeight,
168 "baseline1 and baseline2 should have the same baseline.");
169 logIfFalse(baseline3.offsetTop < 25,
170 "baseline3 should be above the center flex-aligned item.");
172 var baseline4 = document.getElementById("baseline4");
173 var baseline5 = document.getElementById("baseline5");
174 logIfFalse(baseline4.offsetTop == baseline5.offsetTop,
175 "baseline4 and baseline5 should be top aligned with each other.");
176 logIfFalse(baseline4.offsetTop > 0,
177 "baseline4 and baseline5 should be below baseline6.");
180 function logIfFalse(condition, msg)
183 document.getElementById("results").innerText += msg;
186 additionalBaselineChecks();