summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-layout-api/intrinsic-sizes/content-size.https.html
blob: ed87dd5065006ffd3a6249a7b9fa76c58d25bb1d (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
<!DOCTYPE html>
<html class=reftest-wait>
<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#interaction-sizing">
<link rel="match" href="content-size-ref.html">
<meta name="assert" content="This test checks that the min-content and max-content sizes respect the values returned from the intrinsicSizes function." />

<style>
.test {
  background: red;
  border: solid 2px;
  height: 100px;
}

.test-1 {
  width: max-content;
}

.test-2 {
  width: min-content;
}

@supports (display: layout(test-layout)) {
  .test {
    display: layout(test-layout);
    background: green;
  }
}
</style>
<script src="/common/reftest-wait.js"></script>
<script src="/common/worklet-reftest.js"></script>


<div class="test test-1"></div>
<div class="test test-2"></div>

<script id="code" type="text/worklet">
registerLayout('test-layout', class {
  async intrinsicSizes() {
    return { maxContentSize: 100, minContentSize: 50 };
  }
  async layout() {}
});
</script>

<script>
importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, document.getElementById('code').textContent);
</script>
</html>