Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / css3 / flexbox / box-sizing.html
blob88e578298564ce2033d06f1009e6165c8b31641f
1 <!DOCTYPE html>
2 <html>
3 <link href="resources/flexbox.css" rel="stylesheet">
4 <style>
5 .flexbox {
6 border: 2px solid orange;
8 .h3 {
9 height: 300px;
11 .w3 {
12 width: 300px;
14 .h4 {
15 height: 400px;
17 .w4 {
18 width: 400px;
20 .border-box, .flexbox > div {
21 box-sizing: border-box;
22 height: 100px;
23 width: 100px;
24 border: 2px solid lightblue;
25 border-top-width: 4px;
26 padding: 3px;
28 </style>
29 <script src="../../resources/check-layout.js"></script>
30 <body onload="checkLayout('.flexbox')">
32 All blue boxes are 100x100px with box-sizing: border-box and 2px border (4px border-top), we expect offsetWidth/Height to be <b>100x100</b>
34 <h3>flex-flow: default, orange box has width: 300px</h3>
35 <div class="flexbox" style="width: 300px">
36 <div></div><div></div><div></div>
37 </div>
39 <h3>flex-flow: default, orange box has width: 400px</h3>
40 <div class="flexbox" style="width: 400px">
41 <div></div><div></div><div></div>
42 </div>
44 <h3>flex-flow: default, orange box has width: auto</h3>
45 <div class="flexbox">
46 <div></div><div></div><div></div>
47 </div>
49 <h3>flex-flow: default, orange box has width: auto, flex-box has box-sizing: border-box</h3>
50 <div class="flexbox border-box">
51 <div data-expected-width=30></div>
52 <div data-expected-width=30></div>
53 <div data-expected-width=30></div>
54 </div>
56 <h3>flex-flow: column, red box has height: 300px</h3>
57 <div class="flexbox column" style="height: 300px">
58 <div></div><div></div><div></div>
59 </div>
61 <h3>flex-flow: column, red box has height: 400px</h3>
62 <div class="flexbox column" style="height: 400px">
63 <div></div><div></div><div></div>
64 </div>
66 <h3>flex-flow: column, red box has height: auto</h3>
67 <div class="flexbox column">
68 <div></div><div></div><div></div>
69 </div>
71 <h3>flex-box has box-sizing: border-box and flex-wrap: wrap;</h3>
72 <div class="flexbox column wrap" style="box-sizing: border-box; border: 2px solid lightblue; padding: 3px; height: 200px; width: 100px; position: relative" data-expected-width=100 data-expected-height=200>
73 <div data-offset-x=3></div><div data-offset-x=103></div><div data-offset-x=203></div>
74 </div>
76 <h3>flex-box has box-sizing: default and flex-wrap: wrap;</h3>
77 <div class="flexbox column wrap" style="border: 2px solid lightblue; padding: 3px; height: 200px; width: 100px; position: relative" data-expected-width=110 data-expected-height=210>
78 <div data-offset-x=3></div><div data-offset-x=3></div><div data-offset-x=103></div>
79 </div>
81 <h3>flex-flow: column, flex-box has box-sizing: border-box, flex items have flex: 1</h3>
82 <div class="flexbox column" style="box-sizing: border-box; border: 2px solid lightblue; padding: 3px; height: 343px; width: 100px;" data-expected-width=100 data-expected-height=343>
83 <div style="flex: 1;" data-expected-height=111></div>
84 <div style="flex: 1;" data-expected-height=111></div>
85 <div style="flex: 1;" data-expected-height=111></div>
86 </div>
88 <script>
89 function addExpectedSizes(flexItem) {
90 if (!flexItem.hasAttribute('data-expected-height'))
91 flexItem.setAttribute('data-expected-height', 100);
92 if (!flexItem.hasAttribute('data-expected-width'))
93 flexItem.setAttribute('data-expected-width', 100);
95 [].forEach.call(document.querySelectorAll(".flexbox > div"), addExpectedSizes);
96 [].forEach.call(document.querySelectorAll(".border-box"), addExpectedSizes);
97 </script>
98 </body>
99 </html>