summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-element-shrink-to-fit.html
blob: de8096fd0be84ae80c0167421b40516a6c6040d5 (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
<!DOCTYPE html>
<html>
<style>
.grid {
    display: grid;
    grid-template-columns: 200px 200px;
    grid-template-rows: 200px 200px;
}

#absolutePos {
   position: absolute;
}

#fixedPos {
   position: fixed;
}

#floatPos {
   float: left;
}

#one {
    color: blue;
    background: red;
    grid-column: 1;
    grid-row: 1;
}

#two {
    color: yellow;
    background: green;
    grid-column: 2;
    grid-row: 1;
}
#three {
    color: gray;
    background: pink;
    grid-column: 1;
    grid-row: 2;
}
#four {
    color: orange;
    background: brown;
    grid-column: 2;
    grid-row: 2;
}
</style>
<script src="../../resources/check-layout.js"></script>
<body onload="checkLayout('.grid')">

<p>This test checks that the shrink-to-fit behavior is applied to the float and out-of-flow positioned elements.</p>
<p>The following grids should be 400px * 400px, except the first one which uses 'relative' positioning.</p>

<div class="grid" id="regularGrid" data-expected-height="400" data-expected-width="769">
  <div id="one"></div>
  <div id="two"></div>
  <div id="three"></div>
  <div id="four"></div>
</div>

<div class="grid" id="absolutePos" data-expected-height="400" data-expected-width="400">
  <div class="gg" id="one"></div>
  <div class="gg" id="two"></div>
  <div class="gg" id="three"></div>
  <div class="gg" id="four"></div>
</div>

<div class="grid" id="fixedPos" data-expected-height="400" data-expected-width="400">
  <div class="gg" id="one"></div>
  <div class="gg" id="two"></div>
  <div class="gg" id="three"></div>
  <div class="gg" id="four"></div>
</div>

<div class="grid" id="floatPos" data-expected-height="400" data-expected-width="400">
  <div class="gg" id="one"></div>
  <div class="gg" id="two"></div>
  <div class="gg" id="three"></div>
  <div class="gg" id="four"></div>
</div>

</body>
</html>