Bug 847120: Convert SVGFEDisplacementMapElement to WebIDL r=Ms2ger
authorDavid Zbarsky <dzbarsky@gmail.com>
Mon, 25 Mar 2013 02:26:06 -0400
changeset 136499 dea1e46826dc7c52f888d8b39be9b5e7cccdf21d
parent 136498 7f6d59527eee18a7e32aa756907cef569ed57d26
child 136500 f2af3063ab66df33455c4948be105c78a16914ea
push id2452
push userlsblakk@mozilla.com
push dateMon, 13 May 2013 16:59:38 +0000
treeherdermozilla-beta@d4b152d29d8d [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 SVGFEDisplacementMapElement to WebIDL r=Ms2ger
content/svg/content/src/SVGFEDisplacementMapElement.cpp
content/svg/content/src/SVGFEDisplacementMapElement.h
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfoClasses.h
dom/interfaces/svg/nsIDOMSVGFilters.idl
dom/webidl/SVGFEDisplacementMapElement.webidl
dom/webidl/WebIDL.mk
--- a/content/svg/content/src/SVGFEDisplacementMapElement.cpp
+++ b/content/svg/content/src/SVGFEDisplacementMapElement.cpp
@@ -1,111 +1,121 @@
 /* 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/SVGFEDisplacementMapElement.h"
+#include "mozilla/dom/SVGFEDisplacementMapElementBinding.h"
+#include "nsSVGFilterInstance.h"
+#include "nsSVGUtils.h"
+
+NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(FEDisplacementMap)
 
 namespace mozilla {
 namespace dom {
 
-nsSVGElement::NumberInfo nsSVGFEDisplacementMapElement::sNumberInfo[1] =
+// Channel Selectors
+static const unsigned short SVG_CHANNEL_UNKNOWN = 0;
+static const unsigned short SVG_CHANNEL_R = 1;
+static const unsigned short SVG_CHANNEL_G = 2;
+static const unsigned short SVG_CHANNEL_B = 3;
+static const unsigned short SVG_CHANNEL_A = 4;
+
+JSObject*
+SVGFEDisplacementMapElement::WrapNode(JSContext* aCx, JSObject* aScope)
+{
+  return SVGFEDisplacementMapElementBinding::Wrap(aCx, aScope, this);
+}
+
+nsSVGElement::NumberInfo SVGFEDisplacementMapElement::sNumberInfo[1] =
 {
   { &nsGkAtoms::scale, 0, false },
 };
 
-nsSVGEnumMapping nsSVGFEDisplacementMapElement::sChannelMap[] = {
-  {&nsGkAtoms::R, nsSVGFEDisplacementMapElement::SVG_CHANNEL_R},
-  {&nsGkAtoms::G, nsSVGFEDisplacementMapElement::SVG_CHANNEL_G},
-  {&nsGkAtoms::B, nsSVGFEDisplacementMapElement::SVG_CHANNEL_B},
-  {&nsGkAtoms::A, nsSVGFEDisplacementMapElement::SVG_CHANNEL_A},
+nsSVGEnumMapping SVGFEDisplacementMapElement::sChannelMap[] = {
+  {&nsGkAtoms::R, SVG_CHANNEL_R},
+  {&nsGkAtoms::G, SVG_CHANNEL_G},
+  {&nsGkAtoms::B, SVG_CHANNEL_B},
+  {&nsGkAtoms::A, SVG_CHANNEL_A},
   {nullptr, 0}
 };
 
-nsSVGElement::EnumInfo nsSVGFEDisplacementMapElement::sEnumInfo[2] =
+nsSVGElement::EnumInfo SVGFEDisplacementMapElement::sEnumInfo[2] =
 {
   { &nsGkAtoms::xChannelSelector,
     sChannelMap,
-    nsSVGFEDisplacementMapElement::SVG_CHANNEL_A
+    SVG_CHANNEL_A
   },
   { &nsGkAtoms::yChannelSelector,
     sChannelMap,
-    nsSVGFEDisplacementMapElement::SVG_CHANNEL_A
+    SVG_CHANNEL_A
   }
 };
 
-nsSVGElement::StringInfo nsSVGFEDisplacementMapElement::sStringInfo[3] =
+nsSVGElement::StringInfo SVGFEDisplacementMapElement::sStringInfo[3] =
 {
   { &nsGkAtoms::result, kNameSpaceID_None, true },
   { &nsGkAtoms::in, kNameSpaceID_None, true },
   { &nsGkAtoms::in2, kNameSpaceID_None, true }
 };
 
-NS_IMPL_NS_NEW_SVG_ELEMENT(FEDisplacementMap)
-
 //----------------------------------------------------------------------
 // nsISupports methods
 
-NS_IMPL_ADDREF_INHERITED(nsSVGFEDisplacementMapElement,nsSVGFEDisplacementMapElementBase)
-NS_IMPL_RELEASE_INHERITED(nsSVGFEDisplacementMapElement,nsSVGFEDisplacementMapElementBase)
-
-DOMCI_NODE_DATA(SVGFEDisplacementMapElement, nsSVGFEDisplacementMapElement)
+NS_IMPL_ADDREF_INHERITED(SVGFEDisplacementMapElement,SVGFEDisplacementMapElementBase)
+NS_IMPL_RELEASE_INHERITED(SVGFEDisplacementMapElement,SVGFEDisplacementMapElementBase)
 
-NS_INTERFACE_TABLE_HEAD(nsSVGFEDisplacementMapElement)
-  NS_NODE_INTERFACE_TABLE5(nsSVGFEDisplacementMapElement, nsIDOMNode,
-                           nsIDOMElement, nsIDOMSVGElement,
-                           nsIDOMSVGFilterPrimitiveStandardAttributes,
-                           nsIDOMSVGFEDisplacementMapElement)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGFEDisplacementMapElement)
-NS_INTERFACE_MAP_END_INHERITING(nsSVGFEDisplacementMapElementBase)
+NS_INTERFACE_TABLE_HEAD(SVGFEDisplacementMapElement)
+  NS_NODE_INTERFACE_TABLE3(SVGFEDisplacementMapElement, nsIDOMNode,
+                           nsIDOMElement, nsIDOMSVGElement)
+NS_INTERFACE_MAP_END_INHERITING(SVGFEDisplacementMapElementBase)
 
 //----------------------------------------------------------------------
 // nsIDOMNode methods
 
-NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEDisplacementMapElement)
+NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEDisplacementMapElement)
 
 //----------------------------------------------------------------------
-// nsIDOMSVGFEDisplacementMapElement methods
 
-/* readonly attribute nsIDOMSVGAnimatedString in1; */
-NS_IMETHODIMP nsSVGFEDisplacementMapElement::GetIn1(nsIDOMSVGAnimatedString * *aIn)
+already_AddRefed<nsIDOMSVGAnimatedString>
+SVGFEDisplacementMapElement::In1()
 {
-  return mStringAttributes[IN1].ToDOMAnimatedString(aIn, this);
+  return mStringAttributes[IN1].ToDOMAnimatedString(this);
 }
 
-/* readonly attribute nsIDOMSVGAnimatedString in2; */
-NS_IMETHODIMP nsSVGFEDisplacementMapElement::GetIn2(nsIDOMSVGAnimatedString * *aIn)
+already_AddRefed<nsIDOMSVGAnimatedString>
+SVGFEDisplacementMapElement::In2()
 {
-  return mStringAttributes[IN2].ToDOMAnimatedString(aIn, this);
+  return mStringAttributes[IN2].ToDOMAnimatedString(this);
 }
 
-/* readonly attribute nsIDOMSVGAnimatedNumber scale; */
-NS_IMETHODIMP nsSVGFEDisplacementMapElement::GetScale(nsIDOMSVGAnimatedNumber * *aScale)
+already_AddRefed<nsIDOMSVGAnimatedNumber>
+SVGFEDisplacementMapElement::Scale()
 {
-  return mNumberAttributes[SCALE].ToDOMAnimatedNumber(aScale, this);
+  return mNumberAttributes[SCALE].ToDOMAnimatedNumber(this);
 }
 
-/* readonly attribute nsIDOMSVGAnimatedEnumeration xChannelSelector; */
-NS_IMETHODIMP nsSVGFEDisplacementMapElement::GetXChannelSelector(nsIDOMSVGAnimatedEnumeration * *aChannel)
+already_AddRefed<nsIDOMSVGAnimatedEnumeration>
+SVGFEDisplacementMapElement::XChannelSelector()
 {
-  return mEnumAttributes[CHANNEL_X].ToDOMAnimatedEnum(aChannel, this);
+  return mEnumAttributes[CHANNEL_X].ToDOMAnimatedEnum(this);
 }
 
-/* readonly attribute nsIDOMSVGAnimatedEnumeration yChannelSelector; */
-NS_IMETHODIMP nsSVGFEDisplacementMapElement::GetYChannelSelector(nsIDOMSVGAnimatedEnumeration * *aChannel)
+already_AddRefed<nsIDOMSVGAnimatedEnumeration>
+SVGFEDisplacementMapElement::YChannelSelector()
 {
-  return mEnumAttributes[CHANNEL_Y].ToDOMAnimatedEnum(aChannel, this);
+  return mEnumAttributes[CHANNEL_Y].ToDOMAnimatedEnum(this);
 }
 
 nsresult
-nsSVGFEDisplacementMapElement::Filter(nsSVGFilterInstance *instance,
-                                      const nsTArray<const Image*>& aSources,
-                                      const Image* aTarget,
-                                      const nsIntRect& rect)
+SVGFEDisplacementMapElement::Filter(nsSVGFilterInstance* instance,
+                                    const nsTArray<const Image*>& aSources,
+                                    const Image* aTarget,
+                                    const nsIntRect& rect)
 {
   float scale = instance->GetPrimitiveNumber(SVGContentUtils::XY,
                                              &mNumberAttributes[SCALE]);
   if (scale == 0.0f) {
     CopyRect(aTarget, aSources[0], rect);
     return NS_OK;
   }
 
@@ -156,82 +166,85 @@ nsSVGFEDisplacementMapElement::Filter(ns
       *(uint32_t*)(targetData + targIndex) =
         *(uint32_t*)(data + multiplier * (sourceY * stride + 4 * sourceX));
     }
   }
   return NS_OK;
 }
 
 bool
-nsSVGFEDisplacementMapElement::AttributeAffectsRendering(int32_t aNameSpaceID,
-                                                         nsIAtom* aAttribute) const
+SVGFEDisplacementMapElement::AttributeAffectsRendering(int32_t aNameSpaceID,
+                                                       nsIAtom* aAttribute) const
 {
-  return nsSVGFEDisplacementMapElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
+  return SVGFEDisplacementMapElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
          (aNameSpaceID == kNameSpaceID_None &&
           (aAttribute == nsGkAtoms::in ||
            aAttribute == nsGkAtoms::in2 ||
            aAttribute == nsGkAtoms::scale ||
            aAttribute == nsGkAtoms::xChannelSelector ||
            aAttribute == nsGkAtoms::yChannelSelector));
 }
 
 void
-nsSVGFEDisplacementMapElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
+SVGFEDisplacementMapElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
 {
   aSources.AppendElement(nsSVGStringInfo(&mStringAttributes[IN1], this));
   aSources.AppendElement(nsSVGStringInfo(&mStringAttributes[IN2], this));
 }
 
 nsIntRect
-nsSVGFEDisplacementMapElement::ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
+SVGFEDisplacementMapElement::ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
           const nsSVGFilterInstance& aInstance)
 {
   // XXX we could do something clever here involving analysis of 'scale'
   // to figure out the maximum displacement, and then return mIn1's bounds
   // adjusted for the maximum displacement
   return GetMaxRect();
 }
 
 void
-nsSVGFEDisplacementMapElement::ComputeNeededSourceBBoxes(const nsIntRect& aTargetBBox,
+SVGFEDisplacementMapElement::ComputeNeededSourceBBoxes(const nsIntRect& aTargetBBox,
           nsTArray<nsIntRect>& aSourceBBoxes, const nsSVGFilterInstance& aInstance)
 {
   // in2 contains the displacements, which we read for each target pixel
   aSourceBBoxes[1] = aTargetBBox;
   // XXX to figure out which parts of 'in' we might read, we could
   // do some analysis of 'scale' to figure out the maximum displacement.
   // For now, just leave aSourceBBoxes[0] alone, i.e. assume we use its
   // entire output bounding box.
   // If we change this, we need to change coordinate assumptions above
 }
 
 nsIntRect
-nsSVGFEDisplacementMapElement::ComputeChangeBBox(const nsTArray<nsIntRect>& aSourceChangeBoxes,
-                                                 const nsSVGFilterInstance& aInstance)
+SVGFEDisplacementMapElement::ComputeChangeBBox(const nsTArray<nsIntRect>& aSourceChangeBoxes,
+                                               const nsSVGFilterInstance& aInstance)
 {
   // XXX we could do something clever here involving analysis of 'scale'
   // to figure out the maximum displacement
   return GetMaxRect();
 }
 
 //----------------------------------------------------------------------
 // nsSVGElement methods
 
 nsSVGElement::NumberAttributesInfo
-nsSVGFEDisplacementMapElement::GetNumberInfo()
+SVGFEDisplacementMapElement::GetNumberInfo()
 {
   return NumberAttributesInfo(mNumberAttributes, sNumberInfo,
                               ArrayLength(sNumberInfo));
 }
 
 nsSVGElement::EnumAttributesInfo
-nsSVGFEDisplacementMapElement::GetEnumInfo()
+SVGFEDisplacementMapElement::GetEnumInfo()
 {
   return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
                             ArrayLength(sEnumInfo));
 }
 
 nsSVGElement::StringAttributesInfo
-nsSVGFEDisplacementMapElement::GetStringInfo()
+SVGFEDisplacementMapElement::GetStringInfo()
 {
   return StringAttributesInfo(mStringAttributes, sStringInfo,
                               ArrayLength(sStringInfo));
 }
+
+} // namespace dom
+} // namespace mozilla
--- a/content/svg/content/src/SVGFEDisplacementMapElement.h
+++ b/content/svg/content/src/SVGFEDisplacementMapElement.h
@@ -1,76 +1,84 @@
 /* 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_SVGFEDisplacementMapElement_h
 #define mozilla_dom_SVGFEDisplacementMapElement_h
 
+#include "nsSVGEnum.h"
 #include "nsSVGFilters.h"
 
+nsresult NS_NewSVGFEDisplacementMapElement(nsIContent **aResult,
+                                           already_AddRefed<nsINodeInfo> aNodeInfo);
+
 namespace mozilla {
 namespace dom {
 
-typedef nsSVGFE nsSVGFEDisplacementMapElementBase;
+typedef nsSVGFE SVGFEDisplacementMapElementBase;
 
-class nsSVGFEDisplacementMapElement : public nsSVGFEDisplacementMapElementBase,
-                                      public nsIDOMSVGFEDisplacementMapElement
+class SVGFEDisplacementMapElement : public SVGFEDisplacementMapElementBase,
+                                    public nsIDOMSVGElement
 {
 protected:
-  friend nsresult NS_NewSVGFEDisplacementMapElement(nsIContent **aResult,
-                                                    already_AddRefed<nsINodeInfo> aNodeInfo);
-  nsSVGFEDisplacementMapElement(already_AddRefed<nsINodeInfo> aNodeInfo)
-    : nsSVGFEDisplacementMapElementBase(aNodeInfo) {}
+  friend nsresult (::NS_NewSVGFEDisplacementMapElement(nsIContent **aResult,
+                                                       already_AddRefed<nsINodeInfo> aNodeInfo));
+  SVGFEDisplacementMapElement(already_AddRefed<nsINodeInfo> aNodeInfo)
+    : SVGFEDisplacementMapElementBase(aNodeInfo)
+  {
+    SetIsDOMBinding();
+  }
+  virtual JSObject* WrapNode(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
 
 public:
   // interfaces:
   NS_DECL_ISUPPORTS_INHERITED
 
-  // FE Base
-  NS_FORWARD_NSIDOMSVGFILTERPRIMITIVESTANDARDATTRIBUTES(nsSVGFEDisplacementMapElementBase::)
-
   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);
 
-  // DisplacementMap
-  NS_DECL_NSIDOMSVGFEDISPLACEMENTMAPELEMENT
-
-  NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEDisplacementMapElementBase::)
+  NS_FORWARD_NSIDOMSVGELEMENT(SVGFEDisplacementMapElementBase::)
 
   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<nsIDOMSVGAnimatedString> In2();
+  already_AddRefed<nsIDOMSVGAnimatedNumber> Scale();
+  already_AddRefed<nsIDOMSVGAnimatedEnumeration> XChannelSelector();
+  already_AddRefed<nsIDOMSVGAnimatedEnumeration> YChannelSelector();
+
 protected:
   virtual bool OperatesOnSRGB(nsSVGFilterInstance* aInstance,
                               int32_t aInput, Image* aImage) {
     switch (aInput) {
     case 0:
       return aImage->mColorModel.mColorSpace == ColorModel::SRGB;
     case 1:
-      return nsSVGFEDisplacementMapElementBase::OperatesOnSRGB(aInstance,
-                                                               aInput, aImage);
+      return SVGFEDisplacementMapElementBase::OperatesOnSRGB(aInstance,
+                                                             aInput, aImage);
     default:
       NS_ERROR("Will not give correct output color model");
       return false;
     }
   }
   virtual bool OperatesOnPremultipledAlpha(int32_t aInput) {
     return !(aInput == 1);
   }
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -809,18 +809,16 @@ static nsDOMClassInfoData sClassInfoData
   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(SVGFEConvolveMatrixElement, nsElementSH,
                            ELEMENT_SCRIPTABLE_FLAGS)
-  NS_DEFINE_CLASSINFO_DATA(SVGFEDisplacementMapElement, nsElementSH,
-                           ELEMENT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(SVGFEMorphologyElement, nsElementSH,
                            ELEMENT_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
@@ -2230,22 +2228,16 @@ nsDOMClassInfo::Init()
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(SVGFEConvolveMatrixElement, nsIDOMSVGFEConvolveMatrixElement)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEConvolveMatrixElement)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
     DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
   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(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(SVGFETurbulenceElement, nsIDOMSVGFETurbulenceElement)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFETurbulenceElement)
--- a/dom/base/nsDOMClassInfoClasses.h
+++ b/dom/base/nsDOMClassInfoClasses.h
@@ -118,17 +118,16 @@ DOMCI_CLASS(CSSSupportsRule)
 DOMCI_CLASS(BeforeUnloadEvent)
 
 // The SVG document
 DOMCI_CLASS(SVGDocument)
 
 // SVG element classes
 DOMCI_CLASS(TimeEvent)
 DOMCI_CLASS(SVGFEConvolveMatrixElement)
-DOMCI_CLASS(SVGFEDisplacementMapElement)
 DOMCI_CLASS(SVGFEMorphologyElement)
 DOMCI_CLASS(SVGFETurbulenceElement)
 DOMCI_CLASS(SVGUnknownElement)
 
 // other SVG classes
 DOMCI_CLASS(SVGAnimatedEnumeration)
 DOMCI_CLASS(SVGAnimatedInteger)
 DOMCI_CLASS(SVGAnimatedNumber)
--- a/dom/interfaces/svg/nsIDOMSVGFilters.idl
+++ b/dom/interfaces/svg/nsIDOMSVGFilters.idl
@@ -75,25 +75,8 @@ interface nsIDOMSVGFEConvolveMatrixEleme
     readonly attribute nsIDOMSVGAnimatedNumber      bias;
     readonly attribute nsIDOMSVGAnimatedInteger     targetX;
     readonly attribute nsIDOMSVGAnimatedInteger     targetY;
     readonly attribute nsIDOMSVGAnimatedEnumeration edgeMode;
     readonly attribute nsIDOMSVGAnimatedNumber      kernelUnitLengthX;
     readonly attribute nsIDOMSVGAnimatedNumber      kernelUnitLengthY;
     readonly attribute nsISupports                  preserveAlpha;
 };
-
-[scriptable, uuid(5ab43048-d59a-4e3c-ad2f-6a5d8593f6d0)]
-interface nsIDOMSVGFEDisplacementMapElement : nsIDOMSVGFilterPrimitiveStandardAttributes
-{
-  // Channel Selectors
-  const unsigned short SVG_CHANNEL_UNKNOWN = 0;
-  const unsigned short SVG_CHANNEL_R       = 1;
-  const unsigned short SVG_CHANNEL_G       = 2;
-  const unsigned short SVG_CHANNEL_B       = 3;
-  const unsigned short SVG_CHANNEL_A       = 4;
-
-  readonly attribute nsIDOMSVGAnimatedString      in1;
-  readonly attribute nsIDOMSVGAnimatedString      in2;
-  readonly attribute nsIDOMSVGAnimatedNumber      scale;
-  readonly attribute nsIDOMSVGAnimatedEnumeration xChannelSelector;
-  readonly attribute nsIDOMSVGAnimatedEnumeration yChannelSelector;
-};
new file mode 100644
--- /dev/null
+++ b/dom/webidl/SVGFEDisplacementMapElement.webidl
@@ -0,0 +1,33 @@
+/* -*- 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 SVGAnimatedNumber;
+interface SVGAnimatedString;
+
+interface SVGFEDisplacementMapElement : SVGElement {
+
+  // Channel Selectors
+  const unsigned short SVG_CHANNEL_UNKNOWN = 0;
+  const unsigned short SVG_CHANNEL_R = 1;
+  const unsigned short SVG_CHANNEL_G = 2;
+  const unsigned short SVG_CHANNEL_B = 3;
+  const unsigned short SVG_CHANNEL_A = 4;
+
+  readonly attribute SVGAnimatedString in1;
+  readonly attribute SVGAnimatedString in2;
+  readonly attribute SVGAnimatedNumber scale;
+  readonly attribute SVGAnimatedEnumeration xChannelSelector;
+  readonly attribute SVGAnimatedEnumeration yChannelSelector;
+};
+
+SVGFEDisplacementMapElement implements SVGFilterPrimitiveStandardAttributes;
--- a/dom/webidl/WebIDL.mk
+++ b/dom/webidl/WebIDL.mk
@@ -186,16 +186,17 @@ webidl_files = \
   SVGEllipseElement.webidl \
   SVGFilterElement.webidl \
   SVGFilterPrimitiveStandardAttributes.webidl \
   SVGFEBlendElement.webidl \
   SVGFEColorMatrixElement.webidl \
   SVGFEComponentTransferElement.webidl \
   SVGFECompositeElement.webidl \
   SVGFEDiffuseLightingElement.webidl \
+  SVGFEDisplacementMapElement.webidl \
   SVGFEDistantLightElement.webidl \
   SVGFEFloodElement.webidl \
   SVGFEFuncAElement.webidl \
   SVGFEFuncBElement.webidl \
   SVGFEFuncGElement.webidl \
   SVGFEFuncRElement.webidl \
   SVGFEGaussianBlurElement.webidl \
   SVGFEImageElement.webidl \