Bug 948265 - Remove deprecated filterRes attribute from SVG filters. r=roc, r=hsivonen
@ -1275,6 +1275,8 @@ GK_ATOM(fill, "fill")
|
||||
GK_ATOM(fill_opacity, "fill-opacity")
|
||||
GK_ATOM(fill_rule, "fill-rule")
|
||||
GK_ATOM(filter, "filter")
|
||||
// Parsing for filterRes may be removed in the future.
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=979472
|
||||
GK_ATOM(filterRes, "filterRes")
|
||||
GK_ATOM(filterUnits, "filterUnits")
|
||||
GK_ATOM(flood_color, "flood-color")
|
||||
|
@ -30,11 +30,6 @@ nsSVGElement::LengthInfo SVGFilterElement::sLengthInfo[4] =
|
||||
{ &nsGkAtoms::height, 120, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
|
||||
};
|
||||
|
||||
nsSVGElement::IntegerPairInfo SVGFilterElement::sIntegerPairInfo[1] =
|
||||
{
|
||||
{ &nsGkAtoms::filterRes, 0 }
|
||||
};
|
||||
|
||||
nsSVGElement::EnumInfo SVGFilterElement::sEnumInfo[2] =
|
||||
{
|
||||
{ &nsGkAtoms::filterUnits,
|
||||
@ -105,26 +100,6 @@ SVGFilterElement::PrimitiveUnits()
|
||||
return mEnumAttributes[PRIMITIVEUNITS].ToDOMAnimatedEnum(this);
|
||||
}
|
||||
|
||||
already_AddRefed<SVGAnimatedInteger>
|
||||
SVGFilterElement::FilterResX()
|
||||
{
|
||||
return mIntegerPairAttributes[FILTERRES].ToDOMAnimatedInteger(nsSVGIntegerPair::eFirst,
|
||||
this);
|
||||
}
|
||||
|
||||
already_AddRefed<SVGAnimatedInteger>
|
||||
SVGFilterElement::FilterResY()
|
||||
{
|
||||
return mIntegerPairAttributes[FILTERRES].ToDOMAnimatedInteger(nsSVGIntegerPair::eSecond,
|
||||
this);
|
||||
}
|
||||
|
||||
void
|
||||
SVGFilterElement::SetFilterRes(uint32_t filterResX, uint32_t filterResY)
|
||||
{
|
||||
mIntegerPairAttributes[FILTERRES].SetBaseValues(filterResX, filterResY, this);
|
||||
}
|
||||
|
||||
already_AddRefed<SVGAnimatedString>
|
||||
SVGFilterElement::Href()
|
||||
{
|
||||
@ -186,13 +161,6 @@ SVGFilterElement::GetLengthInfo()
|
||||
ArrayLength(sLengthInfo));
|
||||
}
|
||||
|
||||
nsSVGElement::IntegerPairAttributesInfo
|
||||
SVGFilterElement::GetIntegerPairInfo()
|
||||
{
|
||||
return IntegerPairAttributesInfo(mIntegerPairAttributes, sIntegerPairInfo,
|
||||
ArrayLength(sIntegerPairInfo));
|
||||
}
|
||||
|
||||
nsSVGElement::EnumAttributesInfo
|
||||
SVGFilterElement::GetEnumInfo()
|
||||
{
|
||||
|
@ -54,15 +54,11 @@ public:
|
||||
already_AddRefed<SVGAnimatedLength> Height();
|
||||
already_AddRefed<SVGAnimatedEnumeration> FilterUnits();
|
||||
already_AddRefed<SVGAnimatedEnumeration> PrimitiveUnits();
|
||||
already_AddRefed<SVGAnimatedInteger> FilterResX();
|
||||
already_AddRefed<SVGAnimatedInteger> FilterResY();
|
||||
void SetFilterRes(uint32_t filterResX, uint32_t filterResY);
|
||||
already_AddRefed<SVGAnimatedString> Href();
|
||||
|
||||
protected:
|
||||
|
||||
virtual LengthAttributesInfo GetLengthInfo() MOZ_OVERRIDE;
|
||||
virtual IntegerPairAttributesInfo GetIntegerPairInfo() MOZ_OVERRIDE;
|
||||
virtual EnumAttributesInfo GetEnumInfo() MOZ_OVERRIDE;
|
||||
virtual StringAttributesInfo GetStringInfo() MOZ_OVERRIDE;
|
||||
|
||||
@ -70,10 +66,6 @@ protected:
|
||||
nsSVGLength2 mLengthAttributes[4];
|
||||
static LengthInfo sLengthInfo[4];
|
||||
|
||||
enum { FILTERRES };
|
||||
nsSVGIntegerPair mIntegerPairAttributes[1];
|
||||
static IntegerPairInfo sIntegerPairInfo[1];
|
||||
|
||||
enum { FILTERUNITS, PRIMITIVEUNITS };
|
||||
nsSVGEnum mEnumAttributes[2];
|
||||
static EnumInfo sEnumInfo[2];
|
||||
|
@ -1,12 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="750">
|
||||
<defs>
|
||||
<!-- <integer-optional-integer> (filterRes) -->
|
||||
<filter id="filter">
|
||||
<!-- <boolean> (preserveAlpha) -->
|
||||
<!-- <enum> (edgeMode) -->
|
||||
<!-- <number> (divisor) -->
|
||||
<!-- <integer> (targetX) -->
|
||||
<!-- <integer-optional-integer> (order) -->
|
||||
<!-- <string> (result) -->
|
||||
<feConvolveMatrix id="convolve"/>
|
||||
<!-- <number-optional-number> (stdDeviation) -->
|
||||
|
Before Width: | Height: | Size: 646 B After Width: | Height: | Size: 644 B |
@ -124,52 +124,52 @@ function runTests()
|
||||
|
||||
// integer-optional-integer attribute
|
||||
|
||||
filter.setAttribute("filterRes", "100");
|
||||
is(filter.filterResX.baseVal, 100, "integer-optional-integer first baseVal");
|
||||
is(filter.filterResX.animVal, 100, "integer-optional-integer first animVal");
|
||||
is(filter.filterResY.baseVal, 100, "integer-optional-integer second baseVal");
|
||||
is(filter.filterResY.animVal, 100, "integer-optional-integer second animVal");
|
||||
convolve.setAttribute("order", "5");
|
||||
is(convolve.orderX.baseVal, 5, "integer-optional-integer first baseVal");
|
||||
is(convolve.orderX.animVal, 5, "integer-optional-integer first animVal");
|
||||
is(convolve.orderY.baseVal, 5, "integer-optional-integer second baseVal");
|
||||
is(convolve.orderY.animVal, 5, "integer-optional-integer second animVal");
|
||||
|
||||
filter.filterResX.baseVal = 50;
|
||||
is(filter.filterResX.animVal, 50, "integer-optional-integer first animVal");
|
||||
is(filter.filterResY.animVal, 100, "integer-optional-integer second animVal");
|
||||
is(filter.getAttribute("filterRes"), "50, 100", "integer-optional-integer attribute");
|
||||
convolve.orderX.baseVal = 7;
|
||||
is(convolve.orderX.animVal, 7, "integer-optional-integer first animVal");
|
||||
is(convolve.orderY.animVal, 5, "integer-optional-integer second animVal");
|
||||
is(convolve.getAttribute("order"), "7, 5", "integer-optional-integer attribute");
|
||||
|
||||
filter.filterResY.baseVal = 50;
|
||||
is(filter.getAttribute("filterRes"), "50", "integer-optional-integer attribute");
|
||||
convolve.orderY.baseVal = 7;
|
||||
is(convolve.getAttribute("order"), "7", "integer-optional-integer attribute");
|
||||
|
||||
filter.setFilterRes(80, 90);
|
||||
is(filter.filterResX.baseVal, 80, "integer-optional-integer first baseVal");
|
||||
is(filter.filterResX.animVal, 80, "integer-optional-integer first animVal");
|
||||
is(filter.filterResY.baseVal, 90, "integer-optional-integer second baseVal");
|
||||
is(filter.filterResY.animVal, 90, "integer-optional-integer second animVal");
|
||||
convolve.setAttribute("order", "11, 13");
|
||||
is(convolve.orderX.baseVal, 11, "integer-optional-integer first baseVal");
|
||||
is(convolve.orderX.animVal, 11, "integer-optional-integer first animVal");
|
||||
is(convolve.orderY.baseVal, 13, "integer-optional-integer second baseVal");
|
||||
is(convolve.orderY.animVal, 13, "integer-optional-integer second animVal");
|
||||
|
||||
// 32 bit integer range
|
||||
filter.setFilterRes(-2147483648, 2147483647);
|
||||
is(filter.filterResX.baseVal, -2147483648, "integer-optional-integer first baseVal");
|
||||
is(filter.filterResX.animVal, -2147483648, "integer-optional-integer first animVal");
|
||||
is(filter.filterResY.baseVal, 2147483647, "integer-optional-integer second baseVal");
|
||||
is(filter.filterResY.animVal, 2147483647, "integer-optional-integer second animVal");
|
||||
convolve.setAttribute("order", "-2147483648, 2147483647");
|
||||
is(convolve.orderX.baseVal, -2147483648, "integer-optional-integer first baseVal");
|
||||
is(convolve.orderX.animVal, -2147483648, "integer-optional-integer first animVal");
|
||||
is(convolve.orderY.baseVal, 2147483647, "integer-optional-integer second baseVal");
|
||||
is(convolve.orderY.animVal, 2147483647, "integer-optional-integer second animVal");
|
||||
|
||||
// too big, clamp
|
||||
filter.setAttribute("filterRes", "-2147483649, 2147483648");
|
||||
is(filter.filterResX.baseVal, -2147483648, "integer-optional-integer first baseVal");
|
||||
is(filter.filterResX.animVal, -2147483648, "integer-optional-integer first animVal");
|
||||
is(filter.filterResY.baseVal, 2147483647, "integer-optional-integer second baseVal");
|
||||
is(filter.filterResY.animVal, 2147483647, "integer-optional-integer second animVal");
|
||||
convolve.setAttribute("order", "-2147483649, 2147483648");
|
||||
is(convolve.orderX.baseVal, -2147483648, "integer-optional-integer first baseVal");
|
||||
is(convolve.orderX.animVal, -2147483648, "integer-optional-integer first animVal");
|
||||
is(convolve.orderY.baseVal, 2147483647, "integer-optional-integer second baseVal");
|
||||
is(convolve.orderY.animVal, 2147483647, "integer-optional-integer second animVal");
|
||||
|
||||
// invalid
|
||||
filter.setAttribute("filterRes", "-00000000000invalid, 214748364720invalid");
|
||||
is(filter.filterResX.baseVal, 0, "integer-optional-integer first baseVal");
|
||||
is(filter.filterResX.animVal, 0, "integer-optional-integer first animVal");
|
||||
is(filter.filterResY.baseVal, 0, "integer-optional-integer second baseVal");
|
||||
is(filter.filterResY.animVal, 0, "integer-optional-integer second animVal");
|
||||
convolve.setAttribute("order", "-00000000000invalid, 214748364720invalid");
|
||||
is(convolve.orderX.baseVal, 3, "integer-optional-integer first baseVal");
|
||||
is(convolve.orderX.animVal, 3, "integer-optional-integer first animVal");
|
||||
is(convolve.orderY.baseVal, 3, "integer-optional-integer second baseVal");
|
||||
is(convolve.orderY.animVal, 3, "integer-optional-integer second animVal");
|
||||
|
||||
filter.setAttribute("filterRes", "");
|
||||
ok(filter.getAttribute("filterRes") === "",
|
||||
convolve.setAttribute("order", "");
|
||||
ok(convolve.getAttribute("order") === "",
|
||||
"empty integer-optional-integer attribute");
|
||||
filter.removeAttribute("filterRes");
|
||||
ok(filter.getAttribute("filterRes") === null,
|
||||
convolve.removeAttribute("order");
|
||||
ok(convolve.getAttribute("order") === null,
|
||||
"removed integer-optional-integer attribute");
|
||||
|
||||
// angle attribute
|
||||
|
@ -129,18 +129,18 @@ function runTests()
|
||||
|
||||
// integer-optional-integer attribute
|
||||
|
||||
eventChecker.watchAttr(filter, "filterRes");
|
||||
eventChecker.watchAttr(convolve, "order");
|
||||
eventChecker.expect("add modify remove add");
|
||||
filter.setAttribute("filterRes", "60, 70");
|
||||
filter.filterResX.baseVal = 50;
|
||||
filter.removeAttribute("filterRes");
|
||||
filter.removeAttributeNS(null, "filterRes");
|
||||
filter.setAttribute("filterRes", "50, 60");
|
||||
convolve.setAttribute("order", "5, 7");
|
||||
convolve.orderX.baseVal = 9;
|
||||
convolve.removeAttribute("order");
|
||||
convolve.removeAttributeNS(null, "order");
|
||||
convolve.setAttribute("order", "9, 5");
|
||||
|
||||
eventChecker.expect("");
|
||||
filter.filterResX.baseVal = 50;
|
||||
filter.setAttribute("filterRes", "50, 60");
|
||||
filter.filterResY.baseVal = 60;
|
||||
convolve.orderX.baseVal = 9;
|
||||
convolve.setAttribute("order", "9, 5");
|
||||
convolve.orderY.baseVal = 5;
|
||||
|
||||
// angle attribute
|
||||
|
||||
|
@ -17,10 +17,7 @@ interface SVGFilterElement : SVGElement {
|
||||
readonly attribute SVGAnimatedLength y;
|
||||
readonly attribute SVGAnimatedLength width;
|
||||
readonly attribute SVGAnimatedLength height;
|
||||
readonly attribute SVGAnimatedInteger filterResX;
|
||||
readonly attribute SVGAnimatedInteger filterResY;
|
||||
|
||||
void setFilterRes(unsigned long filterResX, unsigned long filterResY);
|
||||
// ImageData apply(ImageData source);
|
||||
};
|
||||
|
||||
|
@ -5,10 +5,10 @@
|
||||
<svg xmlns='http://www.w3.org/2000/svg' width='100px' height='100px'>
|
||||
<!--
|
||||
A basic test for the <feDiffuseLighting> filter primitive.
|
||||
Setting filterRes on the <filter> and kernelUnitLength on the
|
||||
<feDiffuseLighting> should allow us to assume pixel perfection.
|
||||
Setting kernelUnitLength on the <feDiffuseLighting> should allow us to
|
||||
assume pixel perfection.
|
||||
-->
|
||||
<filter id='f' x='0' y='0' width='1' height='1' filterRes='100 100'>
|
||||
<filter id='f' x='0' y='0' width='1' height='1'>
|
||||
<feDiffuseLighting kernelUnitLength='1'>
|
||||
<feDistantLight/>
|
||||
</feDiffuseLighting>
|
||||
|
Before Width: | Height: | Size: 660 B After Width: | Height: | Size: 610 B |
@ -5,7 +5,7 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<title>Test that directionless filter primitive attributes are resolved to user units correctly</title>
|
||||
<!-- https://bugzilla.mozilla.org/show_bug.cgi?id=619967 -->
|
||||
<filter id="f" filterUnits="userSpaceOnUse" x="0" y="0" width="400" height="200" filterRes="400 100" color-interpolation-filters="sRGB">
|
||||
<filter id="f" filterUnits="userSpaceOnUse" x="0" y="0" width="400" height="200" color-interpolation-filters="sRGB">
|
||||
<feFlood flood-color="#800" result="map"/>
|
||||
<feDisplacementMap in="SourceGraphic" in2="map" xChannelSelector="R" yChannelSelector="G" scale="100"/>
|
||||
</filter>
|
||||
|
Before Width: | Height: | Size: 805 B After Width: | Height: | Size: 785 B |
@ -1,19 +0,0 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<title>Reference for feDistantLight with filterRes larger than filter region</title>
|
||||
|
||||
<!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=610466 -->
|
||||
<defs>
|
||||
<filter id="f" x="0" y="0" width="0.5" height="0.5" filterRes="50 50">
|
||||
<feDiffuseLighting kernelUnitLength="1" lighting-color="lime">
|
||||
<feDistantLight elevation="100"/>
|
||||
</feDiffuseLighting>
|
||||
</filter>
|
||||
</defs>
|
||||
<svg clip="rect(1px 48px 48px 1px)">
|
||||
<path d="M0,0 h100 v100 h-100 z" filter="url(#f)"/>
|
||||
</svg>
|
||||
</svg>
|
Before Width: | Height: | Size: 672 B |
@ -1,19 +0,0 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<title>Testcase for feDistantLight with filterRes larger than filter region</title>
|
||||
|
||||
<!-- From https://bugzilla.mozilla.org/show_bug.cgi?id=610466 -->
|
||||
<defs>
|
||||
<filter id="f" x="0" y="0" width="0.5" height="0.5" filterRes="60 60">
|
||||
<feDiffuseLighting kernelUnitLength="1" lighting-color="lime">
|
||||
<feDistantLight elevation="100"/>
|
||||
</feDiffuseLighting>
|
||||
</filter>
|
||||
</defs>
|
||||
<svg clip="rect(1px 48px 48px 1px)">
|
||||
<path d="M0,0 h100 v100 h-100 z" filter="url(#f)"/>
|
||||
</svg>
|
||||
</svg>
|
Before Width: | Height: | Size: 671 B |
@ -5,10 +5,10 @@
|
||||
<svg xmlns='http://www.w3.org/2000/svg'>
|
||||
<!--
|
||||
A basic test for the <feSpecularLighting> filter primitive.
|
||||
Setting filterRes on the <filter> and kernelUnitLength on the
|
||||
<feSpecularLighting> should allow us to assume pixel perfection.
|
||||
Setting kernelUnitLength on the <feSpecularLighting> should allow us to
|
||||
assume pixel perfection.
|
||||
-->
|
||||
<filter id='f' x='0' y='0' width='1' height='1' filterRes='100 100' color-interpolation-filters='sRGB'>
|
||||
<filter id='f' x='0' y='0' width='1' height='1' color-interpolation-filters='sRGB'>
|
||||
<feSpecularLighting kernelUnitLength='1' result='a'>
|
||||
<feDistantLight azimuth='45'/>
|
||||
</feSpecularLighting>
|
||||
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
@ -1,20 +0,0 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.0">
|
||||
<desc>
|
||||
This test checks that the implicit offscreen surface scaling implied by
|
||||
a high 'filterRes' interacts correctly with other transforms. Specifically
|
||||
you should see no red if the red filtered circle paints only on the pixels
|
||||
that it should paint on.
|
||||
</desc>
|
||||
<filter id="filter" x="0" y="0" width="1" height="1" filterRes="1000 1000">
|
||||
<feGaussianBlur stdDeviation="0.001"/>
|
||||
</filter>
|
||||
<rect width="100%" height="100%" fill="lime"/>
|
||||
<g transform="translate(50, 0)">
|
||||
<circle fill="red" cx="100" cy="100" r="98" transform="translate(50, 0)" filter="url(#filter)"/>
|
||||
</g>
|
||||
<circle fill="lime" cx="200" cy="100" r="100"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 837 B |
@ -1,20 +0,0 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.0">
|
||||
<desc>
|
||||
This test checks that the implicit offscreen surface scaling implied by
|
||||
a high 'filterRes' interacts correctly with other transforms. Specifically
|
||||
you should see no red if the lime filtered circle paints on all the pixels
|
||||
that it should paint on.
|
||||
</desc>
|
||||
<filter id="filter" x="0" y="0" width="1" height="1" filterRes="1000 1000">
|
||||
<feGaussianBlur stdDeviation="0.001"/>
|
||||
</filter>
|
||||
<rect width="100%" height="100%" fill="lime"/>
|
||||
<circle fill="red" cx="200" cy="100" r="98"/>
|
||||
<g transform="translate(50, 0)">
|
||||
<circle fill="lime" cx="100" cy="100" r="100" transform="translate(50, 0)" filter="url(#filter)"/>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 837 B |
@ -1,22 +0,0 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.0">
|
||||
<desc>
|
||||
This test checks that the implicit offscreen surface scaling implied by
|
||||
a high 'filterRes' interacts correctly with other transforms. Specifically
|
||||
you should see only green if the red filtered circle paints only on
|
||||
the pixels that it should paint on.
|
||||
</desc>
|
||||
<filter id="filter" x="0" y="0" width="1" height="1" filterRes="50 50">
|
||||
<feGaussianBlur stdDeviation="0.001"/>
|
||||
</filter>
|
||||
<rect width="100%" height="100%" fill="lime"/>
|
||||
<g transform="translate(50, 0)">
|
||||
<!-- The filterRes is quartered, so we need r to be 5 pixels less, plus
|
||||
one less for antialiasing, otherwise the circle will get fringe effects. -->
|
||||
<circle fill="red" cx="100" cy="100" r="94" transform="translate(50, 0)" filter="url(#filter)"/>
|
||||
</g>
|
||||
<circle fill="lime" cx="200" cy="100" r="100"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 999 B |
@ -51,9 +51,6 @@ fuzzy(1,6400) == feGaussianBlur-1.svg feGaussianBlur-1-ref.svg
|
||||
# no tests for feTurbulence
|
||||
|
||||
== filter-clipped-rect-01.svg pass.svg
|
||||
== filter-filterRes-high-01.svg pass.svg
|
||||
== filter-filterRes-high-02.svg pass.svg
|
||||
random-if(d2d) == filter-filterRes-low-01.svg pass.svg
|
||||
== filter-inner-svg-01.svg pass.svg
|
||||
== filter-inner-svg-02.svg pass.svg
|
||||
== filter-inner-svg-03.svg pass.svg
|
||||
@ -85,8 +82,6 @@ fuzzy(1,10000) == feConvolveMatrix-bias-01.svg feConvolveMatrix-bias-01-ref.svg
|
||||
fuzzy(2,500) == feDisplacementMap-colour-01.svg feDisplacementMap-colour-01-ref.svg
|
||||
skip-if(B2G) == feDisplacementMap-scale-01.svg pass.svg
|
||||
|
||||
skip-if(B2G) fuzzy-if(cocoaWidget,4,184) == feDistantLight-filterRes-01.svg feDistantLight-filterRes-01-ref.svg
|
||||
|
||||
== feDropShadow-01.svg feDropShadow-01-ref.svg
|
||||
|
||||
== feGaussianBlur-alpha-01.svg feGaussianBlur-alpha-01-ref.svg
|
||||
|
@ -0,0 +1,20 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
class="reftest-wait"
|
||||
onload="setTimeAndSnapshot(2, true)">
|
||||
<title>Testcase for animation of the "order" attribute of the "feConvolveMatrix" element</title>
|
||||
<script xlink:href="smil-util.js" type="text/javascript"/>
|
||||
<defs>
|
||||
<filter id="f">
|
||||
<feConvolveMatrix order="3" kernelMatrix="1 1 1 1 1 1 1 1 1" edgeMode="none"></feConvolveMatrix>
|
||||
</filter>
|
||||
</defs>
|
||||
<g filter="url(#f)">
|
||||
<rect x="10" y="10" width="50" height="100" fill="orange"/>
|
||||
<rect x="60" y="10" width="50" height="100" fill="blue"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 754 B |
53
layout/reftests/svg/smil/anim-feConvolveMatrix-order-01.svg
Normal file
@ -0,0 +1,53 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
class="reftest-wait"
|
||||
onload="setTimeAndSnapshot(2, true)">
|
||||
<title>Testcase for animation of the "order" attribute of the "feConvolveMatrix" element</title>
|
||||
<script xlink:href="smil-util.js" type="text/javascript"/>
|
||||
<defs>
|
||||
<filter id="f">
|
||||
<feConvolveMatrix order="1" kernelMatrix="1" edgeMode="none">
|
||||
<!-- Animate the kernel matrix dimensions from 1x1 to 5x5. -->
|
||||
<animate attributeName="order"
|
||||
calcMode="linear"
|
||||
begin="0s" dur="4s"
|
||||
from="1" to="5 5"
|
||||
fill="freeze"/>
|
||||
<!--
|
||||
Animate the kernel matrix values.
|
||||
Each successive matrix blurs the image more.
|
||||
We will pause on the 3x3 matrix.
|
||||
-->
|
||||
<animate attributeName="kernelMatrix"
|
||||
calcMode="linear"
|
||||
begin="0s" dur="1s"
|
||||
from="1" to="1 1 1 1"
|
||||
fill="freeze"/>
|
||||
<animate attributeName="kernelMatrix"
|
||||
calcMode="linear"
|
||||
begin="1s" dur="1s"
|
||||
from="1 1 1 1" to="1 1 1 1 1 1 1 1 1"
|
||||
fill="freeze"/>
|
||||
<animate attributeName="kernelMatrix"
|
||||
calcMode="linear"
|
||||
begin="2s" dur="1s"
|
||||
from="1 1 1 1 1 1 1 1 1" to="1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"
|
||||
fill="freeze"/>
|
||||
<animate attributeName="kernelMatrix"
|
||||
calcMode="linear"
|
||||
begin="3s" dur="1s"
|
||||
from="1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1" to="1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"
|
||||
fill="freeze"/>
|
||||
</feConvolveMatrix>
|
||||
</filter>
|
||||
</defs>
|
||||
<g filter="url(#f)">
|
||||
<!-- The edge between the orange rect and the blue rect will become blurry. -->
|
||||
<rect x="10" y="10" width="50" height="100" fill="orange"/>
|
||||
<rect x="60" y="10" width="50" height="100" fill="blue"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
@ -8,7 +8,7 @@
|
||||
onload="setTimeAndSnapshot(1.9999, true)">
|
||||
<title>Test animation of the "stdDeviation" <number-optional-number> attribute on "feGaussianBlur" elements</title>
|
||||
<script xlink:href="smil-util.js" type="text/javascript"/>
|
||||
<filter id="filter" x="0" y="0" width="1" height="1" filterRes="1000">
|
||||
<filter id="filter" x="0" y="0" width="1" height="1">
|
||||
<feGaussianBlur stdDeviation="50">
|
||||
<animate attributeName="stdDeviation"
|
||||
calcMode="linear"
|
||||
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1023 B |
@ -1,24 +0,0 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<svg xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
class="reftest-wait"
|
||||
onload="setTimeAndSnapshot(101, true)">
|
||||
<title>Test animation of the "filterRes" <integer-optional-integer> attribute on "filter" elements</title>
|
||||
<script xlink:href="smil-util.js" type="text/javascript"/>
|
||||
<filter id="filter" x="0" y="0" width="1" height="1" filterRes="10 10">
|
||||
<animate attributeName="filterRes"
|
||||
calcMode="linear"
|
||||
begin="100s" dur="2s"
|
||||
from="0" to="2000 2000"
|
||||
fill="freeze"/>
|
||||
<feGaussianBlur stdDeviation="0.001"/>
|
||||
</filter>
|
||||
<rect width="100%" height="100%" fill="lime"/>
|
||||
<g transform="translate(50, 0)">
|
||||
<circle fill="red" cx="100" cy="100" r="98" transform="translate(50, 0)" filter="url(#filter)"/>
|
||||
</g>
|
||||
<circle fill="lime" cx="200" cy="100" r="100"/>
|
||||
</svg>
|
Before Width: | Height: | Size: 1002 B |
@ -116,7 +116,7 @@ fails == anim-fillcolor-1.svg anim-standard-ref.svg # bug 436296
|
||||
== anim-feTurbulence-numOctaves-01.svg anim-feTurbulence-numOctaves-01-ref.svg
|
||||
|
||||
# animate some <integer-optional-integer> attributes:
|
||||
random-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) == anim-filter-filterRes-01.svg lime.svg # bug 818177
|
||||
== anim-feConvolveMatrix-order-01.svg anim-feConvolveMatrix-order-01-ref.svg
|
||||
|
||||
# animate some <angle> attributes:
|
||||
== anim-marker-orient-01.svg lime.svg
|
||||
|
@ -1,6 +1,6 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
|
||||
<filter id="f" height="-1" filterRes="1"/>
|
||||
<filter id="f" height="-1"/>
|
||||
|
||||
<rect filter="url(#f)" />
|
||||
|
||||
|
Before Width: | Height: | Size: 124 B After Width: | Height: | Size: 110 B |
@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg"><filter id="f1" filterRes="10 20" height="-2"/><rect width="50" height="100" filter="url(#f1)"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg"><filter id="f1" height="-2"/><rect width="50" height="100" filter="url(#f1)"/></svg>
|
||||
|
Before Width: | Height: | Size: 143 B After Width: | Height: | Size: 125 B |
@ -67,22 +67,6 @@ nsSVGFilterFrame::GetEnumValue(uint32_t aIndex, nsIContent *aDefault)
|
||||
mEnumAttributes[aIndex].GetAnimValue();
|
||||
}
|
||||
|
||||
const nsSVGIntegerPair *
|
||||
nsSVGFilterFrame::GetIntegerPairValue(uint32_t aIndex, nsIContent *aDefault)
|
||||
{
|
||||
const nsSVGIntegerPair *thisIntegerPair =
|
||||
&static_cast<SVGFilterElement *>(mContent)->mIntegerPairAttributes[aIndex];
|
||||
|
||||
if (thisIntegerPair->IsExplicitlySet())
|
||||
return thisIntegerPair;
|
||||
|
||||
AutoFilterReferencer filterRef(this);
|
||||
|
||||
nsSVGFilterFrame *next = GetReferencedFilterIfNotInUse();
|
||||
return next ? next->GetIntegerPairValue(aIndex, aDefault) :
|
||||
&static_cast<SVGFilterElement *>(aDefault)->mIntegerPairAttributes[aIndex];
|
||||
}
|
||||
|
||||
const nsSVGLength2 *
|
||||
nsSVGFilterFrame::GetLengthValue(uint32_t aIndex, nsIContent *aDefault)
|
||||
{
|
||||
@ -187,7 +171,6 @@ nsSVGFilterFrame::AttributeChanged(int32_t aNameSpaceID,
|
||||
aAttribute == nsGkAtoms::y ||
|
||||
aAttribute == nsGkAtoms::width ||
|
||||
aAttribute == nsGkAtoms::height ||
|
||||
aAttribute == nsGkAtoms::filterRes ||
|
||||
aAttribute == nsGkAtoms::filterUnits ||
|
||||
aAttribute == nsGkAtoms::primitiveUnits)) {
|
||||
nsSVGEffects::InvalidateDirectRenderingObservers(this);
|
||||
|
@ -85,11 +85,6 @@ private:
|
||||
{
|
||||
return GetEnumValue(aIndex, mContent);
|
||||
}
|
||||
const nsSVGIntegerPair *GetIntegerPairValue(uint32_t aIndex, nsIContent *aDefault);
|
||||
const nsSVGIntegerPair *GetIntegerPairValue(uint32_t aIndex)
|
||||
{
|
||||
return GetIntegerPairValue(aIndex, mContent);
|
||||
}
|
||||
const nsSVGLength2 *GetLengthValue(uint32_t aIndex, nsIContent *aDefault);
|
||||
const nsSVGLength2 *GetLengthValue(uint32_t aIndex)
|
||||
{
|
||||
|
@ -52,9 +52,9 @@ nsSVGFilterInstance::nsSVGFilterInstance(const nsStyleFilter& aFilter,
|
||||
|
||||
// XXX if filterUnits is set (or has defaulted) to objectBoundingBox, we
|
||||
// should send a warning to the error console if the author has used lengths
|
||||
// with units. This is a common mistake and can result in filterRes being
|
||||
// *massive* below (because we ignore the units and interpret the number as
|
||||
// a factor of the bbox width/height). We should also send a warning if the
|
||||
// with units. This is a common mistake and can result in the filter region
|
||||
// being *massive* below (because we ignore the units and interpret the number
|
||||
// as a factor of the bbox width/height). We should also send a warning if the
|
||||
// user uses a number without units (a future SVG spec should really
|
||||
// deprecate that, since it's too confusing for a bare number to be sometimes
|
||||
// interpreted as a fraction of the bounding box and sometimes as user-space
|
||||
@ -81,56 +81,31 @@ nsSVGFilterInstance::nsSVGFilterInstance(const nsStyleFilter& aFilter,
|
||||
return;
|
||||
}
|
||||
|
||||
// Calculate filterRes (the width and height of the pixel buffer of the
|
||||
// Calculate the width and height of the pixel buffer of the
|
||||
// temporary offscreen surface that we would/will create to paint into when
|
||||
// painting the entire filtered element) and, if necessary, adjust
|
||||
// painting the entire filtered element and, if necessary, adjust
|
||||
// mFilterRegion out slightly so that it aligns with pixel boundaries of this
|
||||
// buffer:
|
||||
|
||||
gfxIntSize filterRes;
|
||||
const nsSVGIntegerPair* filterResAttrs =
|
||||
mFilterFrame->GetIntegerPairValue(SVGFilterElement::FILTERRES);
|
||||
if (filterResAttrs->IsExplicitlySet()) {
|
||||
int32_t filterResX = filterResAttrs->GetAnimValue(nsSVGIntegerPair::eFirst);
|
||||
int32_t filterResY = filterResAttrs->GetAnimValue(nsSVGIntegerPair::eSecond);
|
||||
if (filterResX <= 0 || filterResY <= 0) {
|
||||
// 0 disables rendering, < 0 is error. dispatch error console warning?
|
||||
return;
|
||||
}
|
||||
|
||||
mFilterRegion.Scale(filterResX, filterResY);
|
||||
mFilterRegion.RoundOut();
|
||||
mFilterRegion.Scale(1.0 / filterResX, 1.0 / filterResY);
|
||||
// We don't care if this overflows, because we can handle upscaling/
|
||||
// downscaling to filterRes
|
||||
bool overflow;
|
||||
filterRes =
|
||||
nsSVGUtils::ConvertToSurfaceSize(gfxSize(filterResX, filterResY),
|
||||
&overflow);
|
||||
// XXX we could send a warning to the error console if the author specified
|
||||
// filterRes doesn't align well with our outer 'svg' device space.
|
||||
} else {
|
||||
// Match filterRes as closely as possible to the pixel density of the nearest
|
||||
// outer 'svg' device space:
|
||||
gfxMatrix canvasTM =
|
||||
nsSVGUtils::GetCanvasTM(mTargetFrame, nsISVGChildFrame::FOR_OUTERSVG_TM);
|
||||
if (canvasTM.IsSingular()) {
|
||||
// nothing to draw
|
||||
return;
|
||||
}
|
||||
|
||||
gfxSize scale = canvasTM.ScaleFactors(true);
|
||||
mFilterRegion.Scale(scale.width, scale.height);
|
||||
mFilterRegion.RoundOut();
|
||||
// We don't care if this overflows, because we can handle upscaling/
|
||||
// downscaling to filterRes
|
||||
bool overflow;
|
||||
filterRes = nsSVGUtils::ConvertToSurfaceSize(mFilterRegion.Size(),
|
||||
&overflow);
|
||||
mFilterRegion.Scale(1.0 / scale.width, 1.0 / scale.height);
|
||||
// Match filter space as closely as possible to the pixel density of the
|
||||
// nearest outer 'svg' device space:
|
||||
gfxMatrix canvasTM =
|
||||
nsSVGUtils::GetCanvasTM(mTargetFrame, nsISVGChildFrame::FOR_OUTERSVG_TM);
|
||||
if (canvasTM.IsSingular()) {
|
||||
// nothing to draw
|
||||
return;
|
||||
}
|
||||
|
||||
mFilterSpaceBounds.SetRect(nsIntPoint(0, 0), filterRes);
|
||||
gfxSize scale = canvasTM.ScaleFactors(true);
|
||||
mFilterRegion.Scale(scale.width, scale.height);
|
||||
mFilterRegion.RoundOut();
|
||||
|
||||
// We don't care if this overflows, because we can handle upscaling/
|
||||
// downscaling to filter space.
|
||||
bool overflow;
|
||||
mFilterSpaceBounds.SetRect(nsIntPoint(0, 0),
|
||||
nsSVGUtils::ConvertToSurfaceSize(mFilterRegion.Size(), &overflow));
|
||||
mFilterRegion.Scale(1.0 / scale.width, 1.0 / scale.height);
|
||||
|
||||
mInitialized = true;
|
||||
}
|
||||
|
@ -74,9 +74,6 @@ public:
|
||||
|
||||
/**
|
||||
* Returns the size of the user specified "filter region", in filter space.
|
||||
* The size will be {filterRes.x by filterRes.y}, whether the user specified
|
||||
* the filter's filterRes attribute explicitly, or the implementation chose
|
||||
* the filterRes values.
|
||||
*/
|
||||
nsIntRect GetFilterSpaceBounds() const { return mFilterSpaceBounds; }
|
||||
|
||||
|