6 background-color: pink;
7 outline: 1px solid red;
11 display: -webkit-flexbox;
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 padding: 10px 20px 30px 40px;
53 padding: 13px 2px 17px 8px;
56 -webkit-padding-before: 10px;
57 -webkit-padding-after: 30px;
58 -webkit-padding-start: 40px;
59 -webkit-padding-end: 20px;
62 -webkit-padding-before: 13px;
63 -webkit-padding-after: 17px;
64 -webkit-padding-start: 8px;
65 -webkit-padding-end: 2px;
67 .flexbox > :nth-child(1) {
68 background-color: blue;
70 .flexbox > div > div {
71 background-color: green;
75 if (window.layoutTestController)
76 layoutTestController.dumpAsText();
78 <script src="resources/flexbox.js"></script>
79 <body onload="checkFlexBoxen()">
82 function positionAsString(position)
84 return 'data-offset-x="' + position[0] + '" data-offset-y="' + position[1] + '"';
87 function asString(expectations)
89 return 'data-expected-width="' + expectations[0] + '" data-expected-height="' + expectations[1] + '" ' + positionAsString(expectations.slice(2, 4));
92 var horizontalContainerSize = [160, 140];
93 var verticalContainerSize = [140, 160];
95 var physicalExpectations = {
98 containersize: horizontalContainerSize,
99 flexitemcolumn: [30, 100, 110, 10],
100 flexitemrow: [100, 50, 40, 10],
101 childcolumn: [20, 20, 118, 23],
102 childrow: [90, 20, 48, 23]
105 containersize: horizontalContainerSize,
106 flexitemcolumn: [30, 100, 40, 10],
107 flexitemrow: [100, 50, 40, 10],
108 childcolumn: [20, 20, 48, 23],
109 childrow: [90, 20, 48, 23]
114 containersize: horizontalContainerSize,
115 flexitemcolumn: [30, 100, 110, 10],
116 flexitemrow: [100, 50, 40, 60],
117 childcolumn: [20, 20, 118, 73],
118 childrow: [90, 20, 48, 73]
121 containersize: horizontalContainerSize,
122 flexitemcolumn: [30, 100, 40, 10],
123 flexitemrow: [100, 50, 40, 60],
124 childcolumn: [20, 20, 48, 73],
125 childrow: [90, 20, 48, 73]
130 containersize: horizontalContainerSize,
131 flexitemcolumn: [100, 50, 40, 60],
132 flexitemrow: [30, 100, 40, 10],
133 childcolumn: [20, 20, 48, 73],
134 childrow: [20, 70, 48, 23]
137 containersize: horizontalContainerSize,
138 flexitemcolumn: [100, 50, 40, 10],
139 flexitemrow: [30, 100, 40, 10],
140 childcolumn: [20, 20, 48, 23],
141 childrow: [20, 70, 48, 23]
146 containersize: horizontalContainerSize,
147 flexitemcolumn: [100, 50, 40, 60],
148 flexitemrow: [30, 100, 110, 10],
149 childcolumn: [20, 20, 118, 73],
150 childrow: [20, 70, 118, 23]
153 containersize: horizontalContainerSize,
154 flexitemcolumn: [100, 50, 40, 10],
155 flexitemrow: [30, 100, 110, 10],
156 childcolumn: [20, 20, 118, 23],
157 childrow: [20, 70, 118, 23]
162 var logicalExpectations = {
165 containersize: horizontalContainerSize,
166 flexitemcolumn: [30, 100, 90, 10],
167 flexitemrow: [100, 50, 20, 10],
168 childcolumn: [20, 20, 92, 23],
169 childrow: [90, 20, 22, 23]
172 containersize: horizontalContainerSize,
173 flexitemcolumn: [30, 100, 40, 10],
174 flexitemrow: [100, 50, 40, 10],
175 childcolumn: [20, 20, 48, 23],
176 childrow: [90, 20, 48, 23]
181 containersize: horizontalContainerSize,
182 flexitemcolumn: [30, 100, 90, 30],
183 flexitemrow: [100, 50, 20, 80],
184 childcolumn: [20, 20, 92, 97],
185 childrow: [90, 20, 22, 97]
188 containersize: horizontalContainerSize,
189 flexitemcolumn: [30, 100, 40, 30],
190 flexitemrow: [100, 50, 40, 80],
191 childcolumn: [20, 20, 48, 97],
192 childrow: [90, 20, 48, 97]
197 containersize: verticalContainerSize,
198 flexitemcolumn: [100, 30, 10, 90],
199 flexitemrow: [50, 100, 10, 20],
200 childcolumn: [20, 20, 23, 92],
201 childrow: [20, 90, 23, 22]
204 containersize: verticalContainerSize,
205 flexitemcolumn: [100, 30, 10, 40],
206 flexitemrow: [50, 100, 10, 40],
207 childcolumn: [20, 20, 23, 48],
208 childrow: [20, 90, 23, 48]
213 containersize: verticalContainerSize,
214 flexitemcolumn: [100, 30, 30, 90],
215 flexitemrow: [50, 100, 80, 20],
216 childcolumn: [20, 20, 97, 92],
217 childrow: [20, 90, 97, 22]
220 containersize: verticalContainerSize,
221 flexitemcolumn: [100, 30, 30, 40],
222 flexitemrow: [50, 100, 80, 40],
223 childcolumn: [20, 20, 97, 48],
224 childrow: [20, 90, 97, 48]
229 var writingModes = ['horizontal-tb', 'horizontal-bt', 'vertical-lr', 'vertical-rl'];
230 // FIXME: Test row-reverse and column-reverse.
231 var flexFlows = ['row', 'column'];
232 var directions = ['rtl', 'ltr'];
233 var marginTypes = ['physical', 'logical'];
235 writingModes.forEach(function(writingMode) {
236 flexFlows.forEach(function(flexFlow) {
237 directions.forEach(function(direction) {
238 marginTypes.forEach(function(marginType) {
239 var flexboxClassName = writingMode + ' ' + direction + ' ' + flexFlow + ' ' + marginType;
240 var title = document.createElement('div');
241 title.className = 'title';
242 title.innerHTML = flexboxClassName;
243 document.body.appendChild(title);
245 var expectations = (marginType == 'physical') ? physicalExpectations : logicalExpectations;
246 expectations = expectations[writingMode][direction];
248 var container = document.createElement('div');
249 container.className = 'container';
250 container.setAttribute('data-expected-width', expectations.containersize[0]);
251 container.setAttribute('data-expected-height', expectations.containersize[1]);
253 // FIXME: In flex-flow column the innermost diff is always 20x20. Is that correct?
254 container.innerHTML = '\n<div class="flexbox ' + flexboxClassName + '">\n' +
255 '<div style="width: -webkit-flex(1 20px); height: -webkit-flex(1 20px);" ' + asString(expectations['flexitem' + flexFlow]) + '>\n' +
256 '<div style="width:100%; height:100%" ' + asString(expectations['child' + flexFlow]) + '></div>' +
260 document.body.appendChild(container);