wpt / css / filter-effects / svg-empty-element-with-filter-001.html

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

/css/filter-effects/svg-empty-element-with-filter-001.html

<!DOCTYPE html>
<title>CSS Filter Effects: ref filters on empty SVG shapes</title>
<link rel="help" href="https://drafts.fxtf.org/filter-effects/#FilterProperty">
<link rel="help" href="https://www.w3.org/TR/SVG2/shapes.html">
<link rel="help" href="https://www.w3.org/TR/SVG2/paths.html#PathDataBNF">
<link rel="match" href="/common/blank.html">
<meta name="assert" content="This test ensures filters are not rendered for SVG shapes that are empty (zero-sized or no segments).">

<svg>
  <defs>
    <filter id="myfilter" filterUnits="userSpaceOnUse" x="0" y="0" width="100" height="100">
      <feFlood flood-color="red" flood-opacity="1"/>
    </filter>
  </defs>

  <!-- All elements below are empty. If the elements do not disable rendering,
    we'll see a red box. This would violate the SVG spec language such as rect's
    "A computed value of zero for either dimension disables rendering of the
    element."-->

  <rect x="10" y="10" width="0" height="0" fill="red" filter="url(#myfilter)"/>

  <circle cx="40" cy="40" r="0" fill="red" filter="url(#myfilter)"/>
  <ellipse cx="50" cy="50" rx="0" ry="20" fill="red" filter="url(#myfilter)"/>

  <!-- Paths with an empty d or d===none should disable rendering -->
  <path d="" fill="red" filter="url(#myfilter)"/>
  <path fill="red" filter="url(#myfilter)"/>

  <polygon points="" fill="red" filter="url(#myfilter)"/>
  <polyline points="" fill="none" stroke="red" filter="url(#myfilter)"/>

  <image x="10" y="10" width="10" height="0" filter="url(#myfilter)" />
</svg>