diff options
Diffstat (limited to 'layout/reftests/svg/filters/svg-filter-chains')
24 files changed, 806 insertions, 0 deletions
diff --git a/layout/reftests/svg/filters/svg-filter-chains/clip-input-ref.svg b/layout/reftests/svg/filters/svg-filter-chains/clip-input-ref.svg new file mode 100644 index 0000000000..4939ce12ae --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/clip-input-ref.svg @@ -0,0 +1,26 @@ +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<svg id="svg-root" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + + <g id="testmeta"> + <title>SVG Filter Chains: Clip Input Filter</title> + <link rel="copyright" + href="http://www.w3.org/Graphics/SVG/Test/Copyright"/> + <link rel="license" + href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license.html"/> + <link rel="author" + title="Max Vujovic" + href="mailto:mvujovic@adobe.com"/> + <link rel="help" + href="http://dev.w3.org/fxtf/filters/#FilterPrimitiveSubRegion"/> + <metadata class="flags">namespace svg</metadata> + </g> + + <g id="test-body-content"> + <rect x="0" y="0" width="100" height="100" fill="green"/> + </g> +</svg> diff --git a/layout/reftests/svg/filters/svg-filter-chains/clip-input.svg b/layout/reftests/svg/filters/svg-filter-chains/clip-input.svg new file mode 100644 index 0000000000..8dd2841add --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/clip-input.svg @@ -0,0 +1,52 @@ +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<svg id="svg-root" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + + <g id="testmeta"> + <title>SVG Filter Chains: Clip Input Filter</title> + <link rel="copyright" + href="http://www.w3.org/Graphics/SVG/Test/Copyright"/> + <link rel="license" + href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license.html"/> + <link rel="author" + title="Max Vujovic" + href="mailto:mvujovic@adobe.com"/> + <link rel="help" + href="http://dev.w3.org/fxtf/filters/#FilterPrimitiveSubRegion"/> + <link rel="match" + href="clip-input-ref.svg" /> + <metadata class="flags">namespace svg</metadata> + <desc class="assert"> + In an SVG filter chain, this test verifies that a filter region clips a + SourceGraphic input filter. If the test passes, you should see a green + square. + </desc> + </g> + + <g id="test-body-content"> + <filter id="f1" x="100" y="0" width="100" height="100" filterUnits="userSpaceOnUse"> + <!-- Create a red square at x=100. --> + <feFlood flood-color="red"/> + </filter> + <filter id="f2" x="0" y="0" width="100" height="100" filterUnits="userSpaceOnUse"> + <!-- Create a green square at x=0. --> + <feFlood result="green" flood-color="green"/> + <!-- + Attempt to offset the red square left to cover up the green square. + However, this filter's filter region should clip away the red square, + and only transparent pixels should be offset left, leaving the green + square intact. + --> + <feOffset result="red" in="SourceGraphic" dx="-100" x="0" y="0" width="200" height="100"/> + <feMerge> + <feMergeNode in="green"/> + <feMergeNode in="red"/> + </feMerge> + </filter> + <rect x="0" y="0" width="100" height="100" filter="url(#f1) url(#f2)"/> + </g> +</svg> diff --git a/layout/reftests/svg/filters/svg-filter-chains/clip-original-SourceGraphic-ref.svg b/layout/reftests/svg/filters/svg-filter-chains/clip-original-SourceGraphic-ref.svg new file mode 100644 index 0000000000..048dc64687 --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/clip-original-SourceGraphic-ref.svg @@ -0,0 +1,26 @@ +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<svg id="svg-root" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + + <g id="testmeta"> + <title>SVG Filter Chains: Clip Original SourceGraphic</title> + <link rel="copyright" + href="http://www.w3.org/Graphics/SVG/Test/Copyright"/> + <link rel="license" + href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license.html"/> + <link rel="author" + title="Max Vujovic" + href="mailto:mvujovic@adobe.com"/> + <link rel="help" + href="http://dev.w3.org/fxtf/filters/#FilterPrimitiveSubRegion"/> + <metadata class="flags">namespace svg</metadata> + </g> + + <g id="test-body-content"> + <rect x="0" y="0" width="100" height="100" fill="green"/> + </g> +</svg> diff --git a/layout/reftests/svg/filters/svg-filter-chains/clip-original-SourceGraphic.svg b/layout/reftests/svg/filters/svg-filter-chains/clip-original-SourceGraphic.svg new file mode 100644 index 0000000000..f6349768ed --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/clip-original-SourceGraphic.svg @@ -0,0 +1,50 @@ +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<svg id="svg-root" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + + <g id="testmeta"> + <title>SVG Filter Chains: Clip Original SourceGraphic</title> + <link rel="copyright" + href="http://www.w3.org/Graphics/SVG/Test/Copyright"/> + <link rel="license" + href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license.html"/> + <link rel="author" + title="Max Vujovic" + href="mailto:mvujovic@adobe.com"/> + <link rel="help" + href="http://dev.w3.org/fxtf/filters/#FilterPrimitiveSubRegion"/> + <link rel="match" + href="clip-original-SourceGraphic-ref.svg" /> + <metadata class="flags">namespace svg</metadata> + <desc class="assert"> + In an SVG filter chain, this test verifies that the filter region of the + first filter clips the original SourceGraphic. If the test passes, you + should see a green square. + </desc> + </g> + + <g id="test-body-content"> + <!-- + Use a filter region less wide than the red rectangle SourceGraphic. This + should clip the red rectangle, resulting in a red square. + --> + <filter id="f1" x="0" y="0" width="100" height="100" filterUnits="userSpaceOnUse"> + <!-- Create a green square at x=0. --> + <feFlood result="green" flood-color="green" x="0" y="0" width="100" height="100"/> + <!-- + Offset the red SourceGraphic left. If it wasn't clipped properly, it + will cover up the green square. If it was clipped properly, it won't. + --> + <feOffset result="offset-red" in="SourceGraphic" dx="-100" x="0" y="0" width="200" height="100"/> + <feMerge> + <feMergeNode in="green"/> + <feMergeNode in="offset-red"/> + </feMerge> + </filter> + <rect x="0" y="0" width="200" height="100" filter="url(#f1)" fill="red"/> + </g> +</svg> diff --git a/layout/reftests/svg/filters/svg-filter-chains/clip-output-ref.svg b/layout/reftests/svg/filters/svg-filter-chains/clip-output-ref.svg new file mode 100644 index 0000000000..26b6cc7f03 --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/clip-output-ref.svg @@ -0,0 +1,30 @@ +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<svg id="svg-root" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + + <g id="testmeta"> + <title>SVG Filter Chains: Clip Filter Output</title> + <link rel="copyright" + href="http://www.w3.org/Graphics/SVG/Test/Copyright"/> + <link rel="license" + href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license.html"/> + <link rel="author" + title="Max Vujovic" + href="mailto:mvujovic@adobe.com"/> + <link rel="help" + href="http://dev.w3.org/fxtf/filters/#FilterPrimitiveSubRegion"/> + <metadata class="flags">namespace svg</metadata> + </g> + + <g id="test-body-content"> + <filter id="hue-rotate"> + <!-- Turn the red square green. --> + <feColorMatrix type="hueRotate" values="90" style="color-interpolation-filters:sRGB"/> + </filter> + <rect x="0" y="0" width="100" height="100" filter="url(#hue-rotate)" fill="red"/> + </g> +</svg> diff --git a/layout/reftests/svg/filters/svg-filter-chains/clip-output.svg b/layout/reftests/svg/filters/svg-filter-chains/clip-output.svg new file mode 100644 index 0000000000..94d3a953ab --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/clip-output.svg @@ -0,0 +1,52 @@ +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<svg id="svg-root" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + + <g id="testmeta"> + <title>SVG Filter Chains: Clip Filter Output</title> + <link rel="copyright" + href="http://www.w3.org/Graphics/SVG/Test/Copyright"/> + <link rel="license" + href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license.html"/> + <link rel="author" + title="Max Vujovic" + href="mailto:mvujovic@adobe.com"/> + <link rel="help" + href="http://dev.w3.org/fxtf/filters/#FilterPrimitiveSubRegion"/> + <link rel="match" + href="clip-output-ref.svg" /> + <metadata class="flags">namespace svg</metadata> + <desc class="assert"> + In an SVG filter chain, this test verifies a filter region clips its + filter's output into the next filter. If the test passes, you should see a + green square. + </desc> + </g> + + <g id="test-body-content"> + <filter id="flood" x="0" y="0" width="100" height="100" filterUnits="userSpaceOnUse"> + <!-- + Create a red square followed by a blue square. The blue square should be + clipped away due to this filter's filter region. + --> + <feFlood result="red" flood-color="red" x="0" y="0" width="100" height="100"/> + <feFlood result="blue" flood-color="blue" x="100" y="0" width="100" height="100"/> + <feMerge> + <feMergeNode in="red"/> + <feMergeNode in="blue"/> + </feMerge> + </filter> + <filter id="hue-rotate" x="0" y="0" width="200" height="100" filterUnits="userSpaceOnUse"> + <!-- + Turn the red square green. If the blue square wasn't clipped by the + previous filter's filter region, it will turn red. + --> + <feColorMatrix type="hueRotate" values="90" style="color-interpolation-filters:sRGB"/> + </filter> + <rect x="0" y="0" width="100" height="100" filter="url(#flood) url(#hue-rotate)"/> + </g> +</svg> diff --git a/layout/reftests/svg/filters/svg-filter-chains/default-subregion-ref.svg b/layout/reftests/svg/filters/svg-filter-chains/default-subregion-ref.svg new file mode 100644 index 0000000000..86d77e2008 --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/default-subregion-ref.svg @@ -0,0 +1,29 @@ +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<svg id="svg-root" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + + <g id="testmeta"> + <title>SVG Filter Chains: Default Filter Primitive Subregion</title> + <link rel="copyright" + href="http://www.w3.org/Graphics/SVG/Test/Copyright"/> + <link rel="license" + href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license.html"/> + <link rel="author" + title="Max Vujovic" + href="mailto:mvujovic@adobe.com"/> + <link rel="help" + href="http://dev.w3.org/fxtf/filters/#FilterPrimitiveSubRegion"/> + <metadata class="flags">namespace svg</metadata> + </g> + + <g id="test-body-content"> + <filter id="f1" x="50" y="50" width="200" height="200" filterUnits="userSpaceOnUse"> + <feGaussianBlur stdDeviation="10"/> + </filter> + <rect x="100" y="100" width="100" height="100" filter="url(#f1)" fill="green"/> + </g> +</svg> diff --git a/layout/reftests/svg/filters/svg-filter-chains/default-subregion.svg b/layout/reftests/svg/filters/svg-filter-chains/default-subregion.svg new file mode 100644 index 0000000000..b175fe0a31 --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/default-subregion.svg @@ -0,0 +1,48 @@ +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<svg id="svg-root" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + + <g id="testmeta"> + <title>SVG Filter Chains: Default Filter Primitive Subregion</title> + <link rel="copyright" + href="http://www.w3.org/Graphics/SVG/Test/Copyright"/> + <link rel="license" + href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license.html"/> + <link rel="author" + title="Max Vujovic" + href="mailto:mvujovic@adobe.com"/> + <link rel="help" + href="http://dev.w3.org/fxtf/filters/#FilterPrimitiveSubRegion"/> + <link rel="match" + href="default-subregion-ref.svg" /> + <metadata class="flags">namespace svg</metadata> + <desc class="assert"> + In an SVG filter chain, this test verifies that the default filter + primitive subregion is equal to the filter region. If the test passes, + you should see a blurred green square. + </desc> + </g> + + <g id="test-body-content"> + <filter id="f1" x="100" y="100" width="100" height="100" filterUnits="userSpaceOnUse"> + <!-- Fill a 100x100 square with green. --> + <feFlood flood-color="green"/> + </filter> + <filter id="f2" x="50" y="50" width="200" height="200" filterUnits="userSpaceOnUse"> + <!-- + This feGaussianBlur primitive blurs the 100x100 green square from the + previous filter. It does not explicitly define a filter primitive + subregion, so its subregion should equal the filter region. The filter + region has plenty of space for the blur outsets, so the blur should not + appear clipped. If the blur incorrectly uses a primitive subregion or + filter region from a previous filter, the blur may appear clipped. + --> + <feGaussianBlur stdDeviation="10"/> + </filter> + <rect x="100" y="100" width="100" height="100" filter="url(#f1) url(#f2)" fill="red"/> + </g> +</svg> diff --git a/layout/reftests/svg/filters/svg-filter-chains/different-FillPaint-filter-regions-ref.svg b/layout/reftests/svg/filters/svg-filter-chains/different-FillPaint-filter-regions-ref.svg new file mode 100644 index 0000000000..fb405de255 --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/different-FillPaint-filter-regions-ref.svg @@ -0,0 +1,30 @@ +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<svg id="svg-root" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + + <g id="testmeta"> + <title>SVG Filter Chains: Use Same FillPaint Input with Different Filter Regions</title> + <link rel="copyright" + href="http://www.w3.org/Graphics/SVG/Test/Copyright"/> + <link rel="license" + href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license.html"/> + <link rel="author" + title="Max Vujovic" + href="mailto:mvujovic@adobe.com"/> + <link rel="help" + href="http://dev.w3.org/fxtf/filters/#FilterPrimitiveSubRegion"/> + <metadata class="flags">namespace svg</metadata> + </g> + + <g id="test-body-content"> + <filter id="f1"> + <!-- Turn the red square into a green square. --> + <feColorMatrix type="hueRotate" values="90"/> + </filter> + <rect x="0" y="0" width="200" height="200" filter="url(#f1)" fill="red"/> + </g> +</svg> diff --git a/layout/reftests/svg/filters/svg-filter-chains/different-FillPaint-filter-regions.svg b/layout/reftests/svg/filters/svg-filter-chains/different-FillPaint-filter-regions.svg new file mode 100644 index 0000000000..57277b62d6 --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/different-FillPaint-filter-regions.svg @@ -0,0 +1,43 @@ +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<svg id="svg-root" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + + <g id="testmeta"> + <title>SVG Filter Chains: Use Same FillPaint Input with Different Filter Regions</title> + <link rel="copyright" + href="http://www.w3.org/Graphics/SVG/Test/Copyright"/> + <link rel="license" + href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license.html"/> + <link rel="author" + title="Max Vujovic" + href="mailto:mvujovic@adobe.com"/> + <link rel="help" + href="http://dev.w3.org/fxtf/filters/#FilterPrimitiveSubRegion"/> + <link rel="match" + href="different-FillPaint-filter-regions-ref.svg" /> + <metadata class="flags">namespace svg</metadata> + <desc class="assert"> + In an SVG filter chain, this test verifies that a FillPaint input is large + enough to cover the largest filter region in the chain. If the test + passes, you should see a green square. + </desc> + </g> + + <g id="test-body-content"> + <!-- Use a small filter region. --> + <filter id="f1" x="0" y="0" width="100" height="100" filterUnits="userSpaceOnUse"> + <!-- Turn the red square into a blue square. --> + <feColorMatrix in="FillPaint" type="hueRotate" values="180"/> + </filter> + <!-- Use a large filter region. --> + <filter id="f2" x="0" y="0" width="200" height="200" filterUnits="userSpaceOnUse"> + <!-- Turn the red square into a green square. --> + <feColorMatrix in="FillPaint" type="hueRotate" values="90"/> + </filter> + <rect x="0" y="0" width="100" height="100" filter="url(#f1) url(#f2)" fill="red"/> + </g> +</svg> diff --git a/layout/reftests/svg/filters/svg-filter-chains/different-StrokePaint-filter-regions-ref.svg b/layout/reftests/svg/filters/svg-filter-chains/different-StrokePaint-filter-regions-ref.svg new file mode 100644 index 0000000000..ecdff269c0 --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/different-StrokePaint-filter-regions-ref.svg @@ -0,0 +1,30 @@ +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<svg id="svg-root" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + + <g id="testmeta"> + <title>SVG Filter Chains: Use Same StrokePaint Input with Different Filter Regions</title> + <link rel="copyright" + href="http://www.w3.org/Graphics/SVG/Test/Copyright"/> + <link rel="license" + href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license.html"/> + <link rel="author" + title="Max Vujovic" + href="mailto:mvujovic@adobe.com"/> + <link rel="help" + href="http://dev.w3.org/fxtf/filters/#FilterPrimitiveSubRegion"/> + <metadata class="flags">namespace svg</metadata> + </g> + + <g id="test-body-content"> + <filter id="f1"> + <!-- Turn the red square into a green square. --> + <feColorMatrix type="hueRotate" values="90"/> + </filter> + <rect x="0" y="0" width="200" height="200" filter="url(#f1)" fill="red"/> + </g> +</svg> diff --git a/layout/reftests/svg/filters/svg-filter-chains/different-StrokePaint-filter-regions.svg b/layout/reftests/svg/filters/svg-filter-chains/different-StrokePaint-filter-regions.svg new file mode 100644 index 0000000000..2e0d1adb2b --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/different-StrokePaint-filter-regions.svg @@ -0,0 +1,43 @@ +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<svg id="svg-root" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + + <g id="testmeta"> + <title>SVG Filter Chains: Use Same StrokePaint Input with Different Filter Regions</title> + <link rel="copyright" + href="http://www.w3.org/Graphics/SVG/Test/Copyright"/> + <link rel="license" + href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license.html"/> + <link rel="author" + title="Max Vujovic" + href="mailto:mvujovic@adobe.com"/> + <link rel="help" + href="http://dev.w3.org/fxtf/filters/#FilterPrimitiveSubRegion"/> + <link rel="match" + href="different-StrokePaint-filter-regions-ref.svg" /> + <metadata class="flags">namespace svg</metadata> + <desc class="assert"> + In an SVG filter chain, this test verifies that a StrokePaint input is large + enough to cover the largest filter region in the chain. If the test + passes, you should see a green square. + </desc> + </g> + + <g id="test-body-content"> + <!-- Use a small filter region. --> + <filter id="f1" x="0" y="0" width="100" height="100" filterUnits="userSpaceOnUse"> + <!-- Turn the red square into a blue square. --> + <feColorMatrix in="StrokePaint" type="hueRotate" values="180"/> + </filter> + <!-- Use a large filter region. --> + <filter id="f2" x="0" y="0" width="200" height="200" filterUnits="userSpaceOnUse"> + <!-- Turn the red square into a green square. --> + <feColorMatrix in="StrokePaint" type="hueRotate" values="90"/> + </filter> + <rect x="0" y="0" width="100" height="100" filter="url(#f1) url(#f2)" stroke="red"/> + </g> +</svg> diff --git a/layout/reftests/svg/filters/svg-filter-chains/dont-clip-previous-primitives-ref.svg b/layout/reftests/svg/filters/svg-filter-chains/dont-clip-previous-primitives-ref.svg new file mode 100644 index 0000000000..214be69ea2 --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/dont-clip-previous-primitives-ref.svg @@ -0,0 +1,30 @@ +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<svg id="svg-root" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + + <g id="testmeta"> + <title>SVG Filter Chains: Don't Clip Primitives in Previous Filters to Subsequent Filter Regions</title> + <link rel="copyright" + href="http://www.w3.org/Graphics/SVG/Test/Copyright"/> + <link rel="license" + href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license.html"/> + <link rel="author" + title="Max Vujovic" + href="mailto:mvujovic@adobe.com"/> + <link rel="help" + href="http://dev.w3.org/fxtf/filters/#FilterPrimitiveSubRegion"/> + <metadata class="flags">namespace svg</metadata> + </g> + + <g id="test-body-content"> + <filter id="f1" x="0" y="0" width="100" height="100" filterUnits="userSpaceOnUse"> + <!-- Turn the red square into a green square. --> + <feColorMatrix type="hueRotate" values="90"/> + </filter> + <rect x="0" y="0" width="100" height="100" filter="url(#f1)" fill="red"/> + </g> +</svg> diff --git a/layout/reftests/svg/filters/svg-filter-chains/dont-clip-previous-primitives.svg b/layout/reftests/svg/filters/svg-filter-chains/dont-clip-previous-primitives.svg new file mode 100644 index 0000000000..50b2be3a62 --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/dont-clip-previous-primitives.svg @@ -0,0 +1,51 @@ +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<svg id="svg-root" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + + <g id="testmeta"> + <title>SVG Filter Chains: Don't Clip Primitives in Previous Filters to Subsequent Filter Regions</title> + <link rel="copyright" + href="http://www.w3.org/Graphics/SVG/Test/Copyright"/> + <link rel="license" + href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license.html"/> + <link rel="author" + title="Max Vujovic" + href="mailto:mvujovic@adobe.com"/> + <link rel="help" + href="http://dev.w3.org/fxtf/filters/#FilterPrimitiveSubRegion"/> + <link rel="match" + href="dont-clip-previous-primitives.svg" /> + <metadata class="flags">namespace svg</metadata> + <desc class="assert"> + In an SVG filter chain, this test verifies that a second filter's filter + region does not clip the primitives inside a first filter. If the test + passes, you should see a green square. + </desc> + </g> + + <g id="test-body-content"> + <!-- Use a wide filter region. --> + <filter id="f1" x="0" y="0" width="200" height="100" filterUnits="userSpaceOnUse"> + <!-- Create a red square at x=100. --> + <feFlood flood-color="red" x="100" y="0" width="100" height="100"/> + <!-- Offset the red square left to x=0. --> + <feOffset dx="-100" x="0" y="0" width="200" height="100"/> + </filter> + <!-- + Use a less wide filter region. The intermediate results of the previous + filter do not fit in this filter region, but that shouldn't matter. The + previous filter's intermediate results should not be affected by this + filter region. The final result of the previous filter should fit in this + filter region. + --> + <filter id="f2" x="0" y="0" width="100" height="100" filterUnits="userSpaceOnUse"> + <!-- Turn the red square into a green square. --> + <feColorMatrix type="hueRotate" values="90"/> + </filter> + <rect x="0" y="0" width="100" height="100" filter="url(#f1) url(#f2)" fill="blue"/> + </g> +</svg> diff --git a/layout/reftests/svg/filters/svg-filter-chains/intersecting-filter-regions-ref.svg b/layout/reftests/svg/filters/svg-filter-chains/intersecting-filter-regions-ref.svg new file mode 100644 index 0000000000..2f97ca88ad --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/intersecting-filter-regions-ref.svg @@ -0,0 +1,29 @@ +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<svg id="svg-root" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + + <g id="testmeta"> + <title>SVG Filter Chains: Intersecting Filter Regions</title> + <link rel="copyright" + href="http://www.w3.org/Graphics/SVG/Test/Copyright"/> + <link rel="license" + href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license.html"/> + <link rel="author" + title="Max Vujovic" + href="mailto:mvujovic@adobe.com"/> + <link rel="help" + href="http://dev.w3.org/fxtf/filters/#FilterPrimitiveSubRegion"/> + <metadata class="flags">namespace svg</metadata> + </g> + + <g id="test-body-content"> + <filter id="hue-rotate"> + <feColorMatrix type="hueRotate" values="90" style="color-interpolation-filters:sRGB"/> + </filter> + <rect x="100" y="100" width="100" height="100" filter="url(#hue-rotate)" fill="red"/> + </g> +</svg> diff --git a/layout/reftests/svg/filters/svg-filter-chains/intersecting-filter-regions.svg b/layout/reftests/svg/filters/svg-filter-chains/intersecting-filter-regions.svg new file mode 100644 index 0000000000..f9ff60aa2f --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/intersecting-filter-regions.svg @@ -0,0 +1,45 @@ +<svg id="svg-root" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + + <g id="testmeta"> + <title>SVG Filter Chains: Intersecting Filter Regions</title> + <link rel="copyright" + href="http://www.w3.org/Graphics/SVG/Test/Copyright"/> + <link rel="license" + href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license.html"/> + <link rel="author" + title="Max Vujovic" + href="mailto:mvujovic@adobe.com"/> + <link rel="help" + href="http://dev.w3.org/fxtf/filters/#FilterPrimitiveSubRegion"/> + <link rel="match" + href="intersecting-filter-regions-ref.svg" /> + <metadata class="flags">namespace svg</metadata> + <desc class="assert"> + In an SVG filter chain, this test verifies that filters with intersecting + filter regions render properly. If the test passes, you should see a green + square. + </desc> + </g> + + <g id="test-body-content"> + <filter id="flood" x="0" y="0" width="200" height="200" filterUnits="userSpaceOnUse"> + <!-- + This filter clips the SourceGraphic to its top left corner and fills it + with red. + --> + <feFlood flood-color="red"/> + </filter> + <filter id="hue-rotate" x="100" y="100" width="200" height="200" filterUnits="userSpaceOnUse"> + <!-- + This filter clips the output of the previous filter to the bottom right + corner, and it changes red into green. If the previous filter didn't run + or it didn't clip the SourceGraphic, this filter will change the + SourceGraphic's blue fill into red. + --> + <feColorMatrix type="hueRotate" values="90" style="color-interpolation-filters:sRGB"/> + </filter> + <rect x="0" y="0" width="300" height="300" filter="url(#flood) url(#hue-rotate)" fill="blue"/> + </g> +</svg> diff --git a/layout/reftests/svg/filters/svg-filter-chains/long-chain.svg b/layout/reftests/svg/filters/svg-filter-chains/long-chain.svg new file mode 100644 index 0000000000..00f0c9dc62 --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/long-chain.svg @@ -0,0 +1,28 @@ +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<svg xmlns="http://www.w3.org/2000/svg"> + <filter id="flood-with-yellow"> + <!-- Turn the black rect into a yellow rect. --> + <feFlood x="20" y="20" width="100" height="100" flood-color="#ffff00"/> + </filter> + <filter id="extract-red-channel"> + <!-- Turn the yellow rect into a red rect. --> + <feComponentTransfer x="0" y="0" width="120" height="120"> + <feFuncR type="identity"/> + <feFuncG type="table" tableValues="0 0"/> + <feFuncB type="table" tableValues="0 0"/> + <feFuncA type="identity"/> + </feComponentTransfer> + </filter> + <filter id="blur"> + <!-- Blur the red rect. --> + <feGaussianBlur stdDeviation="3" x="10" y="10" width="120" height="120"/> + </filter> + <filter id="hue-rotate"> + <!-- Turn the red rect into a green rect. --> + <feColorMatrix type="hueRotate" values="90"/> + </filter> + <rect x="20" y="20" width="100" height="100" filter="url(#flood-with-yellow) url(#extract-red-channel) url(#blur) url(#hue-rotate)"/> +</svg> diff --git a/layout/reftests/svg/filters/svg-filter-chains/multiple-primitives-per-filter.svg b/layout/reftests/svg/filters/svg-filter-chains/multiple-primitives-per-filter.svg new file mode 100644 index 0000000000..9bdf8fe2c0 --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/multiple-primitives-per-filter.svg @@ -0,0 +1,24 @@ +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<svg xmlns="http://www.w3.org/2000/svg"> + <filter id="flood-with-red"> + <!-- Turn the black rect into a yellow rect. --> + <feFlood x="20" y="20" width="100" height="100" flood-color="#ffff00"/> + <!-- Turn the yellow rect into a red rect. --> + <feComponentTransfer x="0" y="0" width="120" height="120"> + <feFuncR type="identity"/> + <feFuncG type="table" tableValues="0 0"/> + <feFuncB type="table" tableValues="0 0"/> + <feFuncA type="identity"/> + </feComponentTransfer> + </filter> + <filter id="blur-and-hue-rotate"> + <!-- Blur the red rect. --> + <feGaussianBlur stdDeviation="3" x="10" y="10" width="120" height="120"/> + <!-- Turn the red rect into a green rect. --> + <feColorMatrix type="hueRotate" values="90"/> + </filter> + <rect x="20" y="20" width="100" height="100" filter="url(#flood-with-red) url(#blur-and-hue-rotate)"/> +</svg> diff --git a/layout/reftests/svg/filters/svg-filter-chains/reftest.list b/layout/reftests/svg/filters/svg-filter-chains/reftest.list new file mode 100644 index 0000000000..12ddf9d8bb --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/reftest.list @@ -0,0 +1,16 @@ +# These tests verify that SVG filter chains behave properly. +# e.g. filter: url(#f1) url(#f2) url(#f3) + +== clip-input.svg clip-input-ref.svg +== clip-original-SourceGraphic.svg clip-original-SourceGraphic-ref.svg +== clip-output.svg clip-output-ref.svg +fuzzy(0-5,0-20300) fuzzy-if(Android&&device&&!swgl,5-5,21751-21751) == default-subregion.svg default-subregion-ref.svg +== different-FillPaint-filter-regions.svg different-FillPaint-filter-regions-ref.svg +== different-StrokePaint-filter-regions.svg different-StrokePaint-filter-regions-ref.svg +== dont-clip-previous-primitives.svg dont-clip-previous-primitives-ref.svg +== intersecting-filter-regions.svg intersecting-filter-regions-ref.svg +fuzzy-if(!useDrawSnapshot,9-9,5168-5536) fuzzy-if(!useDrawSnapshot&&swgl,7-7,13170-13184) fuzzy-if(Android&&device&&!swgl,8-8,12391-12391) == long-chain.svg simple-chain-ref.svg +fuzzy-if(!useDrawSnapshot,9-9,5168-5536) fuzzy-if(!useDrawSnapshot&&swgl,7-7,13170-13184) fuzzy-if(Android&&device&&!swgl,8-8,12391-12391) == multiple-primitives-per-filter.svg simple-chain-ref.svg +fuzzy-if(/^Windows\x20NT\x2010\.0/.test(http.oscpu),0-1,0-173) fuzzy-if(!useDrawSnapshot||(winWidget&&isCoverageBuild),9-9,5128-5496) fuzzy-if(!useDrawSnapshot&&swgl,7-7,12820-12830) fuzzy-if(Android&&device&&!swgl,8-8,12355-12355) == second-filter-uses-SourceAlpha.svg second-filter-uses-SourceAlpha-ref.svg +fuzzy-if(!useDrawSnapshot,9-9,5168-5536) fuzzy-if(!useDrawSnapshot&&swgl,7-7,13170-13180) fuzzy-if(Android&&device&&!swgl,8-8,12391-12391) == second-filter-uses-SourceGraphic.svg simple-chain-ref.svg +== simple-chain.svg simple-chain-ref.svg diff --git a/layout/reftests/svg/filters/svg-filter-chains/second-filter-uses-SourceAlpha-ref.svg b/layout/reftests/svg/filters/svg-filter-chains/second-filter-uses-SourceAlpha-ref.svg new file mode 100644 index 0000000000..e809e55bb3 --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/second-filter-uses-SourceAlpha-ref.svg @@ -0,0 +1,29 @@ +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<svg id="svg-root" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + + <g id="testmeta"> + <title>SVG Filter Chains: Second Filter Uses SourceAlpha</title> + <link rel="copyright" + href="http://www.w3.org/Graphics/SVG/Test/Copyright"/> + <link rel="license" + href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license.html"/> + <link rel="author" + title="Max Vujovic" + href="mailto:mvujovic@adobe.com"/> + <link rel="help" + href="http://dev.w3.org/fxtf/filters/#FilterPrimitiveSubRegion"/> + <metadata class="flags">namespace svg</metadata> + </g> + + <g id="test-body-content"> + <filter id="blur"> + <feGaussianBlur stdDeviation="3"/> + </filter> + <rect x="100" y="100" width="100" height="100" filter="url(#blur)" fill="#00ff00"/> + </g> +</svg> diff --git a/layout/reftests/svg/filters/svg-filter-chains/second-filter-uses-SourceAlpha.svg b/layout/reftests/svg/filters/svg-filter-chains/second-filter-uses-SourceAlpha.svg new file mode 100644 index 0000000000..474c9da14c --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/second-filter-uses-SourceAlpha.svg @@ -0,0 +1,49 @@ +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<svg id="svg-root" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink"> + + <g id="testmeta"> + <title>SVG Filter Chains: Second Filter Uses SourceAlpha</title> + <link rel="copyright" + href="http://www.w3.org/Graphics/SVG/Test/Copyright"/> + <link rel="license" + href="http://www.w3.org/Consortium/Legal/2008/03-bsd-license.html"/> + <link rel="author" + title="Max Vujovic" + href="mailto:mvujovic@adobe.com"/> + <link rel="help" + href="http://dev.w3.org/fxtf/filters/#FilterPrimitiveSubRegion"/> + <link rel="match" + href="second-filter-uses-SourceAlpha.svg" /> + <metadata class="flags">namespace svg</metadata> + <desc class="assert"> + In an SVG filter chain, this test verifies that a filter receives the + correct SourceAlpha input from the previous filter in the chain. If the + test passes, you should see a blurred green square. + </desc> + </g> + + <g id="test-body-content"> + <filter id="blur"> + <feGaussianBlur stdDeviation="3"/> + </filter> + <filter id="add-green"> + <!-- + This filter receives transparent black and the alpha channel of the + previous blur filter. Then, it adds to the green channel where the alpha + channel is set, resulting in a blurred green square. + --> + <feComponentTransfer in="SourceAlpha"> + <feFuncR type="identity"/> + <feFuncG type="table" tableValues="1 1"/> + <feFuncB type="identity"/> + <feFuncA type="identity"/> + </feComponentTransfer> + </filter> + <rect x="100" y="100" width="100" height="100" filter="url(#blur) url(#add-green)" fill="red"/> + </g> +</svg> diff --git a/layout/reftests/svg/filters/svg-filter-chains/second-filter-uses-SourceGraphic.svg b/layout/reftests/svg/filters/svg-filter-chains/second-filter-uses-SourceGraphic.svg new file mode 100644 index 0000000000..f8dc040b83 --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/second-filter-uses-SourceGraphic.svg @@ -0,0 +1,17 @@ +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<svg xmlns="http://www.w3.org/2000/svg"> + <filter id="blur"> + <!-- Blur the red rect. --> + <feGaussianBlur stdDeviation="3"/> + </filter> + <filter id="hue-rotate"> + <feFlood flood-color="#0000ff"/> + <!-- Turn the red rect into a green rect. feColorMatrix should use the + result of the #blur filter, not feFlood, as its SourceGraphic. --> + <feColorMatrix in="SourceGraphic" type="hueRotate" values="90"/> + </filter> + <rect x="20" y="20" width="100" height="100" fill="#ff0000" filter="url(#blur) url(#hue-rotate)"/> +</svg> diff --git a/layout/reftests/svg/filters/svg-filter-chains/simple-chain-ref.svg b/layout/reftests/svg/filters/svg-filter-chains/simple-chain-ref.svg new file mode 100644 index 0000000000..4194849054 --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/simple-chain-ref.svg @@ -0,0 +1,14 @@ +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<svg xmlns="http://www.w3.org/2000/svg"> + <!-- Test multiple SVG filters chained together against a single SVG filter. --> + <filter id="blur-and-hue-rotate"> + <!-- Blur the red rect. --> + <feGaussianBlur stdDeviation="3"/> + <!-- Turn the red rect into a green rect. --> + <feColorMatrix type="hueRotate" values="90"/> + </filter> + <rect x="20" y="20" width="100" height="100" fill="#ff0000" filter="url(#blur-and-hue-rotate)"/> +</svg> diff --git a/layout/reftests/svg/filters/svg-filter-chains/simple-chain.svg b/layout/reftests/svg/filters/svg-filter-chains/simple-chain.svg new file mode 100644 index 0000000000..e391bf8e03 --- /dev/null +++ b/layout/reftests/svg/filters/svg-filter-chains/simple-chain.svg @@ -0,0 +1,15 @@ +<!-- + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +--> +<svg xmlns="http://www.w3.org/2000/svg"> + <filter id="blur"> + <!-- Blur the red rect. --> + <feGaussianBlur stdDeviation="3"/> + </filter> + <filter id="hue-rotate"> + <!-- Turn the red rect into a green rect. --> + <feColorMatrix type="hueRotate" values="90"/> + </filter> + <rect x="20" y="20" width="100" height="100" fill="#ff0000" filter="url(#blur) url(#hue-rotate)"/> +</svg> |