Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / css3 / flexbox / flex-align-vertical-writing-mode.html
blobb3525a2e7ca602b06586ac8ff1cb95fba650561d
1 <!DOCTYPE html>
2 <html>
3 <link href="resources/flexbox.css" rel="stylesheet">
4 <style>
5 body {
6 margin: 0;
8 .flexbox {
9 height: 100px;
10 background-color: #aaa;
11 position: relative;
12 -webkit-writing-mode: vertical-rl;
13 -webkit-text-orientation: sideways-right;
15 .flexbox div {
16 border: 0;
19 .flexbox :nth-child(1) {
20 background-color: blue;
22 .flexbox :nth-child(2) {
23 background-color: green;
25 .flexbox :nth-child(3) {
26 background-color: red;
28 .flexbox :nth-child(4) {
29 background-color: yellow;
31 .flexbox :nth-child(5) {
32 background-color: purple;
34 .flexbox :nth-child(6) {
35 background-color: orange;
37 .flexbox :nth-child(7) {
38 background-color: lime;
40 .flexbox :nth-child(8) {
41 background-color: lightblue;
43 .flexbox :nth-child(9) {
44 background-color: darkred;
46 .flexbox :nth-child(10) {
47 background-color: gold;
49 .flexbox :nth-child(11) {
50 background-color: salmon;
52 </style>
53 <script src="../../resources/check-layout.js"></script>
54 <body onload="checkLayout('.flexbox')">
56 <!-- stretch is the default align-items so these flexitems should all have the same height. -->
57 <div class="flexbox">
58 <div data-expected-width="100" class="flex-one"></div>
59 <div data-expected-width="100" class="flex-one" style="width: 100px"></div>
60 <div data-expected-width="100" class="flex-one"></div>
61 </div>
63 <div class="flexbox">
64 <div data-expected-width="60" data-offset-x="60" class="flex-one" style="width: 60px;"></div>
65 <div data-expected-width="120" data-offset-x="0" class="flex-one"></div>
66 <div data-expected-width="60" data-offset-x="30" class="flex-one" style="width: 60px; margin: auto;"></div>
67 <div data-expected-width="0" data-offset-x="60" class="flex-one" style="margin: 0 auto;"></div>
68 <div data-expected-width="100" data-offset-x="10" class="flex-one" style="width: 100px; margin: 0 10px;"></div>
69 <div data-expected-width="50" data-offset-x="50" class="flex-one" style="width: 50px; margin: 0 20px 0 10px;"></div>
70 <div data-expected-width="90" data-offset-x="10" class="flex-one" style="margin: 0 20px 0 10px;"></div>
71 <div data-expected-width="120" data-offset-x="0" class="flex-one">
72 <!-- Since no parent has a fixed height, this div shrink-wraps. -->
73 <div data-expected-width="0" style="width: 100%; background-color:black"></div>
74 </div>
75 </div>
77 <div class="flexbox" style="width: 100px;">
78 <div data-expected-width="50" data-offset-x="50" class="flex-one" style="width: 50px;"></div>
79 <div data-expected-width="100" data-offset-x="0" class="flex-one"></div>
80 <div data-expected-width="100" data-offset-x="0" class="flex-one" style="width: 100%;">
81 <div data-expected-width="100" style="width: 100%; background-color:black"></div>
82 </div>
83 </div>
85 <div class="flexbox" style="width: 100px;">
86 <div data-expected-width="50" data-offset-x="50" class="flex-one" style="width: 50px;"></div>
87 <div data-expected-width="100" data-offset-x="0" class="flex-one"></div>
88 </div>
90 <div class="flexbox">
91 <div data-expected-width="0" data-offset-x="100" class="flex-one align-self-flex-start"></div>
92 <div data-expected-width="50" data-offset-x="50" class="flex-one align-self-flex-start" style="width: 50px;"></div>
93 <div data-expected-width="50" data-offset-x="25" class="flex-one align-self-flex-start" style="width: 50px; margin: 0 auto"></div>
94 <div data-expected-width="50" data-offset-x="0" class="flex-one align-self-flex-start" style="width: 50px; margin: 0 auto 0 0"></div>
95 <div data-expected-width="50" data-offset-x="50" class="flex-one align-self-flex-start" style="width: 50px; margin: 0 0 0 auto"></div>
96 <div data-expected-width="50" data-offset-x="25" class="flex-one align-self-flex-start" style="width: 50px; margin: 0 25px"></div>
97 <div data-expected-width="50" data-offset-x="30" class="flex-one align-self-flex-start" style="width: 50px; margin: 0 20px 0 10px;"></div>
98 <div data-expected-width="100" data-offset-x="0" class="flex-one" style="width: 100px;"></div>
99 </div>
101 <div class="flexbox">
102 <div data-expected-width="0" data-offset-x="0" class="flex-one align-self-flex-end"></div>
103 <div data-expected-width="50" data-offset-x="0" class="flex-one align-self-flex-end" style="width: 50px;"></div>
104 <div data-expected-width="50" data-offset-x="25" class="flex-one align-self-flex-end" style="width: 50px; margin: 0 auto"></div>
105 <div data-expected-width="50" data-offset-x="0" class="flex-one align-self-flex-end" style="width: 50px; margin: 0 auto 0 0"></div>
106 <div data-expected-width="50" data-offset-x="50" class="flex-one align-self-flex-end" style="width: 50px; margin: 0 0 0 auto"></div>
107 <div data-expected-width="50" data-offset-x="25" class="flex-one align-self-flex-end" style="width: 50px; margin: 0 25px"></div>
108 <div data-expected-width="50" data-offset-x="10" class="flex-one align-self-flex-end" style="width: 50px; margin: 0 20px 0 10px;"></div>
109 <div data-expected-width="100" data-offset-x="0" class="flex-one" style="width: 100px;"></div>
110 </div>
112 <div class="flexbox">
113 <div data-expected-width="0" data-offset-x="50" class="flex-one align-self-center"></div>
114 <div data-expected-width="50" data-offset-x="25" class="flex-one align-self-center" style="width: 50px;"></div>
115 <div data-expected-width="50" data-offset-x="25" class="flex-one align-self-center" style="width: 50px; margin: 0 auto"></div>
116 <div data-expected-width="50" data-offset-x="0" class="flex-one align-self-center" style="width: 50px; margin: 0 auto 0 0"></div>
117 <div data-expected-width="50" data-offset-x="50" class="flex-one align-self-center" style="width: 50px; margin: 0 0 0 auto"></div>
118 <div data-expected-width="50" data-offset-x="25" class="flex-one align-self-center" style="width: 50px; margin: 0 25px"></div>
119 <div data-expected-width="50" data-offset-x="20" class="flex-one align-self-center" style="width: 50px; margin: 0 20px 0 10px;"></div>
120 <div data-expected-width="100" data-offset-x="0" class="flex-one" style="width: 100px;"></div>
121 </div>
123 <div class="flexbox">
124 <div data-expected-width="50" data-offset-x="50" class="flex-one align-self-flex-start" style="width: 50px;"></div>
125 <div data-expected-width="50" data-offset-x="25" class="flex-one align-self-center" style="width: 50px;"></div>
126 <div data-expected-width="50" data-offset-x="0" class="flex-one align-self-flex-end" style="width: 50px;"></div>
127 <div data-expected-width="50" data-offset-x="50" class="flex-one" style="width: 50px; margin: auto 0"></div>
128 <div data-expected-width="100" data-offset-x="0" class="flex-one"></div>
129 <div data-expected-width="100" data-offset-x="0" class="flex-one" style="width: 100px;"></div>
130 </div>
132 <div class="flexbox">
133 <div data-expected-width="50" data-offset-x="50" class="flex-one align-self-flex-start" style="width: 50px; -webkit-writing-mode: horizontal-tb;"></div>
134 <div data-expected-width="50" data-offset-x="25" class="flex-one align-self-center" style="width: 50px; -webkit-writing-mode: horizontal-tb;"></div>
135 <div data-expected-width="50" data-offset-x="0" class="flex-one align-self-flex-end" style="width: 50px; -webkit-writing-mode: horizontal-tb;"></div>
136 <div data-expected-width="50" data-offset-x="50" class="flex-one" style="width: 50px; margin: auto 0; -webkit-writing-mode: horizontal-tb;"></div>
137 <div data-expected-width="100" data-offset-x="0" class="flex-one" style="width: 100px; -webkit-writing-mode: horizontal-tb;"></div>
138 </div>
140 <div class="flexbox">
141 <div data-expected-width="20" data-offset-x="70" class="flex-one align-self-baseline" style="width: 20px;"></div>
142 <div data-expected-width="10" data-offset-x="70" class="flex-one align-self-baseline" style="width: 10px; margin: 0 20px 0 10px;"></div>
143 <div data-expected-width="10" data-offset-x="70" class="flex-one align-self-baseline" style="width: 10px; margin: 0 20px 0 0;"></div>
144 <div data-expected-width="100" data-offset-x="0" class="flex-one" style="width: 100px;"></div>
145 </div>
147 <div class="flexbox">
148 <div id="baseline1" class="flex-one align-self-baseline">ahem</div>
149 <div id="baseline2" class="flex-one align-self-baseline"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px;"></div>
150 <div data-expected-width="50" data-offset-x="25" class="flex-one align-self-center"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px; vertical-align: middle"></div>
151 <div id="baseline3" data-expected-width="50" class="flex-one align-self-baseline"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px; vertical-align: middle"></div>
152 <div data-expected-width="100" data-offset-x="0" class="flex-one" style="width: 100px;"></div>
153 </div>
155 <div class="flexbox">
156 <div id="baseline4" class="flex-one align-self-baseline">ahem</div>
157 <div id="baseline5" class="flex-one align-self-baseline"><br><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px;"></div>
158 <div data-expected-width="50" data-offset-x="50" class="flex-one align-self-baseline"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px; vertical-align: middle"></div>
159 <div data-expected-width="100" data-offset-x="0" class="flex-one" style="width: 100px;"></div>
160 </div>
162 <div class="flexbox" style="-webkit-writing-mode: vertical-lr">
163 <div id="baseline6" class="flex-one align-self-baseline">ahem</div>
164 <div id="baseline7" class="flex-one align-self-baseline"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px;"></div>
165 <div data-expected-width="50" data-offset-x="25" class="flex-one align-self-center"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px; vertical-align: middle"></div>
166 <div data-expected-width="50" data-offset-x="0" class="flex-one align-self-baseline"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px; vertical-align: middle"></div>
167 <div data-expected-width="100" data-offset-x="0" class="flex-one" style="width: 100px;"></div>
168 </div>
170 <div class="flexbox" style="-webkit-writing-mode: vertical-lr">
171 <div id="baseline8" class="flex-one align-self-baseline">ahem</div>
172 <div id="baseline9" class="flex-one align-self-baseline"><br><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px;"></div>
173 <div data-expected-width="50" data-offset-x="0" class="flex-one align-self-baseline"><img src="../../fast/replaced/resources/1x1-blue.png" style="width: 50px; vertical-align: middle"></div>
174 <div data-expected-width="100" data-offset-x="0" class="flex-one" style="width: 100px;"></div>
175 </div>
177 <div id="results"></div>
179 <script>
180 function additionalBaselineChecks()
182 var baseline1 = document.getElementById("baseline1");
183 var baseline2 = document.getElementById("baseline2");
184 var baseline3 = document.getElementById("baseline3");
185 logIfFalse(baseline1.offsetLeft == baseline2.offsetLeft,
186 "baseline1 and baseline2 should have the same baseline.");
187 logIfFalse(baseline3.offsetLeft + baseline3.offsetWidth > 75,
188 "baseline3 should be above the center align-itemsed item.");
190 var baseline4 = document.getElementById("baseline4");
191 var baseline5 = document.getElementById("baseline5");
192 logIfFalse(baseline4.offsetLeft + baseline4.offsetWidth == baseline5.offsetLeft + baseline5.offsetWidth,
193 "baseline4 and baseline5 should be right aligned with each other.");
194 logIfFalse(baseline4.offsetLeft + baseline4.offsetWidth < 100,
195 "baseline4 and baseline5 should be below baseline6.");
197 var baseline6 = document.getElementById("baseline6");
198 var baseline7 = document.getElementById("baseline7");
199 logIfFalse(baseline6.offsetLeft == baseline7.offsetLeft,
200 "baseline6 and baseline7 should have the same baseline.");
202 var baseline8 = document.getElementById("baseline8");
203 var baseline9 = document.getElementById("baseline9");
204 logIfFalse(baseline8.offsetLeft == baseline9.offsetLeft,
205 "baseline8 and baseline9 should be left aligned with each other.");
209 function logIfFalse(condition, msg)
211 if (!condition)
212 document.getElementById("results").innerHTML += msg + "<br/>";
215 additionalBaselineChecks();
216 </script>
218 </body>
219 </html>