blob: 12cbf63683245e479b7649d9dcda0886a2b56a93 [file] [log] [blame]
<!DOCTYPE html>
<html>
<link href="resources/flexbox.css" rel="stylesheet">
<style>
body {
margin: 0;
}
.flexbox {
background-color: #aaa;
position: relative;
}
.horizontal {
width: 400px;
}
.horizontal div {
width: 100%;
}
.vertical {
writing-mode: vertical-rl;
height: 50px;
}
.vertical div {
height: 100%;
}
.flexbox > :nth-child(1) {
background-color: blue;
}
.flexbox > :nth-child(2) {
background-color: green;
}
.flexbox > :nth-child(3) {
background-color: red;
}
.flexbox > :nth-child(4) {
background-color: orange;
}
.child-div {
background-color: yellow;
}
</style>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../../resources/check-layout-th.js"></script>
<body onload="checkLayout('.flexbox')">
<div id=log></div>
<div class="flexbox column horizontal">
<div data-expected-height="10" data-offset-y="0" style="flex: 1 0 10px;"></div>
<div data-expected-height="10" data-offset-y="10" style="height: 10px;"></div>
<div data-expected-height="10" data-offset-y="20"><div data-expected-height="10" data-offset-y="20" style="height: 10px"></div></div>
</div>
<!-- The last div is sized to 0 because there is no available space, however its child overflows. -->
<div class="flexbox column horizontal">
<div data-expected-height="0" data-offset-y="0" style="flex: 1;"></div>
<div data-expected-height="10" data-offset-y="0" style="height: 10px;"></div>
<div data-expected-height="10" data-offset-y="10" style="flex: 1 auto;"><div style="height: 10px"></div></div>
<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>
</div>
<div class="flexbox column horizontal">
<div data-expected-height="10" data-offset-y="10" style="flex: 1 0 10px; margin-top: 10px;"></div>
<div data-expected-height="10" data-offset-y="20" style="height: 10px; margin-bottom: 20px;"></div>
<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>
</div>
<!-- Same as previous test case but with a justify-content set. Since there's no
available space, it should layout the same. -->
<div class="flexbox column horizontal justify-content-space-between">
<div data-expected-height="10" data-offset-y="10" style="flex: 1 0 10px; margin-top: 10px;"></div>
<div data-expected-height="10" data-offset-y="20" style="height: 10px; margin-bottom: 20px;"></div>
<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>
</div>
<div class="flexbox column horizontal" data-expected-height="20">
<div data-expected-height="10" data-offset-y="0" style="flex: 0 1 auto;"><div style="height: 10px"></div></div>
<div data-expected-height="10" data-offset-y="10" style="flex: 0 2 auto;"><div style="height: 10px"></div></div>
</div>
<div class="flexbox column horizontal" style="min-height: 10px" data-expected-height="20">
<div data-expected-height="10" data-offset-y="0" style="flex: 0 1 auto;"><div style="height: 10px"></div></div>
<div data-expected-height="10" data-offset-y="10" style="flex: 0 2 auto;"><div style="height: 10px"></div></div>
</div>
<div class="flexbox column horizontal" style="min-height: 5px; max-height: 17px;" data-expected-height="17">
<div data-expected-height="9" data-offset-y="0" style="min-height: 0; flex: 0 1 auto;"><div style="height: 10px"></div></div>
<div data-expected-height="8" data-offset-y="9" style="min-height: 0; flex: 0 2 auto;"><div style="height: 10px"></div></div>
</div>
<div class="flexbox column horizontal" style="min-height: 5px; max-height: 30px; padding-top: 1px; padding-bottom: 2px;" data-expected-height="33">
<div data-expected-height="15" data-offset-y="1" style="min-height: 0; flex: 0 1 auto;"><div style="height: 20px"></div></div>
<div data-expected-height="15" data-offset-y="16" style="min-height: 0; flex: 0 1 auto;"><div style="height: 20px"></div></div>
</div>
<div class="flexbox column horizontal">
<div data-expected-client-height="10" data-offset-y="0" style="overflow: scroll"><div data-expected-height=10 style="height: 10px"></div></div>
</div>
<div class="flexbox column vertical">
<div data-expected-width="10" data-offset-x="20" style="flex: 1 0 10px;"></div>
<div data-expected-width="10" data-offset-x="10" style="width: 10px;"></div>
<div data-expected-width="10" data-offset-x="0"><div data-expected-width="10" data-offset-x="0" style="width: 10px"></div></div>
</div>
<!-- The first div overflows to the left, so give it a margin-left so we can see box it paints. -->
<div class="flexbox column vertical" style="margin-left: 100px;">
<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>
<div data-expected-width="0" data-offset-x="20" style="flex: 1;"></div>
<div data-expected-width="10" data-offset-x="10" style="width: 10px;"></div>
<div data-expected-width="10" data-offset-x="0" style="flex: 1 auto;"><div style="width: 10px"></div></div>
</div>
</body>
</html>