summaryrefslogtreecommitdiffstats
path: root/layout/reftests/css-grid/grid-item-auto-min-size-clamp-003.html
blob: 256554ee3c9a360341825c25a347aa81ede94e04 (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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!DOCTYPE html>
<!--
     Any copyright is dedicated to the Public Domain.
     http://creativecommons.org/publicdomain/zero/1.0/
-->
<html><head>
  <meta charset="utf-8">
  <title>CSS Grid Test: Clamp 'automatic minimum size' to definite max-sizing for intrinsic ratio item</title>
  <link rel="author" title="Mats Palmgren" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1300369">
  <link rel="help" href="https://drafts.csswg.org/css-grid/#min-size-auto">
  <link rel="match" href="grid-item-auto-min-size-clamp-003-ref.html">
  <style type="text/css">
body,html { color:black; background:white; font:16px/1 monospace; padding:0; margin:0; }

.grid {
  display: grid;
  grid-template-columns: repeat(2,minmax(auto, 15px));
  grid-template-rows:    repeat(2,minmax(auto, 10px));
  grid-gap: 1px;
  align-items: start;
  justify-items: start;
  float: left;
  border: 1px dashed;
  margin-right: 16px;
  margin-bottom: 14px;
}
.sz {
  width: 40px;
  height: 40px;
}

.definite {
  grid-template-columns: repeat(2,15px);
  grid-template-rows:    repeat(2,10px);
}
.min {
  grid-template-columns: repeat(2,minmax(min-content, 15px));
  grid-template-rows:    repeat(2,minmax(min-content, 10px));
}
.max {
  grid-template-columns: repeat(2,minmax(max-content, 15px));
  grid-template-rows:    repeat(2,minmax(max-content, 10px));
}

.larger .grid {
  grid-template-columns: repeat(2,minmax(auto, 25px));
  grid-template-rows:    repeat(2,minmax(auto, 28px));
}
.larger .definite {
  grid-template-columns: repeat(2,25px);
  grid-template-rows:    repeat(2,28px);
}
.larger .min {
  grid-template-columns: repeat(2,minmax(min-content, 25px));
  grid-template-rows:    repeat(2,minmax(min-content, 28px));
}
.larger .max {
  grid-template-columns: repeat(2,minmax(max-content, 25px));
  grid-template-rows:    repeat(2,minmax(max-content, 28px));
}

.stretch .grid {
  align-items: stretch;
  justify-items: stretch;
}

img {
  grid-area: 1 / 1;
  border: 1px solid;
  padding: 1px 3px 5px 7px;
  margin: 3px 5px 7px 1px;
}
.span2 {
  grid-area: 1 / 1 / span 2 / span 2;
}
.larger .grid .span2 {
  font-size: 32px;
}

x {
  grid-area: 1 / 1;
  min-width: 0;
  min-height: 0;
  align-self: stretch;
  justify-self: stretch;
  background: cyan;
}

br {
  clear: both;
}
  </style>
</head>
<body>

<div id="tests">
<div class="grid"><x></x><img src="support/solidblue-20x32.png"></div>
<div class="grid definite"><x></x><img src="support/solidblue-20x32.png"></div>
<div class="grid"><x></x><img class="span2" src="support/solidblue-20x32.png"></div>
<div class="grid definite"><x></x><img class="span2" src="support/solidblue-20x32.png"></div>

<div class="grid sz"><x></x><img src="support/solidblue-20x32.png"></div>
<div class="grid sz definite"><x></x><img src="support/solidblue-20x32.png"></div>
<div class="grid sz"><x></x><img class="span2" src="support/solidblue-20x32.png"></div>
<div class="grid sz definite"><x></x><img class="span2" src="support/solidblue-20x32.png"></div>

<br>

<div class="grid min"><x></x><img src="support/solidblue-20x32.png"></div>
<div class="grid min"><x></x><img class="span2" src="support/solidblue-20x32.png"></div>
<div class="grid sz min"><x></x><img src="support/solidblue-20x32.png"></div>
<div class="grid sz min"><x></x><img class="span2" src="support/solidblue-20x32.png"></div>

<div class="grid max"><x></x><img src="support/solidblue-20x32.png"></div>
<div class="grid max"><x></x><img class="span2" src="support/solidblue-20x32.png"></div>
<div class="grid sz max"><x></x><img src="support/solidblue-20x32.png"></div>
<div class="grid sz max"><x></x><img class="span2" src="support/solidblue-20x32.png"></div>

<br>

</div>

<script>
var tests = document.getElementById('tests');

var n = tests.cloneNode(true);
var wrap = document.createElement('div');
wrap.className = 'larger';
wrap.appendChild(n);
document.body.appendChild(wrap);

var n = tests.cloneNode(true);
var wrap = document.createElement('div');
wrap.className = 'stretch';
wrap.appendChild(n);
document.body.appendChild(wrap);

var n = tests.cloneNode(true);
var wrap = document.createElement('div');
wrap.className = 'stretch larger';
wrap.appendChild(n);
document.body.appendChild(wrap);

</script>

<!--  For generating image size results in -ref file
<script>
document.body.clientHeight;
var imgs = document.querySelectorAll('img');
var s = '  [\n';
for (var i = 0; i < imgs.length; ++i) {
  s += "  ['"+ imgs[i].width + "px', '" + imgs[i].height + "px'],\n";
}
s += ']';
console.log(s)
</script>
-->

</body></html>