<!DOCTYPE html>
<html>
<style>
body {
    margin: 0;
}
.flexbox {
    width: 600px;
    display: flex;
    background-color: #aaa;
    position: relative;
}
.flexbox > * {
    flex: none;
}
.flexbox > :nth-child(1) {
    background-color: blue;
}
.flexbox > :nth-child(2) {
    background-color: green;
}

.flexbox > div > :nth-child(1) {
    background-color: pink;
}
.flexbox > div > :nth-child(2) {
    background-color: purple;
}

.flexbox > div > div > :nth-child(1) {
    background-color: red;
}
.flexbox > div > div > :nth-child(2) {
    background-color: yellow;
}

.nested {
    display: flex;
    background-color: #ddd;
}

.rtl {
    direction: rtl;
}
.vertical-rl {
    writing-mode: vertical-rl;
}
.vertical-lr {
    writing-mode: vertical-lr;
}
.row-reverse {
    flex-flow: row-reverse;
}
.column {
    flex-flow: column;
}
.column-reverse {
    flex-flow: column-reverse;
}

.align-start {
    align-self: flex-start;
}
</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">
    <div class="column nested">
        <div data-expected-height="50" style="flex: 1 0 0; width: 100px;"></div>
        <div data-expected-height="50" style="flex: 1 0 0; width: 100px;"></div>
    </div>
    <div data-expected-width="500" style="flex: 1 0 0; height:100px;"></div>
</div>

<div class="flexbox">
    <div class="column nested align-start">
        <div data-expected-height="0" style="flex: 1 0 0; width: 100px;"></div>
        <div data-expected-height="0" style="flex: 1 0 0; width: 100px;"></div>
    </div>
    <div data-expected-width="500" style="flex: 1 0 0; height:100px;"></div>
</div>

<div class="flexbox">
    <div class="column nested align-start" style="height: 50px">
        <div data-expected-height="25" style="flex: 1 0 0; width: 100px;"></div>
        <div data-expected-height="25" style="flex: 1 0 0; width: 100px;"></div>
    </div>
    <div data-expected-width="500" style="flex: 1 0 0; height:100px;"></div>
</div>

<div class="flexbox">
    <div class="column nested" style="height: 50px">
        <div class="nested" style="flex: 1; width: 100px;">
            <div data-expected-height="25" style="flex: 1 0 auto;"></div>
            <div data-expected-height="25" style="flex: 1 0 auto;"></div>
        </div>
        <div style="flex: 1;"></div>
    </div>
    <div data-expected-width="500" style="flex: 1 0 0; height:100px;"></div>
</div>

<div class="flexbox column" style="height: 100px">
    <div class="row-reverse nested" style="flex: 1; width: 100px;">
        <div data-expected-width="50" style="flex: 1 0 auto;"></div>
        <div data-expected-width="50" style="flex: 1 0 auto;"></div>
    </div>
    <div data-expected-height="50" style="flex: 1 0 0;"></div>
</div>

<div class="flexbox column-reverse" style="height: 100px">
    <div class="row-reverse nested" style="flex: 1; width: 100px;">
        <div data-expected-width="50" style="flex: 1 0 auto;"></div>
        <div data-expected-width="50" style="flex: 1 0 auto;"></div>
    </div>
    <div data-expected-height="50" style="flex: 1 0 0;"></div>
</div>

<div class="flexbox vertical-lr" style="height: 100px">
    <div class="column nested" style="flex: 1; width: 100px;">
        <div data-expected-width="50" style="flex: 1 0 auto;"></div>
        <div data-expected-width="50" style="flex: 1 0 auto;"></div>
    </div>
    <div data-expected-height="50" style="flex: 1 0 0;"></div>
</div>

</body>
</html>
