summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-flexbox/stretched-child-shrink-on-relayout.html
blob: b427d7f01a2fca121c2dcd2b2b6d9d9ff5c7e906 (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
<!DOCTYPE html>
<title>CSS Flexbox: Shrink stretched child on relayout</title>
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#flex-property">
<link rel="help" href="https://drafts.csswg.org/css-flexbox/#flex-flow-property">
<meta name="assert" content="This ensures that flexbox shrinks stretched children after removing a sibling, in various writing-modes and flows.">
<style>
.flexbox {
    display: flex;
    background: papayawhip;
    border: 1px solid midnightblue;
    margin: 1em;
    width: 50px;
}

.flexbox > div {
    margin: 5px;
    min-width: 10px;
    min-height: 10px;
    background-color: lawngreen;
}

.column {
    flex-flow: column;
}

.horizontal-tb {
    writing-mode: horizontal-tb;
}
.vertical-lr {
    writing-mode: vertical-lr;
}

.largeitem {
    height: 200px;
    width: 200px;
    margin: 5px;
}
</style>
</head>
<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 data-expected-height=10 data-expected-width=10></div>
  <div class="largeitem"></div>
</div>
<div class="flexbox column">
  <div data-expected-height=10 data-expected-width=40></div>
  <div class="largeitem"></div>
</div>

<div class="flexbox">
  <div class="horizontal-tb" data-expected-height=10 data-expected-width=10></div>
  <div class="largeitem"></div>
</div>
<div class="flexbox column">
  <div class="horizontal-tb" data-expected-height=10 data-expected-width=40></div>
  <div class="largeitem"></div>
</div>
<div class="flexbox">
  <div class="vertical-lr" data-expected-height=10 data-expected-width=10></div>
  <div class="largeitem"></div>
</div>
<div class="flexbox column">
  <div class="vertical-lr" data-expected-height=10 data-expected-width=40></div>
  <div class="largeitem"></div>
</div>
<script>
document.body.offsetTop;
var targets = document.getElementsByClassName('largeitem');
for (var i = targets.length - 1; i >= 0; i--) {
  targets[i].remove();
};
</script>