summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-layout-api/child-constraints/available-size-for-percentages-invalid.https.html
blob: 8bd969271e0c257ec2c374eda0cb03d1b0a84912 (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
<!DOCTYPE html>
<html class=reftest-wait>
<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-availableinlinesize">
<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-availableblocksize">
<link rel="match" href="../green-square-ref.html">
<meta name="assert" content="This test checks that resolving percentages against an invalid available size works as expected." />

<style>
.test {
  background: red;
  width: 100px;
}

.child {
  visibility: hidden;
  width: 10px;
  line-height: 0;

  --available-inline-size: -20;
  --available-block-size: -10;
}

.inline {
  display: inline-block;
  width: 10px;
  height: 10px;
}

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

<div class="test">
  <!-- The available inline-size gets clamped to zero, and the available block-size gets treated as indefinite. -->
  <div class="child" style="--inline-size-expected: 0px; --block-size-expected: 10px; width: 100%; height: 100%;">
    <div class="inline"></div>
  </div>

  <!-- For replaced elements, both axis should be resolved to 0px. -->
  <img class="child" style="--inline-size-expected: 0px; --block-size-expected: 0px; width: 100%; height: 100%;" />
<script>
importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: 'support/layout-child-sizes-worklet.js'});
</script>