wpt / css / css-borders / border-shape / border-shape-overflow-child-clip.html

Status: PASS | Duration: 6ms | Subtests: 1/1 | Open test on wpt.live | Open ref on wpt.live | wpt.fyi

/css/css-borders/border-shape/border-shape-overflow-child-clip.html

<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Borders Test: border-shape overflow clipping does not let children paint over border</title>
<link rel="help" href="https://drafts.csswg.org/css-borders-4/#border-shape">
<link rel="match" href="border-shape-overflow-child-clip-ref.html">
<meta name="assert" content="When border-shape provides a single shape with overflow:hidden, the child content should be clipped to the inner edge of the border, not the center of the border stroke.">
<meta name="fuzzy" content="maxDifference=0-70;totalPixels=0-400">
<style>
body {
  margin: 0;
}
.container {
  display: flex;
  gap: 32px;
  padding: 20px;
}

/* Test: circle shape with child that fills the content area */
.target {
  width: 100px;
  height: 100px;
  border: 10px solid black;
  overflow: hidden;
}
.target > div {
  width: 100%;
  height: 100%;
  background: green;
}

#with-child {
  border-shape: circle(50%);
}

/* Reference: same shape without child should have the same border width */
#without-child {
  border-shape: circle(50%);
  background: green;
}
</style>
<div class="container">
  <div class="target" id="with-child"><div></div></div>
  <div class="target" id="without-child"></div>
</div>

/css/css-borders/border-shape/border-shape-overflow-child-clip-ref.html

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