8 background-color: #aaa;
20 .flexbox :nth-child(
1) {
21 background-color: blue;
23 .flexbox :nth-child(
2) {
24 background-color: green;
33 -webkit-writing-mode: horizontal-tb;
36 -webkit-writing-mode: horizontal-bt;
39 -webkit-writing-mode: vertical-rl;
42 -webkit-writing-mode: vertical-lr;
45 flex-flow: row-reverse;
51 flex-flow: column-reverse;
54 <script src=
"../../resources/check-layout.js"></script>
55 <body onload=
"checkLayout('.flexbox')">
57 <div class=
"flexbox" style=
"align-items: center; justify-content: center;">
58 <div data-offset-x=
"-10" data-offset-y=
"-5"></div>
59 <div data-offset-x=
"50" data-offset-y=
"-5"></div>
62 <div class=
"flexbox row-reverse" style=
"align-items: center; justify-content: center;">
63 <div data-offset-x=
"50" data-offset-y=
"-5"></div>
64 <div data-offset-x=
"-10" data-offset-y=
"-5"></div>
67 <div class=
"flexbox column vertical" style=
"align-items: center; justify-content: center;">
68 <div data-offset-x=
"-5" data-offset-y=
"-10"></div>
69 <div data-offset-x=
"-5" data-offset-y=
"50"></div>
72 <div class=
"flexbox column-reverse vertical" style=
"align-items: center; justify-content: center;">
73 <div data-offset-x=
"-5" data-offset-y=
"50"></div>
74 <div data-offset-x=
"-5" data-offset-y=
"-10"></div>
77 <div class=
"flexbox" style=
"align-items: center; justify-content: space-around;">
78 <div data-offset-x=
"-10" data-offset-y=
"-5"></div>
79 <div data-offset-x=
"50" data-offset-y=
"-5"></div>
82 <div class=
"flexbox" style=
"align-items: flex-start; justify-content: flex-start;">
83 <div data-offset-x=
0 data-offset-y=
0></div>
84 <div data-offset-x=
60 data-offset-y=
0></div>
87 <div class=
"flexbox" style=
"align-items: flex-start; justify-content: space-between;">
88 <div data-offset-x=
0 data-offset-y=
0></div>
89 <div data-offset-x=
60 data-offset-y=
0></div>
93 var writingModes
= ['horizontal-tb', 'horizontal-bt', 'vertical-lr', 'vertical-rl'];
94 var flexFlows
= ['row', 'column', 'row-reverse', 'column-reverse'];
95 var directions
= ['ltr', 'rtl'];
97 var verticalFirstChildExpected
= 'data-offset-x="-5" data-offset-y="-10"';
98 var verticalLastChildExpected
= 'data-offset-x="-5" data-offset-y="50"';
99 var horizontalFirstChildExpected
= 'data-offset-x="-10" data-offset-y="-5"';
100 var horizontalLastChildExpected
= 'data-offset-x="50" data-offset-y="-5"';
102 writingModes
.forEach(function(writingMode
) {
103 flexFlows
.forEach(function(flexFlow
) {
104 directions
.forEach(function(direction
) {
105 var flexboxClassName
= writingMode
+ ' ' + direction
+ ' ' + flexFlow
;
107 var title
= document
.createElement('div');
108 title
.className
= 'title';
109 title
.innerHTML
= flexboxClassName
;
110 document
.body
.appendChild(title
);
112 var isColumn
= flexFlow
.indexOf('column') != -1;
113 var isHorizontal
= (writingMode
.indexOf('horizontal') != -1) ? !isColumn
: isColumn
;
115 flexboxClassName
+= ' vertical';
120 isReverse
= direction
== 'rtl';
123 isReverse
= direction
== 'ltr';
126 isReverse
= writingMode
== 'vertical-rl' || writingMode
== 'horizontal-bt';
128 case 'column-reverse':
129 isReverse
= writingMode
== 'vertical-lr' || writingMode
== 'horizontal-tb';
133 var firstChildExpected
, lastChildExpected
;
135 firstChildExpected
= isReverse
? horizontalLastChildExpected
: horizontalFirstChildExpected
;
136 lastChildExpected
= isReverse
? horizontalFirstChildExpected
: horizontalLastChildExpected
;
138 firstChildExpected
= isReverse
? verticalLastChildExpected
: verticalFirstChildExpected
;
139 lastChildExpected
= isReverse
? verticalFirstChildExpected
: verticalLastChildExpected
;
142 var container
= document
.createElement('div');
143 container
.innerHTML
= '<div class="flexbox ' + flexboxClassName
+ '" style="align-items: center; justify-content: center;">\n' +
144 '<div ' + firstChildExpected
+ '></div>\n' +
145 '<div ' + lastChildExpected
+ '></div>\n' +
148 document
.body
.appendChild(container
);