7 background-color: grey;
21 -webkit-writing-mode: horizontal-tb;
24 -webkit-writing-mode: horizontal-bt;
30 flex-flow: column-reverse;
36 flex-wrap: wrap-reverse;
38 .align-content-flex-start {
39 align-content: flex-start;
41 .align-content-flex-end {
42 align-content: flex-end;
44 .align-content-center {
45 align-content: center;
47 .align-content-space-between {
48 align-content: space-between;
50 .align-content-space-around {
51 align-content: space-around;
53 .align-content-stretch {
54 align-content: stretch;
56 .flexbox
> :nth-child(
1) {
57 background-color: blue;
59 .flexbox
> :nth-child(
2) {
60 background-color: green;
63 <script src=
"../../resources/check-layout.js"></script>
64 <body onload=
"checkLayout('.flexbox')">
72 'flex-start': [0, 100],
73 'flex-end': [400, 500],
75 'space-between': [0, 500],
76 'space-around': [100, 400],
80 'flex-start': [500, 400],
83 'space-between': [500, 0],
84 'space-around': [400, 100],
90 'flex-start': [500, 400],
93 'space-between': [500, 0],
94 'space-around': [400, 100],
98 'flex-start': [0, 100],
99 'flex-end': [400, 500],
100 'center': [200, 300],
101 'space-between': [0, 500],
102 'space-around': [100, 400],
111 'flex-start': [0, 100],
112 'flex-end': [400, 500],
113 'center': [200, 300],
114 'space-between': [0, 500],
115 'space-around': [100, 400],
119 'flex-start': [500, 400],
120 'flex-end': [100, 0],
121 'center': [300, 200],
122 'space-between': [500, 0],
123 'space-around': [400, 100],
129 'flex-start': [500, 400],
130 'flex-end': [100, 0],
131 'center': [300, 200],
132 'space-between': [500, 0],
133 'space-around': [400, 100],
137 'flex-start': [0, 100],
138 'flex-end': [400, 500],
139 'center': [200, 300],
140 'space-between': [0, 500],
141 'space-around': [100, 400],
148 // Same as horizontal-tb.
152 'flex-start': [0, 100],
153 'flex-end': [400, 500],
154 'center': [200, 300],
155 'space-between': [0, 500],
156 'space-around': [100, 400],
160 'flex-start': [500, 400],
161 'flex-end': [100, 0],
162 'center': [300, 200],
163 'space-between': [500, 0],
164 'space-around': [400, 100],
170 'flex-start': [500, 400],
171 'flex-end': [100, 0],
172 'center': [300, 200],
173 'space-between': [500, 0],
174 'space-around': [400, 100],
178 'flex-start': [0, 100],
179 'flex-end': [400, 500],
180 'center': [200, 300],
181 'space-between': [0, 500],
182 'space-around': [100, 400],
190 'flex-start': [0, 100],
191 'flex-end': [400, 500],
192 'center': [200, 300],
193 'space-between': [0, 500],
194 'space-around': [100, 400],
198 'flex-start': [500, 400],
199 'flex-end': [100, 0],
200 'center': [300, 200],
201 'space-between': [500, 0],
202 'space-around': [400, 100],
208 'flex-start': [500, 400],
209 'flex-end': [100, 0],
210 'center': [300, 200],
211 'space-between': [500, 0],
212 'space-around': [400, 100],
216 'flex-start': [0, 100],
217 'flex-end': [400, 500],
218 'center': [200, 300],
219 'space-between': [0, 500],
220 'space-around': [100, 400],
228 function mainAxisDirection(writingMode
, flexDirection
)
230 if ((writingMode
.indexOf('horizontal') != -1 && flexDirection
.indexOf('row') != -1)
231 || (writingMode
.indexOf('vertical') != -1 && flexDirection
.indexOf('column') != -1))
236 function addChild(flexbox
, preferredSize
, alignContent
, expected_x_offset
)
238 var child
= document
.createElement('div');
239 child
.setAttribute('style', 'flex: 1 ' + preferredSize
+ 'px;'
240 + 'min-width: 100px');
242 child
.setAttribute("data-expected-width", alignContent
== "stretch" ? "300" : "100");
243 child
.setAttribute("data-expected-height", "20");
244 child
.setAttribute("data-offset-y", "0");
245 child
.setAttribute("data-offset-x", expected_x_offset
);
247 flexbox
.appendChild(child
);
250 var writingModes
= ['horizontal-tb', 'horizontal-bt'];
251 var flexDirections
= ['column', 'column-reverse'];
252 var directions
= ['ltr', 'rtl'];
253 var wraps
= ['wrap', 'wrap-reverse'];
254 var alignContents
= ['flex-start', 'flex-end', 'center', 'space-between', 'space-around', 'stretch'];
256 writingModes
.forEach(function(writingMode
) {
257 flexDirections
.forEach(function(flexDirection
) {
258 directions
.forEach(function(direction
) {
259 wraps
.forEach(function(wrap
) {
260 alignContents
.forEach(function(alignContent
) {
261 var flexboxClassName
= writingMode
+ ' ' + direction
+ ' ' + flexDirection
+ ' ' + wrap
+ ' align-content-' + alignContent
;
262 var title
= document
.createElement('div');
263 title
.className
= 'title';
264 title
.innerHTML
= flexboxClassName
;
265 document
.body
.appendChild(title
);
267 var mainAxis
= 'height';
268 var crossAxis
= 'width';
270 var flexbox
= document
.createElement('div');
271 flexbox
.className
= 'flexbox ' + flexboxClassName
;
272 flexbox
.setAttribute("data-expected-width", "600");
273 flexbox
.setAttribute("data-expected-height", "20");
275 var testExpectations
= expectations
[writingMode
][flexDirection
][direction
][wrap
][alignContent
];
276 addChild(flexbox
, 20, alignContent
, testExpectations
[0]);
277 addChild(flexbox
, 5, alignContent
, testExpectations
[1]);
279 document
.body
.appendChild(flexbox
);