blob: 12cbf63683245e479b7649d9dcda0886a2b56a93 [file] [log] [blame]
tony@chromium.org16a286f2011-10-27 20:30:08 +00001<!DOCTYPE html>
2<html>
tony@chromium.orgda559b22012-10-05 04:37:39 +00003<link href="resources/flexbox.css" rel="stylesheet">
tony@chromium.org16a286f2011-10-27 20:30:08 +00004<style>
5body {
6 margin: 0;
7}
8
9.flexbox {
tony@chromium.org16a286f2011-10-27 20:30:08 +000010 background-color: #aaa;
11 position: relative;
12}
13.horizontal {
14 width: 400px;
15}
16
17.horizontal div {
18 width: 100%;
19}
20.vertical {
hyatt@apple.com247170f2017-02-28 16:23:15 +000021 writing-mode: vertical-rl;
tony@chromium.org16a286f2011-10-27 20:30:08 +000022 height: 50px;
23}
24.vertical div {
25 height: 100%;
26}
27
28.flexbox > :nth-child(1) {
29 background-color: blue;
30}
31.flexbox > :nth-child(2) {
32 background-color: green;
33}
34.flexbox > :nth-child(3) {
35 background-color: red;
36}
37.flexbox > :nth-child(4) {
38 background-color: orange;
39}
40.child-div {
41 background-color: yellow;
42}
43</style>
hyatt@apple.com247170f2017-02-28 16:23:15 +000044<script src="../../resources/testharness.js"></script>
45<script src="../../resources/testharnessreport.js"></script>
46<script src="../../resources/check-layout-th.js"></script>
tony@chromium.orgb1541ca2012-07-13 19:58:47 +000047<body onload="checkLayout('.flexbox')">
hyatt@apple.com247170f2017-02-28 16:23:15 +000048<div id=log></div>
tony@chromium.orgda559b22012-10-05 04:37:39 +000049<div class="flexbox column horizontal">
hyatt@apple.com247170f2017-02-28 16:23:15 +000050 <div data-expected-height="10" data-offset-y="0" style="flex: 1 0 10px;"></div>
tony@chromium.org16a286f2011-10-27 20:30:08 +000051 <div data-expected-height="10" data-offset-y="10" style="height: 10px;"></div>
52 <div data-expected-height="10" data-offset-y="20"><div data-expected-height="10" data-offset-y="20" style="height: 10px"></div></div>
53</div>
54
55<!-- The last div is sized to 0 because there is no available space, however its child overflows. -->
tony@chromium.orgda559b22012-10-05 04:37:39 +000056<div class="flexbox column horizontal">
hyatt@apple.com247170f2017-02-28 16:23:15 +000057 <div data-expected-height="0" data-offset-y="0" style="flex: 1;"></div>
tony@chromium.org16a286f2011-10-27 20:30:08 +000058 <div data-expected-height="10" data-offset-y="0" style="height: 10px;"></div>
hyatt@apple.com247170f2017-02-28 16:23:15 +000059 <div data-expected-height="10" data-offset-y="10" style="flex: 1 auto;"><div style="height: 10px"></div></div>
60 <div data-expected-height="10" data-offset-y="20" style="min-height: 0; flex: 1;"><div data-expected-height="10" data-offset-y="20" class="child-div" style="height: 10px"></div></div>
tony@chromium.org16a286f2011-10-27 20:30:08 +000061</div>
62
tony@chromium.orgda559b22012-10-05 04:37:39 +000063<div class="flexbox column horizontal">
hyatt@apple.com247170f2017-02-28 16:23:15 +000064 <div data-expected-height="10" data-offset-y="10" style="flex: 1 0 10px; margin-top: 10px;"></div>
tony@chromium.org16a286f2011-10-27 20:30:08 +000065 <div data-expected-height="10" data-offset-y="20" style="height: 10px; margin-bottom: 20px;"></div>
66 <div data-expected-height="20" data-offset-y="50" style="padding-top: 10px"><div data-expected-height="10" data-offset-y="60" style="height: 10px"></div></div>
67</div>
68
tony@chromium.org730973c2012-06-01 23:18:21 +000069<!-- Same as previous test case but with a justify-content set. Since there's no
tony@chromium.org16a286f2011-10-27 20:30:08 +000070 available space, it should layout the same. -->
tony@chromium.orgda559b22012-10-05 04:37:39 +000071<div class="flexbox column horizontal justify-content-space-between">
hyatt@apple.com247170f2017-02-28 16:23:15 +000072 <div data-expected-height="10" data-offset-y="10" style="flex: 1 0 10px; margin-top: 10px;"></div>
tony@chromium.org16a286f2011-10-27 20:30:08 +000073 <div data-expected-height="10" data-offset-y="20" style="height: 10px; margin-bottom: 20px;"></div>
74 <div data-expected-height="20" data-offset-y="50" style="padding-top: 10px"><div data-expected-height="10" data-offset-y="60" style="height: 10px"></div></div>
75</div>
76
tony@chromium.orgda559b22012-10-05 04:37:39 +000077<div class="flexbox column horizontal" data-expected-height="20">
hyatt@apple.com247170f2017-02-28 16:23:15 +000078 <div data-expected-height="10" data-offset-y="0" style="flex: 0 1 auto;"><div style="height: 10px"></div></div>
79 <div data-expected-height="10" data-offset-y="10" style="flex: 0 2 auto;"><div style="height: 10px"></div></div>
tony@chromium.orgdcdb1072012-03-14 22:56:15 +000080</div>
81
tony@chromium.orgda559b22012-10-05 04:37:39 +000082<div class="flexbox column horizontal" style="min-height: 10px" data-expected-height="20">
hyatt@apple.com247170f2017-02-28 16:23:15 +000083 <div data-expected-height="10" data-offset-y="0" style="flex: 0 1 auto;"><div style="height: 10px"></div></div>
84 <div data-expected-height="10" data-offset-y="10" style="flex: 0 2 auto;"><div style="height: 10px"></div></div>
tony@chromium.orgdcdb1072012-03-14 22:56:15 +000085</div>
86
tony@chromium.orgda559b22012-10-05 04:37:39 +000087<div class="flexbox column horizontal" style="min-height: 5px; max-height: 17px;" data-expected-height="17">
hyatt@apple.com247170f2017-02-28 16:23:15 +000088 <div data-expected-height="9" data-offset-y="0" style="min-height: 0; flex: 0 1 auto;"><div style="height: 10px"></div></div>
89 <div data-expected-height="8" data-offset-y="9" style="min-height: 0; flex: 0 2 auto;"><div style="height: 10px"></div></div>
tony@chromium.orgdcdb1072012-03-14 22:56:15 +000090</div>
91
tony@chromium.orgda559b22012-10-05 04:37:39 +000092<div class="flexbox column horizontal" style="min-height: 5px; max-height: 30px; padding-top: 1px; padding-bottom: 2px;" data-expected-height="33">
hyatt@apple.com247170f2017-02-28 16:23:15 +000093 <div data-expected-height="15" data-offset-y="1" style="min-height: 0; flex: 0 1 auto;"><div style="height: 20px"></div></div>
94 <div data-expected-height="15" data-offset-y="16" style="min-height: 0; flex: 0 1 auto;"><div style="height: 20px"></div></div>
tony@chromium.orgdcdb1072012-03-14 22:56:15 +000095</div>
96
tony@chromium.orgda559b22012-10-05 04:37:39 +000097<div class="flexbox column horizontal">
tony@chromium.org00a34ec2012-03-16 20:16:17 +000098 <div data-expected-client-height="10" data-offset-y="0" style="overflow: scroll"><div data-expected-height=10 style="height: 10px"></div></div>
99</div>
100
tony@chromium.orgda559b22012-10-05 04:37:39 +0000101<div class="flexbox column vertical">
hyatt@apple.com247170f2017-02-28 16:23:15 +0000102 <div data-expected-width="10" data-offset-x="20" style="flex: 1 0 10px;"></div>
tony@chromium.org16a286f2011-10-27 20:30:08 +0000103 <div data-expected-width="10" data-offset-x="10" style="width: 10px;"></div>
104 <div data-expected-width="10" data-offset-x="0"><div data-expected-width="10" data-offset-x="0" style="width: 10px"></div></div>
105</div>
106
107<!-- The first div overflows to the left, so give it a margin-left so we can see box it paints. -->
tony@chromium.orgda559b22012-10-05 04:37:39 +0000108<div class="flexbox column vertical" style="margin-left: 100px;">
hyatt@apple.com247170f2017-02-28 16:23:15 +0000109 <div data-expected-width="50" data-offset-x="20" style="min-width: 0; flex: 1;"><div data-expected-width="50" data-offset-x="20" class="child-div" style="width: 50px"></div></div>
110 <div data-expected-width="0" data-offset-x="20" style="flex: 1;"></div>
tony@chromium.org16a286f2011-10-27 20:30:08 +0000111 <div data-expected-width="10" data-offset-x="10" style="width: 10px;"></div>
hyatt@apple.com247170f2017-02-28 16:23:15 +0000112 <div data-expected-width="10" data-offset-x="0" style="flex: 1 auto;"><div style="width: 10px"></div></div>
tony@chromium.org16a286f2011-10-27 20:30:08 +0000113</div>
114
115</body>
116</html>