6 background-color: pink;
7 outline:
1px solid red;
12 background-color: grey;
31 -webkit-writing-mode: horizontal-tb;
34 -webkit-writing-mode: horizontal-bt;
37 -webkit-writing-mode: vertical-rl;
40 -webkit-writing-mode: vertical-lr;
46 flex-flow: row-reverse;
52 flex-flow: column-reverse;
55 border-width:
10px
20px
30px
40px;
58 border-width:
13px
2px
17px
8px;
61 -webkit-border-before-width:
10px;
62 -webkit-border-after-width:
30px;
63 -webkit-border-start-width:
40px;
64 -webkit-border-end-width:
20px;
67 -webkit-border-before-width:
13px;
68 -webkit-border-after-width:
17px;
69 -webkit-border-start-width:
8px;
70 -webkit-border-end-width:
2px;
72 .flexbox
> :nth-child(
1) {
73 background-color: blue;
75 .flexbox
> :nth-child(
2) {
76 background-color: green;
78 .flexbox
> :nth-child(
3) {
79 background-color: red;
82 <script src=
"../../resources/check-layout.js"></script>
83 <body onload=
"checkLayout('.flexbox')">
86 function positionAsString(position
)
88 return 'data-total-x="' + position
[0] + '" data-total-y="' + position
[1] + '"';
91 function offsetSizeAsString(size
)
93 return 'data-expected-width="' + size
[0] + '" data-expected-height="' + size
[1] + '"';
96 function asString(expectations
)
98 return 'data-expected-client-width="' + expectations
[0] + '" data-expected-client-height="' + expectations
[1] + '" ' + positionAsString(expectations
.slice(2, 4));
101 var physicalFlexBoxOffsetSize
= [160, 140];
102 var physicalFlexBoxClientPosition
= [40, 10];
104 var physicalExpectations
= {
107 size
: physicalFlexBoxOffsetSize
,
108 position
: physicalFlexBoxClientPosition
,
109 column
: [20, 70, 118, 23],
110 row
: [90, 20, 48, 23]
113 size
: physicalFlexBoxOffsetSize
,
114 position
: physicalFlexBoxClientPosition
,
115 column
: [20, 70, 48, 23],
116 row
: [90, 20, 48, 23]
121 size
: physicalFlexBoxOffsetSize
,
122 position
: physicalFlexBoxClientPosition
,
123 column
: [20, 70, 118, 23],
124 row
: [90, 20, 48, 73]
127 size
: physicalFlexBoxOffsetSize
,
128 position
: physicalFlexBoxClientPosition
,
129 column
: [20, 70, 48, 23],
130 row
: [90, 20, 48, 73]
135 size
: physicalFlexBoxOffsetSize
,
136 position
: physicalFlexBoxClientPosition
,
137 column
: [90, 20, 48, 73],
138 row
: [20, 70, 48, 23]
141 size
: physicalFlexBoxOffsetSize
,
142 position
: physicalFlexBoxClientPosition
,
143 column
: [90, 20, 48, 23],
144 row
: [20, 70, 48, 23]
149 size
: physicalFlexBoxOffsetSize
,
150 position
: physicalFlexBoxClientPosition
,
151 column
: [90, 20, 48, 73],
152 row
: [20, 70, 118, 23]
155 size
: physicalFlexBoxOffsetSize
,
156 position
: physicalFlexBoxClientPosition
,
157 column
: [90, 20, 48, 23],
158 row
: [20, 70, 118, 23]
163 var logicalExpectations
= {
168 column
: [20, 70, 92, 23],
169 row
: [90, 20, 22, 23]
174 column
: [20, 70, 48, 23],
175 row
: [90, 20, 48, 23]
182 column
: [20, 70, 92, 47],
183 row
: [90, 20, 22, 97]
188 column
: [20, 70, 48, 47],
189 row
: [90, 20, 48, 97]
196 column
: [70, 20, 23, 92],
197 row
: [20, 90, 23, 22]
202 column
: [70, 20, 23, 48],
203 row
: [20, 90, 23, 48]
210 column
: [70, 20, 47, 92],
211 row
: [20, 90, 97, 22]
216 column
: [70, 20, 47, 48],
217 row
: [20, 90, 97, 48]
222 var writingModes
= ['horizontal-tb', 'horizontal-bt', 'vertical-lr', 'vertical-rl'];
223 var flexFlows
= ['row', 'column', 'row-reverse', 'column-reverse'];
224 var directions
= ['rtl', 'ltr'];
225 var marginTypes
= ['physical', 'logical'];
227 writingModes
.forEach(function(writingMode
) {
228 flexFlows
.forEach(function(flexFlow
) {
229 directions
.forEach(function(direction
) {
230 marginTypes
.forEach(function(marginType
) {
231 var flexboxClassName
= writingMode
+ ' ' + direction
+ ' ' + flexFlow
+ ' ' + marginType
;
232 var title
= document
.createElement('div');
233 title
.className
= 'title';
234 title
.innerHTML
= flexboxClassName
;
235 document
.body
.appendChild(title
);
237 var expectations
= (marginType
== 'physical') ? physicalExpectations
: logicalExpectations
;
238 expectations
= expectations
[writingMode
][direction
];
240 var container
= document
.createElement('div');
241 container
.className
= 'container';
242 container
.setAttribute('data-expected-width', expectations
.size
[0]);
243 container
.setAttribute('data-expected-height', expectations
.size
[1]);
245 container
.innerHTML
= '\n<div class="flexbox ' + flexboxClassName
+ '" ' + positionAsString(expectations
.position
) + ' ' + offsetSizeAsString(expectations
.size
) + '>\n' +
246 '<div style="flex: 1 auto; height: 20px; width: 20px;" ' + asString(expectations
[flexFlow
.replace("-reverse", "")]) + '></div>\n' +
249 document
.body
.appendChild(container
);