Bug 847120: Convert SVGFEGaussianBlurElement to WebIDL r=Ms2ger
authorDavid Zbarsky <dzbarsky@gmail.com>
Tue, 19 Mar 2013 13:43:31 -0400
changeset 136672 f999416ea0478e2e9552c5125b57827f2b4d4a84
parent 136671 e23f5058335b6fdc4593ebde610f499c13c69790
child 136673 52007e7e160267266948ed0b17048c00333a9259
push id336
push userakeybl@mozilla.com
push dateMon, 17 Jun 2013 22:53:19 +0000
treeherdermozilla-release@574a39cdf657 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMs2ger
bugs847120
milestone22.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 847120: Convert SVGFEGaussianBlurElement to WebIDL r=Ms2ger
content/svg/content/src/SVGFEGaussianBlurElement.cpp
content/svg/content/src/SVGFEGaussianBlurElement.h
content/svg/content/src/nsSVGNumberPair.cpp
content/svg/content/src/nsSVGNumberPair.h
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfoClasses.h
dom/interfaces/svg/nsIDOMSVGFilters.idl
dom/webidl/SVGFEGaussianBlurElement.webidl
dom/webidl/WebIDL.mk
--- a/content/svg/content/src/SVGFEGaussianBlurElement.cpp
+++ b/content/svg/content/src/SVGFEGaussianBlurElement.cpp
@@ -1,122 +1,123 @@
 /* a*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/dom/SVGFEGaussianBlurElement.h"
+#include "mozilla/dom/SVGFEGaussianBlurElementBinding.h"
+#include "nsSVGFilterInstance.h"
+#include "nsSVGUtils.h"
 
 NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(FEGaussianBlur)
 
 namespace mozilla {
 namespace dom {
 
-nsSVGElement::NumberPairInfo nsSVGFEGaussianBlurElement::sNumberPairInfo[1] =
+JSObject*
+SVGFEGaussianBlurElement::WrapNode(JSContext* aCx, JSObject* aScope)
+{
+  return SVGFEGaussianBlurElementBinding::Wrap(aCx, aScope, this);
+}
+
+nsSVGElement::NumberPairInfo SVGFEGaussianBlurElement::sNumberPairInfo[1] =
 {
   { &nsGkAtoms::stdDeviation, 0, 0 }
 };
 
-nsSVGElement::StringInfo nsSVGFEGaussianBlurElement::sStringInfo[2] =
+nsSVGElement::StringInfo SVGFEGaussianBlurElement::sStringInfo[2] =
 {
   { &nsGkAtoms::result, kNameSpaceID_None, true },
   { &nsGkAtoms::in, kNameSpaceID_None, true }
 };
 
 //----------------------------------------------------------------------
 // nsISupports methods
 
-NS_IMPL_ADDREF_INHERITED(nsSVGFEGaussianBlurElement,nsSVGFEGaussianBlurElementBase)
-NS_IMPL_RELEASE_INHERITED(nsSVGFEGaussianBlurElement,nsSVGFEGaussianBlurElementBase)
-
-DOMCI_NODE_DATA(SVGFEGaussianBlurElement, nsSVGFEGaussianBlurElement)
+NS_IMPL_ADDREF_INHERITED(SVGFEGaussianBlurElement,SVGFEGaussianBlurElementBase)
+NS_IMPL_RELEASE_INHERITED(SVGFEGaussianBlurElement,SVGFEGaussianBlurElementBase)
 
-NS_INTERFACE_TABLE_HEAD(nsSVGFEGaussianBlurElement)
-  NS_NODE_INTERFACE_TABLE5(nsSVGFEGaussianBlurElement, nsIDOMNode,
-                           nsIDOMElement, nsIDOMSVGElement,
-                           nsIDOMSVGFilterPrimitiveStandardAttributes,
-                           nsIDOMSVGFEGaussianBlurElement)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGFEGaussianBlurElement)
-NS_INTERFACE_MAP_END_INHERITING(nsSVGFEGaussianBlurElementBase)
+NS_INTERFACE_TABLE_HEAD(SVGFEGaussianBlurElement)
+  NS_NODE_INTERFACE_TABLE3(SVGFEGaussianBlurElement, nsIDOMNode,
+                           nsIDOMElement, nsIDOMSVGElement)
+NS_INTERFACE_MAP_END_INHERITING(SVGFEGaussianBlurElementBase)
 
 //----------------------------------------------------------------------
 // nsIDOMNode methods
 
 
-NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEGaussianBlurElement)
+NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEGaussianBlurElement)
 
 
 //----------------------------------------------------------------------
-// nsIDOMSVGFEGaussianBlurElement methods
 
-/* readonly attribute nsIDOMSVGAnimatedString in1; */
-NS_IMETHODIMP nsSVGFEGaussianBlurElement::GetIn1(nsIDOMSVGAnimatedString * *aIn)
+already_AddRefed<nsIDOMSVGAnimatedString>
+SVGFEGaussianBlurElement::In1()
 {
-  return mStringAttributes[IN1].ToDOMAnimatedString(aIn, this);
+  return mStringAttributes[IN1].ToDOMAnimatedString(this);
 }
 
-/* readonly attribute nsIDOMSVGAnimatedNumber stdDeviationX; */
-NS_IMETHODIMP nsSVGFEGaussianBlurElement::GetStdDeviationX(nsIDOMSVGAnimatedNumber * *aX)
+already_AddRefed<nsIDOMSVGAnimatedNumber>
+SVGFEGaussianBlurElement::StdDeviationX()
 {
-  return mNumberPairAttributes[STD_DEV].ToDOMAnimatedNumber(aX, nsSVGNumberPair::eFirst, this);
+  return mNumberPairAttributes[STD_DEV].ToDOMAnimatedNumber(nsSVGNumberPair::eFirst, this);
 }
 
-/* readonly attribute nsIDOMSVGAnimatedNumber stdDeviationY; */
-NS_IMETHODIMP nsSVGFEGaussianBlurElement::GetStdDeviationY(nsIDOMSVGAnimatedNumber * *aY)
+already_AddRefed<nsIDOMSVGAnimatedNumber>
+SVGFEGaussianBlurElement::StdDeviationY()
 {
-  return mNumberPairAttributes[STD_DEV].ToDOMAnimatedNumber(aY, nsSVGNumberPair::eSecond, this);
+  return mNumberPairAttributes[STD_DEV].ToDOMAnimatedNumber(nsSVGNumberPair::eSecond, this);
 }
 
-NS_IMETHODIMP
-nsSVGFEGaussianBlurElement::SetStdDeviation(float stdDeviationX, float stdDeviationY)
+void
+SVGFEGaussianBlurElement::SetStdDeviation(float stdDeviationX, float stdDeviationY)
 {
-  NS_ENSURE_FINITE2(stdDeviationX, stdDeviationY, NS_ERROR_ILLEGAL_VALUE);
   mNumberPairAttributes[STD_DEV].SetBaseValues(stdDeviationX, stdDeviationY, this);
-  return NS_OK;
 }
 
 /**
  * We want to speed up 1/N integer divisions --- integer division is
  * often rather slow.
  * We know that our input numerators V are constrained to be <= 255*N,
  * so the result of dividing by N always fits in 8 bits.
  * So we can try approximating the division V/N as V*K/(2^24) (integer
  * division, 32-bit multiply). Dividing by 2^24 is a simple shift so it's
  * fast. The main problem is choosing a value for K; this function returns
  * K's value.
- * 
+ *
  * If the result is correct for the extrema, V=0 and V=255*N, then we'll
  * be in good shape since both the original function and our approximation
  * are linear. V=0 always gives 0 in both cases, no problem there.
  * For V=255*N, let's choose the largest K that doesn't cause overflow
  * and ensure that it gives the right answer. The constraints are
  *     (1)   255*N*K < 2^32
  * and (2)   255*N*K >= 255*(2^24)
- * 
+ *
  * From (1) we find the best value of K is floor((2^32 - 1)/(255*N)).
  * (2) tells us when this will be valid:
  *    N*floor((2^32 - 1)/(255*N)) >= 2^24
  * Now, floor(X) > X - 1, so (2) holds if
  *    N*((2^32 - 1)/(255*N) - 1) >= 2^24
  *         (2^32 - 1)/255 - 2^24 >= N
  *                             N <= 65793
- * 
+ *
  * If all that math confuses you, this should convince you:
  * > perl -e 'for($N=1;(255*$N*int(0xFFFFFFFF/(255*$N)))>>24==255;++$N){}print"$N\n"'
  * 66052
- * 
+ *
  * So this is fine for all reasonable values of N. For larger values of N
  * we may as well just use the same approximation and accept the fact that
  * the output channel values will be a little low.
  */
 static uint32_t ComputeScaledDivisor(uint32_t aDivisor)
 {
   return UINT32_MAX/(255*aDivisor);
 }
-  
+
 static void
 BoxBlur(const uint8_t *aInput, uint8_t *aOutput,
         int32_t aStrideMinor, int32_t aStartMinor, int32_t aEndMinor,
         int32_t aLeftLobe, int32_t aRightLobe, bool aAlphaOnly)
 {
   int32_t boxSize = aLeftLobe + aRightLobe + 1;
   int32_t scaledDivisor = ComputeScaledDivisor(boxSize);
   int32_t sums[4] = {0, 0, 0, 0};
@@ -206,18 +207,18 @@ GetBlurBoxSize(double aStdDev)
   // Doing super-large blurs accurately isn't very important.
   uint32_t max = 1024;
   if (size > max)
     return max;
   return uint32_t(floor(size + 0.5));
 }
 
 nsresult
-nsSVGFEGaussianBlurElement::GetDXY(uint32_t *aDX, uint32_t *aDY,
-                                   const nsSVGFilterInstance& aInstance)
+SVGFEGaussianBlurElement::GetDXY(uint32_t *aDX, uint32_t *aDY,
+                                 const nsSVGFilterInstance& aInstance)
 {
   float stdX = aInstance.GetPrimitiveNumber(SVGContentUtils::X,
                                             &mNumberPairAttributes[STD_DEV],
                                             nsSVGNumberPair::eFirst);
   float stdY = aInstance.GetPrimitiveNumber(SVGContentUtils::Y,
                                             &mNumberPairAttributes[STD_DEV],
                                             nsSVGNumberPair::eSecond);
   if (stdX < 0 || stdY < 0)
@@ -235,31 +236,31 @@ static bool
 AreAllColorChannelsZero(const nsSVGFE::Image* aTarget)
 {
   return aTarget->mConstantColorChannels &&
          aTarget->mImage->GetDataSize() >= 4 &&
          (*reinterpret_cast<uint32_t*>(aTarget->mImage->Data()) & 0x00FFFFFF) == 0;
 }
 
 void
-nsSVGFEGaussianBlurElement::GaussianBlur(const Image *aSource,
-                                         const Image *aTarget,                                         
-                                         const nsIntRect& aDataRect,
-                                         uint32_t aDX, uint32_t aDY)
+SVGFEGaussianBlurElement::GaussianBlur(const Image* aSource,
+                                       const Image* aTarget,
+                                       const nsIntRect& aDataRect,
+                                       uint32_t aDX, uint32_t aDY)
 {
   NS_ASSERTION(nsIntRect(0, 0, aTarget->mImage->Width(), aTarget->mImage->Height()).Contains(aDataRect),
                "aDataRect out of bounds");
 
   nsAutoArrayPtr<uint8_t> tmp(new uint8_t[aTarget->mImage->GetDataSize()]);
   if (!tmp)
     return;
   memset(tmp, 0, aTarget->mImage->GetDataSize());
 
   bool alphaOnly = AreAllColorChannelsZero(aTarget);
-  
+
   const uint8_t* sourceData = aSource->mImage->Data();
   uint8_t* targetData = aTarget->mImage->Data();
   uint32_t stride = aTarget->mImage->Stride();
 
   if (aDX == 0) {
     CopyDataRect(tmp, sourceData, stride, aDataRect);
   } else {
     int32_t longLobe = aDX/2;
@@ -333,95 +334,95 @@ static void
 ClipComputationRectToSurface(nsSVGFilterInstance* aInstance,
                              nsIntRect* aDataRect)
 {
   aDataRect->IntersectRect(*aDataRect,
           nsIntRect(nsIntPoint(0, 0), aInstance->GetSurfaceRect().Size()));
 }
 
 nsresult
-nsSVGFEGaussianBlurElement::Filter(nsSVGFilterInstance* aInstance,
-                                   const nsTArray<const Image*>& aSources,
-                                   const Image* aTarget,
-                                   const nsIntRect& rect)
+SVGFEGaussianBlurElement::Filter(nsSVGFilterInstance* aInstance,
+                                 const nsTArray<const Image*>& aSources,
+                                 const Image* aTarget,
+                                 const nsIntRect& rect)
 {
   uint32_t dx, dy;
   nsresult rv = GetDXY(&dx, &dy, *aInstance);
   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);
   return NS_OK;
 }
 
 bool
-nsSVGFEGaussianBlurElement::AttributeAffectsRendering(int32_t aNameSpaceID,
-                                                      nsIAtom* aAttribute) const
+SVGFEGaussianBlurElement::AttributeAffectsRendering(int32_t aNameSpaceID,
+                                                    nsIAtom* aAttribute) const
 {
-  return nsSVGFEGaussianBlurElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
+  return SVGFEGaussianBlurElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
          (aNameSpaceID == kNameSpaceID_None &&
           (aAttribute == nsGkAtoms::in ||
            aAttribute == nsGkAtoms::stdDeviation));
 }
 
 void
-nsSVGFEGaussianBlurElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
+SVGFEGaussianBlurElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
 {
   aSources.AppendElement(nsSVGStringInfo(&mStringAttributes[IN1], this));
 }
 
 nsIntRect
-nsSVGFEGaussianBlurElement::InflateRectForBlur(const nsIntRect& aRect,
-                                               const nsSVGFilterInstance& aInstance)
+SVGFEGaussianBlurElement::InflateRectForBlur(const nsIntRect& aRect,
+                                             const nsSVGFilterInstance& aInstance)
 {
   uint32_t dX, dY;
   nsresult rv = GetDXY(&dX, &dY, aInstance);
   nsIntRect result = aRect;
   if (NS_SUCCEEDED(rv)) {
     InflateRectForBlurDXY(&result, dX, dY);
   }
   return result;
 }
 
 nsIntRect
-nsSVGFEGaussianBlurElement::ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
+SVGFEGaussianBlurElement::ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
         const nsSVGFilterInstance& aInstance)
 {
   return InflateRectForBlur(aSourceBBoxes[0], aInstance);
 }
 
 void
-nsSVGFEGaussianBlurElement::ComputeNeededSourceBBoxes(const nsIntRect& aTargetBBox,
+SVGFEGaussianBlurElement::ComputeNeededSourceBBoxes(const nsIntRect& aTargetBBox,
           nsTArray<nsIntRect>& aSourceBBoxes, const nsSVGFilterInstance& aInstance)
 {
   aSourceBBoxes[0] = InflateRectForBlur(aTargetBBox, aInstance);
 }
 
 nsIntRect
-nsSVGFEGaussianBlurElement::ComputeChangeBBox(const nsTArray<nsIntRect>& aSourceChangeBoxes,
-                                              const nsSVGFilterInstance& aInstance)
+SVGFEGaussianBlurElement::ComputeChangeBBox(const nsTArray<nsIntRect>& aSourceChangeBoxes,
+                                            const nsSVGFilterInstance& aInstance)
 {
   return InflateRectForBlur(aSourceChangeBoxes[0], aInstance);
 }
 
 //----------------------------------------------------------------------
 // nsSVGElement methods
 
 nsSVGElement::NumberPairAttributesInfo
-nsSVGFEGaussianBlurElement::GetNumberPairInfo()
+SVGFEGaussianBlurElement::GetNumberPairInfo()
 {
   return NumberPairAttributesInfo(mNumberPairAttributes, sNumberPairInfo,
                                   ArrayLength(sNumberPairInfo));
 }
 
 nsSVGElement::StringAttributesInfo
-nsSVGFEGaussianBlurElement::GetStringInfo()
+SVGFEGaussianBlurElement::GetStringInfo()
 {
   return StringAttributesInfo(mStringAttributes, sStringInfo,
                               ArrayLength(sStringInfo));
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/content/svg/content/src/SVGFEGaussianBlurElement.h
+++ b/content/svg/content/src/SVGFEGaussianBlurElement.h
@@ -2,66 +2,74 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_SVGFEGaussianBlurElement_h
 #define mozilla_dom_SVGFEGaussianBlurElement_h
 
 #include "nsSVGFilters.h"
+#include "nsSVGNumberPair.h"
+#include "nsSVGString.h"
+
+nsresult NS_NewSVGFEGaussianBlurElement(nsIContent **aResult,
+                                        already_AddRefed<nsINodeInfo> aNodeInfo);
 
 namespace mozilla {
 namespace dom {
 
-typedef nsSVGFE nsSVGFEGaussianBlurElementBase;
+typedef nsSVGFE SVGFEGaussianBlurElementBase;
 
-class nsSVGFEGaussianBlurElement : public nsSVGFEGaussianBlurElementBase,
-                                   public nsIDOMSVGFEGaussianBlurElement
+class SVGFEGaussianBlurElement : public SVGFEGaussianBlurElementBase,
+                                 public nsIDOMSVGElement
 {
-  friend nsresult NS_NewSVGFEGaussianBlurElement(nsIContent **aResult,
-                                                 already_AddRefed<nsINodeInfo> aNodeInfo);
+  friend nsresult (::NS_NewSVGFEGaussianBlurElement(nsIContent **aResult,
+                                                    already_AddRefed<nsINodeInfo> aNodeInfo));
 protected:
-  nsSVGFEGaussianBlurElement(already_AddRefed<nsINodeInfo> aNodeInfo)
-    : nsSVGFEGaussianBlurElementBase(aNodeInfo) {}
+  SVGFEGaussianBlurElement(already_AddRefed<nsINodeInfo> aNodeInfo)
+    : SVGFEGaussianBlurElementBase(aNodeInfo)
+  {
+    SetIsDOMBinding();
+  }
+  virtual JSObject* WrapNode(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
 
 public:
   // interfaces:
   NS_DECL_ISUPPORTS_INHERITED
 
-  // FE Base
-  NS_FORWARD_NSIDOMSVGFILTERPRIMITIVESTANDARDATTRIBUTES(nsSVGFEGaussianBlurElementBase::)
-
   virtual nsresult Filter(nsSVGFilterInstance* aInstance,
                           const nsTArray<const Image*>& aSources,
                           const Image* aTarget,
                           const nsIntRect& aDataRect);
   virtual bool AttributeAffectsRendering(
           int32_t aNameSpaceID, nsIAtom* aAttribute) const;
   virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
   virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo >& aSources);
   virtual nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
           const nsSVGFilterInstance& aInstance);
   virtual void ComputeNeededSourceBBoxes(const nsIntRect& aTargetBBox,
           nsTArray<nsIntRect>& aSourceBBoxes, const nsSVGFilterInstance& aInstance);
   virtual nsIntRect ComputeChangeBBox(const nsTArray<nsIntRect>& aSourceChangeBoxes,
           const nsSVGFilterInstance& aInstance);
 
-  // Gaussian
-  NS_DECL_NSIDOMSVGFEGAUSSIANBLURELEMENT
-
-  NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEGaussianBlurElementBase::)
+  NS_FORWARD_NSIDOMSVGELEMENT(SVGFEGaussianBlurElementBase::)
 
   NS_FORWARD_NSIDOMNODE_TO_NSINODE
   NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
 
   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
 
-  virtual nsXPCClassInfo* GetClassInfo();
+  virtual nsIDOMNode* AsDOMNode() { return this; }
 
-  virtual nsIDOMNode* AsDOMNode() { return this; }
+  // WebIDL
+  already_AddRefed<nsIDOMSVGAnimatedString> In1();
+  already_AddRefed<nsIDOMSVGAnimatedNumber> StdDeviationX();
+  already_AddRefed<nsIDOMSVGAnimatedNumber> StdDeviationY();
+  void SetStdDeviation(float stdDeviationX, float stdDeviationY);
+
 protected:
   virtual NumberPairAttributesInfo GetNumberPairInfo();
   virtual StringAttributesInfo GetStringInfo();
 
   enum { STD_DEV };
   nsSVGNumberPair mNumberPairAttributes[1];
   static NumberPairInfo sNumberPairInfo[1];
 
--- a/content/svg/content/src/nsSVGNumberPair.cpp
+++ b/content/svg/content/src/nsSVGNumberPair.cpp
@@ -162,34 +162,41 @@ nsSVGNumberPair::SetAnimValue(const floa
   }
   mAnimVal[0] = aValue[0];
   mAnimVal[1] = aValue[1];
   mIsAnimated = true;
   aSVGElement->DidAnimateNumberPair(mAttrEnum);
 }
 
 nsresult
-nsSVGNumberPair::ToDOMAnimatedNumber(nsIDOMSVGAnimatedNumber **aResult,
+nsSVGNumberPair::ToDOMAnimatedNumber(nsIDOMSVGAnimatedNumber** aResult,
                                      PairIndex aIndex,
-                                     nsSVGElement *aSVGElement)
+                                     nsSVGElement* aSVGElement)
+{
+  *aResult = ToDOMAnimatedNumber(aIndex, aSVGElement).get();
+  return NS_OK;
+}
+
+already_AddRefed<nsIDOMSVGAnimatedNumber>
+nsSVGNumberPair::ToDOMAnimatedNumber(PairIndex aIndex,
+                                     nsSVGElement* aSVGElement)
 {
   nsRefPtr<DOMAnimatedNumber> domAnimatedNumber =
     aIndex == eFirst ? sSVGFirstAnimatedNumberTearoffTable.GetTearoff(this) :
                        sSVGSecondAnimatedNumberTearoffTable.GetTearoff(this);
   if (!domAnimatedNumber) {
     domAnimatedNumber = new DOMAnimatedNumber(this, aIndex, aSVGElement);
     if (aIndex == eFirst) {
       sSVGFirstAnimatedNumberTearoffTable.AddTearoff(this, domAnimatedNumber);
     } else {
       sSVGSecondAnimatedNumberTearoffTable.AddTearoff(this, domAnimatedNumber);
     }
   }
 
-  domAnimatedNumber.forget(aResult);
-  return NS_OK;
+  return domAnimatedNumber.forget();
 }
 
 nsSVGNumberPair::DOMAnimatedNumber::~DOMAnimatedNumber()
 {
   if (mIndex == eFirst) {
     sSVGFirstAnimatedNumberTearoffTable.RemoveTearoff(mVal);
   } else {
     sSVGSecondAnimatedNumberTearoffTable.RemoveTearoff(mVal);
--- a/content/svg/content/src/nsSVGNumberPair.h
+++ b/content/svg/content/src/nsSVGNumberPair.h
@@ -55,19 +55,22 @@ public:
   // Returns true if the animated value of this number has been explicitly
   // set (either by animation, or by taking on the base value which has been
   // explicitly set by markup or a DOM call), false otherwise.
   // If this returns false, the animated value is still valid, that is,
   // useable, and represents the default base value of the attribute.
   bool IsExplicitlySet() const
     { return mIsAnimated || mIsBaseSet; }
 
-  nsresult ToDOMAnimatedNumber(nsIDOMSVGAnimatedNumber **aResult,
+  nsresult ToDOMAnimatedNumber(nsIDOMSVGAnimatedNumber** aResult,
                                PairIndex aIndex,
                                nsSVGElement* aSVGElement);
+  already_AddRefed<nsIDOMSVGAnimatedNumber>
+    ToDOMAnimatedNumber(PairIndex aIndex,
+                        nsSVGElement* aSVGElement);
   // Returns a new nsISMILAttr object that the caller must delete
   nsISMILAttr* ToSMILAttr(nsSVGElement* aSVGElement);
 
 private:
 
   float mAnimVal[2];
   float mBaseVal[2];
   uint8_t mAttrEnum; // element specified tracking for attribute
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -810,18 +810,16 @@ static nsDOMClassInfoData sClassInfoData
   NS_DEFINE_CLASSINFO_DATA(TimeEvent, nsEventSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(SVGFEConvolveMatrixElement, nsElementSH,
                            ELEMENT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(SVGFEDiffuseLightingElement, nsElementSH,
                            ELEMENT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(SVGFEDisplacementMapElement, nsElementSH,
                            ELEMENT_SCRIPTABLE_FLAGS)
-  NS_DEFINE_CLASSINFO_DATA(SVGFEGaussianBlurElement, nsElementSH,
-                           ELEMENT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(SVGFEMorphologyElement, nsElementSH,
                            ELEMENT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(SVGFEOffsetElement, nsElementSH,
                            ELEMENT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(SVGFESpecularLightingElement, nsElementSH,
                            ELEMENT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(SVGFESpotLightElement, nsElementSH,
                            ELEMENT_SCRIPTABLE_FLAGS)
@@ -2244,22 +2242,16 @@ nsDOMClassInfo::Init()
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(SVGFEDisplacementMapElement, nsIDOMSVGFEDisplacementMapElement)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEDisplacementMapElement)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
     DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END
 
-  DOM_CLASSINFO_MAP_BEGIN(SVGFEGaussianBlurElement, nsIDOMSVGFEGaussianBlurElement)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEGaussianBlurElement)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
-    DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
-  DOM_CLASSINFO_MAP_END
-
   DOM_CLASSINFO_MAP_BEGIN(SVGFEMorphologyElement, nsIDOMSVGFEMorphologyElement)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEMorphologyElement)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
     DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(SVGFEOffsetElement, nsIDOMSVGFEOffsetElement)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEOffsetElement)
--- a/dom/base/nsDOMClassInfoClasses.h
+++ b/dom/base/nsDOMClassInfoClasses.h
@@ -120,17 +120,16 @@ DOMCI_CLASS(BeforeUnloadEvent)
 // The SVG document
 DOMCI_CLASS(SVGDocument)
 
 // SVG element classes
 DOMCI_CLASS(TimeEvent)
 DOMCI_CLASS(SVGFEConvolveMatrixElement)
 DOMCI_CLASS(SVGFEDiffuseLightingElement)
 DOMCI_CLASS(SVGFEDisplacementMapElement)
-DOMCI_CLASS(SVGFEGaussianBlurElement)
 DOMCI_CLASS(SVGFEMorphologyElement)
 DOMCI_CLASS(SVGFEOffsetElement)
 DOMCI_CLASS(SVGFESpecularLightingElement)
 DOMCI_CLASS(SVGFESpotLightElement)
 DOMCI_CLASS(SVGFETurbulenceElement)
 DOMCI_CLASS(SVGUnknownElement)
 
 // other SVG classes
--- a/dom/interfaces/svg/nsIDOMSVGFilters.idl
+++ b/dom/interfaces/svg/nsIDOMSVGFilters.idl
@@ -16,26 +16,16 @@ interface nsIDOMSVGFilterPrimitiveStanda
 { 
     readonly attribute nsIDOMSVGAnimatedLength      x;
     readonly attribute nsIDOMSVGAnimatedLength      y;
     readonly attribute nsIDOMSVGAnimatedLength      width;
     readonly attribute nsIDOMSVGAnimatedLength      height;
     readonly attribute nsIDOMSVGAnimatedString      result;
 };
 
-[scriptable, uuid(08f2d7e5-b79f-405c-8140-7faa72c53ead)]
-interface nsIDOMSVGFEGaussianBlurElement : nsIDOMSVGFilterPrimitiveStandardAttributes
-{ 
-    readonly attribute nsIDOMSVGAnimatedString in1;
-    readonly attribute nsIDOMSVGAnimatedNumber stdDeviationX;
-    readonly attribute nsIDOMSVGAnimatedNumber stdDeviationY;
-
-    void setStdDeviation ( in float stdDeviationX, in float stdDeviationY );
-};
-
 [scriptable, uuid(4fa9fbbe-482c-418a-afd1-d51b003f5a04)]
 interface nsIDOMSVGFEOffsetElement : nsIDOMSVGFilterPrimitiveStandardAttributes { 
     readonly attribute nsIDOMSVGAnimatedString in1;
     readonly attribute nsIDOMSVGAnimatedNumber dx;
     readonly attribute nsIDOMSVGAnimatedNumber dy;
 };
 
 [scriptable, uuid(b0f8b61c-7825-4149-a295-c85604ec50fa)]
new file mode 100644
--- /dev/null
+++ b/dom/webidl/SVGFEGaussianBlurElement.webidl
@@ -0,0 +1,22 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * The origin of this IDL file is
+ * http://www.w3.org/TR/SVG2/
+ *
+ * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
+ * liability, trademark and document use rules apply.
+ */
+
+interface SVGAnimatedNumber;
+interface SVGAnimatedString;
+
+interface SVGFEGaussianBlurElement : SVGElement {
+  readonly attribute SVGAnimatedString in1;
+  readonly attribute SVGAnimatedNumber stdDeviationX;
+  readonly attribute SVGAnimatedNumber stdDeviationY;
+
+  void setStdDeviation(float stdDeviationX, float stdDeviationY);
+};
--- a/dom/webidl/WebIDL.mk
+++ b/dom/webidl/WebIDL.mk
@@ -189,16 +189,17 @@ webidl_files = \
   SVGFEComponentTransferElement.webidl \
   SVGFECompositeElement.webidl \
   SVGFEDistantLightElement.webidl \
   SVGFEFloodElement.webidl \
   SVGFEFuncAElement.webidl \
   SVGFEFuncBElement.webidl \
   SVGFEFuncGElement.webidl \
   SVGFEFuncRElement.webidl \
+  SVGFEGaussianBlurElement.webidl \
   SVGFEImageElement.webidl \
   SVGFEMergeElement.webidl \
   SVGFEMergeNodeElement.webidl \
   SVGFEPointLightElement.webidl \
   SVGFETileElement.webidl \
   SVGFitToViewBox.webidl \
   SVGForeignObjectElement.webidl \
   SVGGElement.webidl \