summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-flexbox/percentage-size.html
blob: 44c298672f2e39716d21d36220b270f0387aac2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!DOCTYPE html>
<title>CSS Flexbox: Percentage size in flexbox children</title>
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#flex-containers">
<link rel="help" href="https://drafts.csswg.org/css-sizing-3/#percentage-sizing">
<link rel="help" href="https://bugs.webkit.org/show_bug.cgi?id=81809">
<meta name="assert" content="This test checks that percentage height/width values are correctly resolved in flexbox children.">
<style>
.flexbox {
    display: flex;
}
.column, .column .fixed {
    height: 50px;
}
.row, .row .fixed {
    width: 50px;
}
.container > div {
    outline: 2px solid blue;
}
.row > div > div {
    height: 20px;
}
.flexbox > div {
    flex: 0 0 auto;
}
.column > .flexbox {
    flex-direction: column;
}
.container > div > :nth-child(1) {
    background-color: orange;
}
.container > div > :nth-child(2) {
    background-color: yellow;
}
.container > div > :nth-child(3) {
    background-color: salmon;
}
.container > div > :nth-child(4) {
    background-color: purple;
}
</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="container row">
    <div class="flexbox">
        <div style='width: 10px; min-width: 50%;' data-expected-width=25></div>
        <div style='width: 50%;' data-expected-width=25></div>
        <div style='width: 10px; max-width: 50%;' data-expected-width=10></div>
        <div style='min-width: 10px; width: 100px; max-width: 50%;' data-expected-width=25></div>
    </div>
</div>

<div class="container row" style='width: 100px'>
    <div class="flexbox fixed">
        <div style='width: 10px; min-width: 50%;' data-expected-width=25></div>
        <div style='width: 50%;' data-expected-width=25></div>
        <div style='width: 10px; max-width: 50%;' data-expected-width=10></div>
        <div style='min-width: 10px; width: 100px; max-width: 50%;' data-expected-width=25></div>
    </div>
</div>

<div class="container column" style='margin-bottom: 100px'>
    <div class="flexbox" style="height: auto">
        <div style='height: 10px; min-height: 50%;' data-expected-height=10></div>
        <div style='height: 50%;' data-expected-height=0></div>
        <div style='height: 10px; max-height: 50%;' data-expected-height=10></div>
        <div style='min-height: 10px; height: 100px; max-height: 50%;' data-expected-height=100></div>
    </div>
</div>

<div class="container column">
    <div class="flexbox fixed">
        <div style='height: 10px; min-height: 50%;' data-expected-height=25></div>
        <div style='height: 50%;' data-expected-height=25></div>
        <div style='height: 10px; max-height: 50%;' data-expected-height=10></div>
        <div style='min-height: 10px; height: 100px; max-height: 50%;' data-expected-height=25></div>
    </div>
</div>

<div class="container row">
    <div class="flexbox">
        <div style="flex: 0 0 50%" data-expected-width=25></div>
    </div>
</div>

<div class="container column">
    <div class="flexbox">
        <div style="flex: 0 0 50%" data-expected-height=0></div>
    </div>
</div>

<div class="container row">
    <div class="flexbox fixed">
        <div style="flex: 0 0 50%" data-expected-width=25></div>
    </div>
</div>

<div class="container column">
    <div class="flexbox fixed">
        <div style="flex: 0 0 50%" data-expected-height=25></div>
    </div>
</div>

</body>