Bug 619968 - feGaussianBlur should render as identity if stdDeviation=0 r=jwatt,a=roc
authorRobert Longson <longsonr@gmail.com>
Sat, 18 Dec 2010 13:14:09 +0000
changeset 59506 01cb674212d4e2b0c51862b9602adae01ff366df
parent 59505 b2dc4b542229c8d9f45101ae98cc7ab8a4336817
child 59507 0ca1b65bb907b67d8af7c897e442044232d1464c
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersjwatt, roc
bugs619968
milestone2.0b9pre
Bug 619968 - feGaussianBlur should render as identity if stdDeviation=0 r=jwatt,a=roc
content/svg/content/src/nsSVGFilters.cpp
layout/reftests/svg/filters/feGaussianBlur-6-ref.svg
layout/reftests/svg/filters/reftest.list
--- a/content/svg/content/src/nsSVGFilters.cpp
+++ b/content/svg/content/src/nsSVGFilters.cpp
@@ -645,19 +645,16 @@ nsSVGFEGaussianBlurElement::GetDXY(PRUin
   stdX = aInstance.GetPrimitiveLength(&val);
 
   val.Init(nsSVGUtils::Y, 0xff, stdY, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER);
   stdY = aInstance.GetPrimitiveLength(&val);
   
   if (stdX < 0 || stdY < 0)
     return NS_ERROR_FAILURE;
 
-  if (stdX == 0 || stdY == 0)
-    return NS_ERROR_UNEXPECTED;
-
   // If the box size is greater than twice the temporary surface size
   // in an axis, then each pixel will be set to the average of all the
   // other pixel values.
   *aDX = GetBlurBoxSize(stdX);
   *aDY = GetBlurBoxSize(stdY);
   return NS_OK;
 }
 
@@ -770,18 +767,16 @@ ClipComputationRectToSurface(nsSVGFilter
 nsresult
 nsSVGFEGaussianBlurElement::Filter(nsSVGFilterInstance* aInstance,
                                    const nsTArray<const Image*>& aSources,
                                    const Image* aTarget,
                                    const nsIntRect& rect)
 {
   PRUint32 dx, dy;
   nsresult rv = GetDXY(&dx, &dy, *aInstance);
-  if (rv == NS_ERROR_UNEXPECTED) // zero std deviation
-    return NS_OK;
   if (NS_FAILED(rv))
     return rv;
 
   nsIntRect computationRect = rect;
   InflateRectForBlurDXY(&computationRect, dx, dy);
   ClipComputationRectToSurface(aInstance, &computationRect);
   GaussianBlur(aSources[0], aTarget, computationRect, dx, dy);
   ClipTarget(aInstance, aTarget, computationRect);
new file mode 100644
--- /dev/null
+++ b/layout/reftests/svg/filters/feGaussianBlur-6-ref.svg
@@ -0,0 +1,5 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="500" height="500">
+<g>
+  <rect x="100" y="100" width="100" height="100" fill="#00ff00"/>
+</g>
+</svg>
--- a/layout/reftests/svg/filters/reftest.list
+++ b/layout/reftests/svg/filters/reftest.list
@@ -23,17 +23,17 @@
 == feFlood-1.svg feFlood-1-ref.svg
 == feFlood-2.svg feFlood-2-ref.svg
 
 == feGaussianBlur-1.svg feGaussianBlur-1-ref.svg
 == feGaussianBlur-2.svg feGaussianBlur-2-ref.svg
 # != feGaussianBlur-3.svg feGaussianBlur-3-ref.svg
 == feGaussianBlur-4.svg feGaussianBlur-4-ref.svg
 == feGaussianBlur-5.svg feGaussianBlur-5-ref.svg
-== feGaussianBlur-6.svg about:blank
+== feGaussianBlur-6.svg feGaussianBlur-6-ref.svg
 
 == feImage-1.svg feImage-1-ref.svg
 
 == feMerge-1.svg feMerge-1-ref.svg
 == feMerge-2.svg feMerge-2-ref.svg
 
 == feMorphology-1.svg feMorphology-1-ref.svg
 == feMorphology-2.svg feMorphology-2-ref.svg