Bug 847120: Convert SVGFETurbulenceElement to WebIDL r=Ms2ger
☠☠ backed out by a3aef14dc53a ☠ ☠
authorDavid Zbarsky <dzbarsky@gmail.com>
Sat, 23 Mar 2013 17:00:36 -0400
changeset 126035 939f0488b0f73e58dbc78e102bc27c77d20cc783
parent 126034 ee6e761d8186f21146126aba295cec005dac9680
child 126036 6a5d309283df56a637777b1b947324af03b501be
push id25239
push userdzbarsky@gmail.com
push dateSat, 23 Mar 2013 21:00:55 +0000
treeherdermozilla-inbound@939f0488b0f7 [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 SVGFETurbulenceElement to WebIDL r=Ms2ger
content/svg/content/src/SVGFETurbulenceElement.cpp
content/svg/content/src/SVGFETurbulenceElement.h
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfoClasses.h
dom/interfaces/svg/nsIDOMSVGFilters.idl
dom/webidl/SVGFETurbulenceElement.webidl
dom/webidl/WebIDL.mk
--- a/content/svg/content/src/SVGFETurbulenceElement.cpp
+++ b/content/svg/content/src/SVGFETurbulenceElement.cpp
@@ -1,133 +1,146 @@
 /* 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/SVGFETurbulenceElement.h"
+#include "mozilla/dom/SVGFETurbulenceElementBinding.h"
+#include "nsSVGFilterInstance.h"
+#include "nsSVGUtils.h"
+
+NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(FETurbulence)
 
 namespace mozilla {
 namespace dom {
 
-nsSVGElement::NumberInfo nsSVGFETurbulenceElement::sNumberInfo[1] =
+// Turbulence Types
+static const unsigned short SVG_TURBULENCE_TYPE_UNKNOWN = 0;
+static const unsigned short SVG_TURBULENCE_TYPE_FRACTALNOISE = 1;
+static const unsigned short SVG_TURBULENCE_TYPE_TURBULENCE = 2;
+
+// Stitch Options
+static const unsigned short SVG_STITCHTYPE_UNKNOWN = 0;
+static const unsigned short SVG_STITCHTYPE_STITCH = 1;
+static const unsigned short SVG_STITCHTYPE_NOSTITCH = 2;
+
+JSObject*
+SVGFETurbulenceElement::WrapNode(JSContext* aCx, JSObject* aScope)
+{
+  return SVGFETurbulenceElementBinding::Wrap(aCx, aScope, this);
+}
+
+nsSVGElement::NumberInfo SVGFETurbulenceElement::sNumberInfo[1] =
 {
   { &nsGkAtoms::seed, 0, false }
 };
 
-nsSVGElement::NumberPairInfo nsSVGFETurbulenceElement::sNumberPairInfo[1] =
+nsSVGElement::NumberPairInfo SVGFETurbulenceElement::sNumberPairInfo[1] =
 {
   { &nsGkAtoms::baseFrequency, 0, 0 }
 };
 
-nsSVGElement::IntegerInfo nsSVGFETurbulenceElement::sIntegerInfo[1] =
+nsSVGElement::IntegerInfo SVGFETurbulenceElement::sIntegerInfo[1] =
 {
   { &nsGkAtoms::numOctaves, 1 }
 };
 
-nsSVGEnumMapping nsSVGFETurbulenceElement::sTypeMap[] = {
+nsSVGEnumMapping SVGFETurbulenceElement::sTypeMap[] = {
   {&nsGkAtoms::fractalNoise,
-   nsIDOMSVGFETurbulenceElement::SVG_TURBULENCE_TYPE_FRACTALNOISE},
+   SVG_TURBULENCE_TYPE_FRACTALNOISE},
   {&nsGkAtoms::turbulence,
-   nsIDOMSVGFETurbulenceElement::SVG_TURBULENCE_TYPE_TURBULENCE},
+   SVG_TURBULENCE_TYPE_TURBULENCE},
   {nullptr, 0}
 };
 
-nsSVGEnumMapping nsSVGFETurbulenceElement::sStitchTilesMap[] = {
+nsSVGEnumMapping SVGFETurbulenceElement::sStitchTilesMap[] = {
   {&nsGkAtoms::stitch,
-   nsIDOMSVGFETurbulenceElement::SVG_STITCHTYPE_STITCH},
+   SVG_STITCHTYPE_STITCH},
   {&nsGkAtoms::noStitch,
-   nsIDOMSVGFETurbulenceElement::SVG_STITCHTYPE_NOSTITCH},
+   SVG_STITCHTYPE_NOSTITCH},
   {nullptr, 0}
 };
 
-nsSVGElement::EnumInfo nsSVGFETurbulenceElement::sEnumInfo[2] =
+nsSVGElement::EnumInfo SVGFETurbulenceElement::sEnumInfo[2] =
 {
   { &nsGkAtoms::type,
     sTypeMap,
-    nsIDOMSVGFETurbulenceElement::SVG_TURBULENCE_TYPE_TURBULENCE
+    SVG_TURBULENCE_TYPE_TURBULENCE
   },
   { &nsGkAtoms::stitchTiles,
     sStitchTilesMap,
-    nsIDOMSVGFETurbulenceElement::SVG_STITCHTYPE_NOSTITCH
+    SVG_STITCHTYPE_NOSTITCH
   }
 };
 
-nsSVGElement::StringInfo nsSVGFETurbulenceElement::sStringInfo[1] =
+nsSVGElement::StringInfo SVGFETurbulenceElement::sStringInfo[1] =
 {
   { &nsGkAtoms::result, kNameSpaceID_None, true }
 };
 
-NS_IMPL_NS_NEW_SVG_ELEMENT(FETurbulence)
-
 //----------------------------------------------------------------------
 // nsISupports methods
 
-NS_IMPL_ADDREF_INHERITED(nsSVGFETurbulenceElement,nsSVGFETurbulenceElementBase)
-NS_IMPL_RELEASE_INHERITED(nsSVGFETurbulenceElement,nsSVGFETurbulenceElementBase)
-
-DOMCI_NODE_DATA(SVGFETurbulenceElement, nsSVGFETurbulenceElement)
+NS_IMPL_ADDREF_INHERITED(SVGFETurbulenceElement,SVGFETurbulenceElementBase)
+NS_IMPL_RELEASE_INHERITED(SVGFETurbulenceElement,SVGFETurbulenceElementBase)
 
-NS_INTERFACE_TABLE_HEAD(nsSVGFETurbulenceElement)
-  NS_NODE_INTERFACE_TABLE5(nsSVGFETurbulenceElement, nsIDOMNode, nsIDOMElement,
-                           nsIDOMSVGElement,
-                           nsIDOMSVGFilterPrimitiveStandardAttributes,
-                           nsIDOMSVGFETurbulenceElement)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGFETurbulenceElement)
-NS_INTERFACE_MAP_END_INHERITING(nsSVGFETurbulenceElementBase)
+NS_INTERFACE_TABLE_HEAD(SVGFETurbulenceElement)
+  NS_NODE_INTERFACE_TABLE3(SVGFETurbulenceElement, nsIDOMNode, nsIDOMElement,
+                           nsIDOMSVGElement)
+NS_INTERFACE_MAP_END_INHERITING(SVGFETurbulenceElementBase)
 
 //----------------------------------------------------------------------
 // nsIDOMNode methods
 
-NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFETurbulenceElement)
+NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFETurbulenceElement)
 
 //----------------------------------------------------------------------
-// nsIDOMSVGFETurbulenceElement methods
 
-/* readonly attribute nsIDOMSVGAnimatedNumber baseFrequencyX; */
-NS_IMETHODIMP nsSVGFETurbulenceElement::GetBaseFrequencyX(nsIDOMSVGAnimatedNumber * *aX)
+already_AddRefed<nsIDOMSVGAnimatedNumber>
+SVGFETurbulenceElement::BaseFrequencyX()
 {
-  return mNumberPairAttributes[BASE_FREQ].ToDOMAnimatedNumber(aX, nsSVGNumberPair::eFirst, this);
+  return mNumberPairAttributes[BASE_FREQ].ToDOMAnimatedNumber(nsSVGNumberPair::eFirst, this);
 }
 
-/* readonly attribute nsIDOMSVGAnimatedNumber baseFrequencyY; */
-NS_IMETHODIMP nsSVGFETurbulenceElement::GetBaseFrequencyY(nsIDOMSVGAnimatedNumber * *aY)
+already_AddRefed<nsIDOMSVGAnimatedNumber>
+SVGFETurbulenceElement::BaseFrequencyY()
 {
-  return mNumberPairAttributes[BASE_FREQ].ToDOMAnimatedNumber(aY, nsSVGNumberPair::eSecond, this);
+  return mNumberPairAttributes[BASE_FREQ].ToDOMAnimatedNumber(nsSVGNumberPair::eSecond, this);
 }
 
-/* readonly attribute nsIDOMSVGAnimatedInteger numOctaves; */
-NS_IMETHODIMP nsSVGFETurbulenceElement::GetNumOctaves(nsIDOMSVGAnimatedInteger * *aNum)
+already_AddRefed<nsIDOMSVGAnimatedInteger>
+SVGFETurbulenceElement::NumOctaves()
 {
-  return mIntegerAttributes[OCTAVES].ToDOMAnimatedInteger(aNum, this);
+  return mIntegerAttributes[OCTAVES].ToDOMAnimatedInteger(this);
 }
 
-/* readonly attribute nsIDOMSVGAnimatedNumber seed; */
-NS_IMETHODIMP nsSVGFETurbulenceElement::GetSeed(nsIDOMSVGAnimatedNumber * *aSeed)
+already_AddRefed<nsIDOMSVGAnimatedNumber>
+SVGFETurbulenceElement::Seed()
 {
-  return mNumberAttributes[SEED].ToDOMAnimatedNumber(aSeed, this);
+  return mNumberAttributes[SEED].ToDOMAnimatedNumber(this);
 }
 
-/* readonly attribute nsIDOMSVGAnimatedEnumeration stitchTiles; */
-NS_IMETHODIMP nsSVGFETurbulenceElement::GetStitchTiles(nsIDOMSVGAnimatedEnumeration * *aStitch)
+already_AddRefed<nsIDOMSVGAnimatedEnumeration>
+SVGFETurbulenceElement::StitchTiles()
 {
-  return mEnumAttributes[STITCHTILES].ToDOMAnimatedEnum(aStitch, this);
+  return mEnumAttributes[STITCHTILES].ToDOMAnimatedEnum(this);
 }
 
-/* readonly attribute nsIDOMSVGAnimatedEnumeration type; */
-NS_IMETHODIMP nsSVGFETurbulenceElement::GetType(nsIDOMSVGAnimatedEnumeration * *aType)
+already_AddRefed<nsIDOMSVGAnimatedEnumeration>
+SVGFETurbulenceElement::Type()
 {
-  return mEnumAttributes[TYPE].ToDOMAnimatedEnum(aType, this);
+  return mEnumAttributes[TYPE].ToDOMAnimatedEnum(this);
 }
 
 nsresult
-nsSVGFETurbulenceElement::Filter(nsSVGFilterInstance *instance,
-                                 const nsTArray<const Image*>& aSources,
-                                 const Image* aTarget,
-                                 const nsIntRect& rect)
+SVGFETurbulenceElement::Filter(nsSVGFilterInstance* instance,
+                               const nsTArray<const Image*>& aSources,
+                               const Image* aTarget,
+                               const nsIntRect& rect)
 {
   uint8_t* targetData = aTarget->mImage->Data();
   uint32_t stride = aTarget->mImage->Stride();
 
   nsIntRect filterSubregion(int32_t(aTarget->mFilterPrimitiveSubregion.X()),
                             int32_t(aTarget->mFilterPrimitiveSubregion.Y()),
                             int32_t(aTarget->mFilterPrimitiveSubregion.Width()),
                             int32_t(aTarget->mFilterPrimitiveSubregion.Height()));
@@ -143,17 +156,17 @@ nsSVGFETurbulenceElement::Filter(nsSVGFi
 
   // XXXroc this makes absolutely no sense to me.
   float filterX = instance->GetFilterRegion().X();
   float filterY = instance->GetFilterRegion().Y();
   float filterWidth = instance->GetFilterRegion().Width();
   float filterHeight = instance->GetFilterRegion().Height();
 
   bool doStitch = false;
-  if (stitch == nsIDOMSVGFETurbulenceElement::SVG_STITCHTYPE_STITCH) {
+  if (stitch == SVG_STITCHTYPE_STITCH) {
     doStitch = true;
 
     float lowFreq, hiFreq;
 
     lowFreq = floor(filterWidth * fX) / filterWidth;
     hiFreq = ceil(filterWidth * fX) / filterWidth;
     if (fX / lowFreq < hiFreq / fX)
       fX = lowFreq;
@@ -170,17 +183,17 @@ nsSVGFETurbulenceElement::Filter(nsSVGFi
   for (int32_t y = rect.y; y < rect.YMost(); y++) {
     for (int32_t x = rect.x; x < rect.XMost(); x++) {
       int32_t targIndex = y * stride + x * 4;
       double point[2];
       point[0] = filterX + (filterWidth * (x + instance->GetSurfaceRect().x)) / (filterSubregion.width - 1);
       point[1] = filterY + (filterHeight * (y + instance->GetSurfaceRect().y)) / (filterSubregion.height - 1);
 
       float col[4];
-      if (type == nsIDOMSVGFETurbulenceElement::SVG_TURBULENCE_TYPE_TURBULENCE) {
+      if (type == SVG_TURBULENCE_TYPE_TURBULENCE) {
         for (int i = 0; i < 4; i++)
           col[i] = Turbulence(i, point, fX, fY, octaves, false,
                               doStitch, filterX, filterY, filterWidth, filterHeight) * 255;
       } else {
         for (int i = 0; i < 4; i++)
           col[i] = (Turbulence(i, point, fX, fY, octaves, true,
                                doStitch, filterX, filterY, filterWidth, filterHeight) * 255 + 255) / 2;
       }
@@ -201,30 +214,30 @@ nsSVGFETurbulenceElement::Filter(nsSVGFi
       targetData[targIndex + GFX_ARGB32_OFFSET_A] = a;
     }
   }
 
   return NS_OK;
 }
 
 bool
-nsSVGFETurbulenceElement::AttributeAffectsRendering(int32_t aNameSpaceID,
+SVGFETurbulenceElement::AttributeAffectsRendering(int32_t aNameSpaceID,
                                                     nsIAtom* aAttribute) const
 {
-  return nsSVGFETurbulenceElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
+  return SVGFETurbulenceElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
          (aNameSpaceID == kNameSpaceID_None &&
           (aAttribute == nsGkAtoms::seed ||
            aAttribute == nsGkAtoms::baseFrequency ||
            aAttribute == nsGkAtoms::numOctaves ||
            aAttribute == nsGkAtoms::type ||
            aAttribute == nsGkAtoms::stitchTiles));
 }
 
 void
-nsSVGFETurbulenceElement::InitSeed(int32_t aSeed)
+SVGFETurbulenceElement::InitSeed(int32_t aSeed)
 {
   double s;
   int i, j, k;
   aSeed = SetupSeed(aSeed);
   for (k = 0; k < 4; k++) {
     for (i = 0; i < sBSize; i++) {
       mLatticeSelector[i] = i;
       for (j = 0; j < 2; j++) {
@@ -252,18 +265,18 @@ nsSVGFETurbulenceElement::InitSeed(int32
       for (j = 0; j < 2; j++)
         mGradient[k][sBSize + i][j] = mGradient[k][i][j];
   }
 }
 
 #define S_CURVE(t) ( t * t * (3. - 2. * t) )
 #define LERP(t, a, b) ( a + t * (b - a) )
 double
-nsSVGFETurbulenceElement::Noise2(int aColorChannel, double aVec[2],
-                                 StitchInfo *aStitchInfo)
+SVGFETurbulenceElement::Noise2(int aColorChannel, double aVec[2],
+                               StitchInfo *aStitchInfo)
 {
   int bx0, bx1, by0, by1, b00, b10, b01, b11;
   double rx0, rx1, ry0, ry1, *q, sx, sy, a, b, t, u, v;
   register long i, j;
   t = aVec[0] + sPerlinN;
   bx0 = (int) t;
   bx1 = bx0 + 1;
   rx0 = t - (int) t;
@@ -307,22 +320,22 @@ nsSVGFETurbulenceElement::Noise2(int aCo
   v = rx1 * q[0] + ry1 * q[1];
   b = LERP(sx, u, v);
   return LERP(sy, a, b);
 }
 #undef S_CURVE
 #undef LERP
 
 double
-nsSVGFETurbulenceElement::Turbulence(int aColorChannel, double *aPoint,
-                                     double aBaseFreqX, double aBaseFreqY,
-                                     int aNumOctaves, bool aFractalSum,
-                                     bool aDoStitching,
-                                     double aTileX, double aTileY,
-                                     double aTileWidth, double aTileHeight)
+SVGFETurbulenceElement::Turbulence(int aColorChannel, double* aPoint,
+                                   double aBaseFreqX, double aBaseFreqY,
+                                   int aNumOctaves, bool aFractalSum,
+                                   bool aDoStitching,
+                                   double aTileX, double aTileY,
+                                   double aTileWidth, double aTileHeight)
 {
   StitchInfo stitch;
   StitchInfo *stitchInfo = NULL; // Not stitching when NULL.
   // Adjust the base frequencies if necessary for stitching.
   if (aDoStitching) {
     // When stitching tiled turbulence, the frequencies must be adjusted
     // so that the tile borders will be continuous.
     if (aBaseFreqX != 0.0) {
@@ -369,54 +382,54 @@ nsSVGFETurbulenceElement::Turbulence(int
       stitch.mHeight *= 2;
       stitch.mWrapY = 2 * stitch.mWrapY - sPerlinN;
     }
   }
   return sum;
 }
 
 nsIntRect
-nsSVGFETurbulenceElement::ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
+SVGFETurbulenceElement::ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
         const nsSVGFilterInstance& aInstance)
 {
   return GetMaxRect();
 }
 
 //----------------------------------------------------------------------
 // nsSVGElement methods
 
 nsSVGElement::NumberAttributesInfo
-nsSVGFETurbulenceElement::GetNumberInfo()
+SVGFETurbulenceElement::GetNumberInfo()
 {
   return NumberAttributesInfo(mNumberAttributes, sNumberInfo,
                               ArrayLength(sNumberInfo));
 }
 
 nsSVGElement::NumberPairAttributesInfo
-nsSVGFETurbulenceElement::GetNumberPairInfo()
+SVGFETurbulenceElement::GetNumberPairInfo()
 {
   return NumberPairAttributesInfo(mNumberPairAttributes, sNumberPairInfo,
                                  ArrayLength(sNumberPairInfo));
 }
 
 nsSVGElement::IntegerAttributesInfo
-nsSVGFETurbulenceElement::GetIntegerInfo()
+SVGFETurbulenceElement::GetIntegerInfo()
 {
   return IntegerAttributesInfo(mIntegerAttributes, sIntegerInfo,
                                ArrayLength(sIntegerInfo));
 }
 
 nsSVGElement::EnumAttributesInfo
-nsSVGFETurbulenceElement::GetEnumInfo()
+SVGFETurbulenceElement::GetEnumInfo()
 {
   return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
                             ArrayLength(sEnumInfo));
 }
 
 nsSVGElement::StringAttributesInfo
-nsSVGFETurbulenceElement::GetStringInfo()
+SVGFETurbulenceElement::GetStringInfo()
 {
   return StringAttributesInfo(mStringAttributes, sStringInfo,
                               ArrayLength(sStringInfo));
 }
 
 } // namespace dom
 } // namespace mozilla
--- a/content/svg/content/src/SVGFETurbulenceElement.h
+++ b/content/svg/content/src/SVGFETurbulenceElement.h
@@ -1,64 +1,76 @@
 /* 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/. */
 
 #ifndef mozilla_dom_SVGFETurbulenceElement_h
 #define mozilla_dom_SVGFETurbulenceElement_h
 
+#include "nsSVGEnum.h"
 #include "nsSVGFilters.h"
+#include "nsSVGNumber2.h"
+#include "nsSVGInteger.h"
+#include "nsSVGString.h"
+
+nsresult NS_NewSVGFETurbulenceElement(nsIContent **aResult,
+                                      already_AddRefed<nsINodeInfo> aNodeInfo);
 
 namespace mozilla {
 namespace dom {
 
-typedef nsSVGFE nsSVGFETurbulenceElementBase;
+typedef nsSVGFE SVGFETurbulenceElementBase;
 
-class nsSVGFETurbulenceElement : public nsSVGFETurbulenceElementBase,
-                                 public nsIDOMSVGFETurbulenceElement
+class SVGFETurbulenceElement : public SVGFETurbulenceElementBase,
+                               public nsIDOMSVGElement
 {
-  friend nsresult NS_NewSVGFETurbulenceElement(nsIContent **aResult,
-                                               already_AddRefed<nsINodeInfo> aNodeInfo);
+  friend nsresult (::NS_NewSVGFETurbulenceElement(nsIContent **aResult,
+                                                  already_AddRefed<nsINodeInfo> aNodeInfo));
 protected:
-  nsSVGFETurbulenceElement(already_AddRefed<nsINodeInfo> aNodeInfo)
-    : nsSVGFETurbulenceElementBase(aNodeInfo) {}
+  SVGFETurbulenceElement(already_AddRefed<nsINodeInfo> aNodeInfo)
+    : SVGFETurbulenceElementBase(aNodeInfo)
+  {
+    SetIsDOMBinding();
+  }
+  virtual JSObject* WrapNode(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
 
 public:
   virtual bool SubregionIsUnionOfRegions() { return false; }
 
   // interfaces:
   NS_DECL_ISUPPORTS_INHERITED
 
-  // FE Base
-  NS_FORWARD_NSIDOMSVGFILTERPRIMITIVESTANDARDATTRIBUTES(nsSVGFETurbulenceElementBase::)
-
   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 nsIntRect ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
           const nsSVGFilterInstance& aInstance);
 
-  // Turbulence
-  NS_DECL_NSIDOMSVGFETURBULENCEELEMENT
-
-  NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFETurbulenceElementBase::)
+  NS_FORWARD_NSIDOMSVGELEMENT(SVGFETurbulenceElementBase::)
 
   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<nsIDOMSVGAnimatedNumber> BaseFrequencyX();
+  already_AddRefed<nsIDOMSVGAnimatedNumber> BaseFrequencyY();
+  already_AddRefed<nsIDOMSVGAnimatedInteger> NumOctaves();
+  already_AddRefed<nsIDOMSVGAnimatedNumber> Seed();
+  already_AddRefed<nsIDOMSVGAnimatedEnumeration> StitchTiles();
+  already_AddRefed<nsIDOMSVGAnimatedEnumeration> Type();
+
 protected:
   virtual NumberAttributesInfo GetNumberInfo();
   virtual NumberPairAttributesInfo GetNumberPairInfo();
   virtual IntegerAttributesInfo GetIntegerInfo();
   virtual EnumAttributesInfo GetEnumInfo();
   virtual StringAttributesInfo GetStringInfo();
 
   enum { SEED }; // floating point seed?!
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -807,18 +807,16 @@ static nsDOMClassInfoData sClassInfoData
 
   // SVG document
   NS_DEFINE_CLASSINFO_DATA(SVGDocument, nsDocumentSH,
                            DOCUMENT_SCRIPTABLE_FLAGS)
 
   // SVG element classes
   NS_DEFINE_CLASSINFO_DATA(TimeEvent, nsEventSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
-  NS_DEFINE_CLASSINFO_DATA(SVGFETurbulenceElement, nsElementSH,
-                           ELEMENT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA_WITH_NAME(SVGUnknownElement, SVGElement, nsElementSH,
                                      ELEMENT_SCRIPTABLE_FLAGS)
 
   // other SVG classes
   NS_DEFINE_CLASSINFO_DATA(SVGAnimatedEnumeration, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(SVGAnimatedInteger, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
@@ -2218,22 +2216,16 @@ nsDOMClassInfo::Init()
   DOM_CLASSINFO_MAP_END
 
   // SVG element classes
   DOM_CLASSINFO_MAP_BEGIN(TimeEvent, nsIDOMTimeEvent)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMTimeEvent)
     DOM_CLASSINFO_EVENT_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END
 
-  DOM_CLASSINFO_MAP_BEGIN(SVGFETurbulenceElement, nsIDOMSVGFETurbulenceElement)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFETurbulenceElement)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
-    DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
-  DOM_CLASSINFO_MAP_END
-
   DOM_CLASSINFO_MAP_BEGIN(SVGUnknownElement, nsIDOMSVGElement)
     DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
   DOM_CLASSINFO_MAP_END
 
   // other SVG classes
   DOM_CLASSINFO_MAP_BEGIN(SVGAnimatedEnumeration, nsIDOMSVGAnimatedEnumeration)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGAnimatedEnumeration)
   DOM_CLASSINFO_MAP_END
--- a/dom/base/nsDOMClassInfoClasses.h
+++ b/dom/base/nsDOMClassInfoClasses.h
@@ -117,17 +117,16 @@ DOMCI_CLASS(CSSSupportsRule)
 
 DOMCI_CLASS(BeforeUnloadEvent)
 
 // The SVG document
 DOMCI_CLASS(SVGDocument)
 
 // SVG element classes
 DOMCI_CLASS(TimeEvent)
-DOMCI_CLASS(SVGFETurbulenceElement)
 DOMCI_CLASS(SVGUnknownElement)
 
 // other SVG classes
 DOMCI_CLASS(SVGAnimatedEnumeration)
 DOMCI_CLASS(SVGAnimatedInteger)
 DOMCI_CLASS(SVGAnimatedNumber)
 DOMCI_CLASS(SVGAnimatedRect)
 DOMCI_CLASS(SVGAnimatedString)
--- a/dom/interfaces/svg/nsIDOMSVGFilters.idl
+++ b/dom/interfaces/svg/nsIDOMSVGFilters.idl
@@ -15,28 +15,8 @@ interface nsIDOMSVGAnimatedInteger;
 interface nsIDOMSVGFilterPrimitiveStandardAttributes : nsIDOMSVGElement
 { 
     readonly attribute nsIDOMSVGAnimatedLength      x;
     readonly attribute nsIDOMSVGAnimatedLength      y;
     readonly attribute nsIDOMSVGAnimatedLength      width;
     readonly attribute nsIDOMSVGAnimatedLength      height;
     readonly attribute nsIDOMSVGAnimatedString      result;
 };
-
-[scriptable, uuid(14eb581d-0e54-42b5-a595-5db6c9490277)]
-interface nsIDOMSVGFETurbulenceElement : nsIDOMSVGFilterPrimitiveStandardAttributes
-{ 
-    // Turbulence Types
-    const unsigned short SVG_TURBULENCE_TYPE_UNKNOWN      = 0;
-    const unsigned short SVG_TURBULENCE_TYPE_FRACTALNOISE = 1;
-    const unsigned short SVG_TURBULENCE_TYPE_TURBULENCE   = 2;
-    // Stitch Options
-    const unsigned short SVG_STITCHTYPE_UNKNOWN  = 0;
-    const unsigned short SVG_STITCHTYPE_STITCH   = 1;
-    const unsigned short SVG_STITCHTYPE_NOSTITCH = 2;
-
-    readonly attribute nsIDOMSVGAnimatedNumber      baseFrequencyX;
-    readonly attribute nsIDOMSVGAnimatedNumber      baseFrequencyY;
-    readonly attribute nsIDOMSVGAnimatedInteger     numOctaves;
-    readonly attribute nsIDOMSVGAnimatedNumber      seed;
-    readonly attribute nsIDOMSVGAnimatedEnumeration stitchTiles;
-    readonly attribute nsIDOMSVGAnimatedEnumeration type;
-};
new file mode 100644
--- /dev/null
+++ b/dom/webidl/SVGFETurbulenceElement.webidl
@@ -0,0 +1,38 @@
+/* -*- 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 SVGAnimatedEnumeration;
+interface SVGAnimatedInteger;
+interface SVGAnimatedNumber;
+interface SVGAnimatedString;
+
+interface SVGFETurbulenceElement : SVGElement {
+
+  // Turbulence Types
+  const unsigned short SVG_TURBULENCE_TYPE_UNKNOWN = 0;
+  const unsigned short SVG_TURBULENCE_TYPE_FRACTALNOISE = 1;
+  const unsigned short SVG_TURBULENCE_TYPE_TURBULENCE = 2;
+
+  // Stitch Options
+  const unsigned short SVG_STITCHTYPE_UNKNOWN = 0;
+  const unsigned short SVG_STITCHTYPE_STITCH = 1;
+  const unsigned short SVG_STITCHTYPE_NOSTITCH = 2;
+
+  readonly attribute SVGAnimatedNumber baseFrequencyX;
+  readonly attribute SVGAnimatedNumber baseFrequencyY;
+  readonly attribute SVGAnimatedInteger numOctaves;
+  readonly attribute SVGAnimatedNumber seed;
+  readonly attribute SVGAnimatedEnumeration stitchTiles;
+  readonly attribute SVGAnimatedEnumeration type;
+};
+
+SVGFETurbulenceElement implements SVGFilterPrimitiveStandardAttributes;
--- a/dom/webidl/WebIDL.mk
+++ b/dom/webidl/WebIDL.mk
@@ -204,16 +204,17 @@ webidl_files = \
   SVGFEMergeElement.webidl \
   SVGFEMergeNodeElement.webidl \
   SVGFEMorphologyElement.webidl \
   SVGFEOffsetElement.webidl \
   SVGFEPointLightElement.webidl \
   SVGFESpecularLightingElement.webidl \
   SVGFESpotLightElement.webidl \
   SVGFETileElement.webidl \
+  SVGFETurbulenceElement.webidl \
   SVGFitToViewBox.webidl \
   SVGForeignObjectElement.webidl \
   SVGGElement.webidl \
   SVGGradientElement.webidl \
   SVGGraphicsElement.webidl \
   SVGImageElement.webidl \
   SVGLengthList.webidl \
   SVGLinearGradientElement.webidl \