wpt / css / css-borders / border-shape / border-shape-overflow-replaced-canvas.html

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

/css/css-borders/border-shape/border-shape-overflow-replaced-canvas.html

<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Borders Test: border-shape overflow clips canvas child</title>
<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">
<link rel="match" href="border-shape-overflow-replaced-ref.html">
<meta name="assert" content="When border-shape provides a single shape with overflow:hidden, a canvas child should be clipped to the inner edge of the border.">
<meta name="fuzzy" content="maxDifference=0-70;totalPixels=0-400">
<style>
body {
  margin: 0;
  padding: 20px;
}
.target {
  width: 100px;
  height: 100px;
  border: 10px solid black;
  border-shape: circle(50%);
  overflow: hidden;
}
.target > canvas {
  display: block;
  width: 100%;
  height: 100%;
}
</style>
<div class="target">
  <canvas id="c" width="100" height="100"></canvas>
</div>
<script>
const ctx = document.getElementById('c').getContext('2d');
ctx.fillStyle = 'lime';
ctx.fillRect(0, 0, 100, 100);
</script>

/css/css-borders/border-shape/border-shape-overflow-replaced-ref.html

<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Borders Test: border-shape overflow clipping of replaced elements reference</title>
<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">
<style>
body {
  margin: 0;
  padding: 20px;
}
.target {
  width: 100px;
  height: 100px;
  border: 10px solid black;
  border-shape: circle(50%);
  background: lime;
}
</style>
<div class="target"></div>