6 background-color: pink;
7 outline: 1px solid black;
11 display: -webkit-flex;
12 background-color: grey;
26 -webkit-writing-mode: horizontal-tb;
29 -webkit-writing-mode: horizontal-bt;
32 -webkit-writing-mode: vertical-rl;
35 -webkit-writing-mode: vertical-lr;
38 -webkit-flex-flow: row;
41 -webkit-flex-flow: row-reverse;
44 -webkit-flex-flow: column;
47 -webkit-flex-flow: column-reverse;
50 margin: 10px 20px 30px 40px;
53 margin: 13px auto 17px auto;
56 -webkit-margin-before: 10px;
57 -webkit-margin-after: 30px;
58 -webkit-margin-start: 40px;
59 -webkit-margin-end: 20px;
62 -webkit-margin-before: auto;
63 -webkit-margin-after: 17px;
64 -webkit-margin-start: auto;
65 -webkit-margin-end: 2px;
67 .flexbox > :nth-child(1) {
68 background-color: blue;
70 .flexbox > :nth-child(2) {
71 background-color: green;
73 .flexbox > :nth-child(3) {
74 background-color: red;
78 if (window.layoutTestController)
79 layoutTestController.dumpAsText();
81 <script src="resources/flexbox.js"></script>
82 <body onload="checkFlexBoxen()">
85 function positionAsString(position)
87 return 'data-offset-x="' + position[0] + '" data-offset-y="' + position[1] + '"';
90 function asString(expectations)
92 return 'data-expected-width="' + expectations[0] + '" data-expected-height="' + expectations[1] + '" ' + positionAsString(expectations.slice(2, 4));
95 var physicalContainerSize = [160, 140];
96 var physicalFlexBoxPosition = [40, 10];
98 var physicalExpectations = {
101 container: physicalContainerSize,
102 flexbox: physicalFlexBoxPosition,
103 column: [20, 20, 80, 23],
104 row: [20, 20, 80, 23],
105 'column-reverse': [20, 20, 80, 23],
106 'row-reverse': [20, 20, 80, 23],
109 container: physicalContainerSize,
110 flexbox: physicalFlexBoxPosition,
111 column: [20, 20, 80, 23],
112 row: [20, 20, 80, 23],
113 'column-reverse': [20, 20, 80, 23],
114 'row-reverse': [20, 20, 80, 23],
119 container: physicalContainerSize,
120 flexbox: physicalFlexBoxPosition,
121 column: [20, 20, 80, 73],
122 row: [20, 20, 80, 73],
123 'column-reverse': [20, 20, 80, 73],
124 'row-reverse': [20, 20, 80, 73],
127 container: physicalContainerSize,
128 flexbox: physicalFlexBoxPosition,
129 column: [20, 20, 80, 73],
130 row: [20, 20, 80, 73],
131 'column-reverse': [20, 20, 80, 73],
132 'row-reverse': [20, 20, 80, 73],
137 container: physicalContainerSize,
138 flexbox: physicalFlexBoxPosition,
139 column: [20, 20, 80, 73],
140 row: [20, 20, 40, 73],
141 'column-reverse': [20, 20, 40, 73],
142 'row-reverse': [20, 20, 40, 23],
145 container: physicalContainerSize,
146 flexbox: physicalFlexBoxPosition,
147 column: [20, 20, 80, 23],
148 row: [20, 20, 40, 23],
149 'column-reverse': [20, 20, 40, 23],
150 'row-reverse': [20, 20, 40, 73],
155 container: physicalContainerSize,
156 flexbox: physicalFlexBoxPosition,
157 column: [20, 20, 80, 73],
158 row: [20, 20, 120, 73],
159 'column-reverse': [20, 20, 48, 73],
160 'row-reverse': [20, 20, 120, 23],
163 container: physicalContainerSize,
164 flexbox: physicalFlexBoxPosition,
165 column: [20, 20, 80, 23],
166 row: [20, 20, 120, 23],
167 'column-reverse': [20, 20, 48, 23],
168 'row-reverse': [20, 20, 120, 73],
173 var logicalExpectations = {
176 container: [160, 140],
178 column: [20, 20, 22, 73],
179 row: [20, 20, 22, 10],
180 'column-reverse': [20, 20, 92, 10],
181 'row-reverse': [20, 20, 22, 10],
184 container: [160, 140],
186 column: [20, 20, 118, 73],
187 row: [20, 20, 118, 10],
188 'column-reverse': [20, 20, 48, 10],
189 'row-reverse': [20, 20, 118, 10],
194 container: [160, 140],
196 column: [20, 20, 22, 47],
197 row: [20, 20, 22, 110],
198 'column-reverse': [20, 20, 92, 47],
199 'row-reverse': [20, 20, 22, 110],
202 container: [160, 140],
204 column: [20, 20, 118, 47],
205 row: [20, 20, 118, 110],
206 'column-reverse': [20, 20, 48, 47],
207 'row-reverse': [20, 20, 118, 110],
212 container: [140, 160],
214 column: [20, 20, 73, 22],
215 row: [20, 20, 10, 22],
216 'column-reverse': [20, 20, 23, 92],
217 'row-reverse': [20, 20, 10, 22],
220 container: [140, 160],
222 column: [20, 20, 73, 118],
223 row: [20, 20, 10, 118],
224 'column-reverse': [20, 20, 23, 48],
225 'row-reverse': [20, 20, 10, 118],
230 container: [140, 160],
232 column: [20, 20, 47, 22],
233 row: [20, 20, 110, 22],
234 'column-reverse': [20, 20, 47, 92],
235 'row-reverse': [20, 20, 110, 22],
238 container: [140, 160],
240 column: [20, 20, 47, 118],
241 row: [20, 20, 110, 118],
242 'column-reverse': [20, 20, 47, 48],
243 'row-reverse': [20, 20, 110, 118],
248 var writingModes = ['horizontal-tb', 'horizontal-bt', 'vertical-lr', 'vertical-rl'];
249 var flexFlows = ['row', 'column', 'row-reverse', 'row-reverse'];
250 var directions = ['ltr', 'rtl'];
251 var marginTypes = ['physical', 'logical'];
253 marginTypes.forEach(function(marginType) {
254 writingModes.forEach(function(writingMode) {
255 flexFlows.forEach(function(flexFlow) {
256 directions.forEach(function(direction) {
257 var flexboxClassName = writingMode + ' ' + direction + ' ' + flexFlow + ' ' + marginType;
258 var title = document.createElement('div');
259 title.className = 'title';
260 title.innerHTML = flexboxClassName;
261 document.body.appendChild(title);
263 var expectations = (marginType == 'physical') ? physicalExpectations : logicalExpectations;
264 expectations = expectations[writingMode][direction];
265 var flexboxExpectations = positionAsString(expectations.flexbox);
267 var flexItemExpectations = asString(expectations[flexFlow]);
269 var container = document.createElement('div');
270 container.className = 'container';
271 container.setAttribute('data-expected-width', expectations.container[0]);
272 container.setAttribute('data-expected-height', expectations.container[1]);
274 container.innerHTML = '<div class="flexbox ' + flexboxClassName + '" ' + flexboxExpectations + '>\n' +
275 '<div style="height: 20px; width: 20px;" ' + flexItemExpectations + '></div>\n' +
278 document.body.appendChild(container);