wpt / css / css-layout-api / child-constraints / percentage-size-invalid.https.html

Status: FAIL | Duration: 8ms | Subtests: 0/1 | Open test on wpt.live | Open ref on wpt.live | wpt.fyi

/css/css-layout-api/child-constraints/percentage-size-invalid.https.html

<!DOCTYPE html>
<html class=reftest-wait>
<link rel="help" href="https://drafts.css-houdini.org/css-layout-api/#dom-layoutconstraintsoptions-percentageblocksize">
<link rel="match" href="../green-square-ref.html">
<meta name="assert" content="This test checks that setting an invalid percentage block-size of children works as expected." />

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

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

  --percentage-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">
  <!-- A percentage shouldn't be resolved against an invalid percentageBlockSize. -->
  <div class="child" style="--inline-size-expected: 10px; --block-size-expected: 10px; height: 100%;">
    <div class="inline"></div>
  </div>

  <!-- A percentage shouldn't be resolved against an invalid percentageBlockSize. -->
  <img class="child" style="--inline-size-expected: 10px; --block-size-expected: 0px; height: 100%;" />
<script>
importWorkletAndTerminateTestAfterAsyncPaint(CSS.layoutWorklet, {url: 'support/layout-child-sizes-worklet.js'});
</script>

/css/css-layout-api/green-square-ref.html

<!DOCTYPE html>
<style>
.result {
  background: green;
  height: 100px;
  width: 100px;
}
</style>
<div class="result"></div>