summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-flexbox/percentage-heights-012.html
blob: 63f63aa8ec91b441ebae0754153260cc7b8d6d37 (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
<!DOCTYPE html>
<title>CSS Flexbox: percentages in flex items</title>
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#definite-sizes">
<link rel="help" href="https://crbug.com/341310">
<meta name="assert" content="This test ensures that percentages are resolved in flex items.">
<link href="support/flexbox.css" rel="stylesheet">
<style>
.horizontal {
    height: 50px;
    background-color: purple;
    position: relative;
}
.vertical {
    width: 50px;
    height: 10px;
    background-color: purple;
    position: relative;
    writing-mode: vertical-rl;
}
.flex-one {
    background-color: red;
}
</style>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>
<script>
function changeHeight()
{
  document.getElementById('dynamicHorizontalChild').style.height = "90%";
  document.getElementById('dynamicVerticalChild').style.width = "30%";
  checkLayout('.flexbox');
}
</script>
<body onload="changeHeight()">
<div class="flexbox horizontal">
  <div data-expected-height="50" class="flex-one">
    <div data-expected-height="35" style="height: 70%; background-color: lime"></div>
  </div>
</div>
<div class="flexbox horizontal">
  <div data-expected-height="50" class="flex-one">
    <div id="dynamicHorizontalChild" data-expected-height="45" style="height: 70%; background-color: lime"></div>
  </div>
</div>
<div class="flexbox horizontal">
  <div data-expected-height="50" class="flex-one" style="padding: 10px; border: 2px solid black">
    <div data-expected-height="18" style="height: 70%; background-color: lime"></div>
  </div>
</div>
<div class="flexbox horizontal">
  <img data-expected-height="25" style="max-height: 50%" src="support/10x10-green.png" />
</div>
<div class="flexbox horizontal">
  <div data-expected-height="25" class="flex-one" style="max-height:50%">
    <div data-expected-height="13" style="height: 50%; background-color: lime"></div>
  </div>
</div>
<div class="flexbox vertical">
  <div data-expected-width="50" class="flex-one">
    <div data-expected-width="25" style="width: 50%; background-color: lime"></div>
  </div>
</div>
<div class="flexbox vertical">
  <div data-expected-width="50" class="flex-one">
    <div id="dynamicVerticalChild" data-expected-width="15" style="width: 50%; background-color: lime"></div>
  </div>
</div>
<div class="flexbox vertical">
  <div data-expected-width="50" class="flex-one" style="padding: 10px; border: 2px solid black">
    <div data-expected-width="13" style="width: 50%; background-color: lime"></div>
  </div>
</div>
<div class="flexbox vertical">
  <img data-expected-width="25" style="max-width: 50%" src="support/10x10-green.png" />
</div>
<div class="flexbox vertical">
  <div data-expected-width="25" class="flex-one" style="max-width: 50%">
    <div data-expected-width="13" style="width: 50%; background-color: lime"></div>
  </div>
</div>
</body>