Bug 847120: Convert SVGFEConvolveMatrixElement to WebIDL r=Ms2ger

This commit is contained in:
David Zbarsky 2013-03-23 17:00:36 -04:00
parent 3ad0201a50
commit 9b4e201807
11 changed files with 194 additions and 141 deletions

View File

@ -4,168 +4,182 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/SVGFEConvolveMatrixElement.h"
#include "mozilla/dom/SVGFEConvolveMatrixElementBinding.h"
#include "DOMSVGAnimatedNumberList.h"
#include "nsSVGUtils.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(FEConvolveMatrix)
namespace mozilla {
namespace dom {
nsSVGElement::NumberInfo nsSVGFEConvolveMatrixElement::sNumberInfo[2] =
// Edge Mode Values
static const unsigned short SVG_EDGEMODE_UNKNOWN = 0;
static const unsigned short SVG_EDGEMODE_DUPLICATE = 1;
static const unsigned short SVG_EDGEMODE_WRAP = 2;
static const unsigned short SVG_EDGEMODE_NONE = 3;
JSObject*
SVGFEConvolveMatrixElement::WrapNode(JSContext* aCx, JSObject* aScope)
{
return SVGFEConvolveMatrixElementBinding::Wrap(aCx, aScope, this);
}
nsSVGElement::NumberInfo SVGFEConvolveMatrixElement::sNumberInfo[2] =
{
{ &nsGkAtoms::divisor, 1, false },
{ &nsGkAtoms::bias, 0, false }
};
nsSVGElement::NumberPairInfo nsSVGFEConvolveMatrixElement::sNumberPairInfo[1] =
nsSVGElement::NumberPairInfo SVGFEConvolveMatrixElement::sNumberPairInfo[1] =
{
{ &nsGkAtoms::kernelUnitLength, 0, 0 }
};
nsSVGElement::IntegerInfo nsSVGFEConvolveMatrixElement::sIntegerInfo[2] =
nsSVGElement::IntegerInfo SVGFEConvolveMatrixElement::sIntegerInfo[2] =
{
{ &nsGkAtoms::targetX, 0 },
{ &nsGkAtoms::targetY, 0 }
};
nsSVGElement::IntegerPairInfo nsSVGFEConvolveMatrixElement::sIntegerPairInfo[1] =
nsSVGElement::IntegerPairInfo SVGFEConvolveMatrixElement::sIntegerPairInfo[1] =
{
{ &nsGkAtoms::order, 3, 3 }
};
nsSVGElement::BooleanInfo nsSVGFEConvolveMatrixElement::sBooleanInfo[1] =
nsSVGElement::BooleanInfo SVGFEConvolveMatrixElement::sBooleanInfo[1] =
{
{ &nsGkAtoms::preserveAlpha, false }
};
nsSVGEnumMapping nsSVGFEConvolveMatrixElement::sEdgeModeMap[] = {
{&nsGkAtoms::duplicate, nsSVGFEConvolveMatrixElement::SVG_EDGEMODE_DUPLICATE},
{&nsGkAtoms::wrap, nsSVGFEConvolveMatrixElement::SVG_EDGEMODE_WRAP},
{&nsGkAtoms::none, nsSVGFEConvolveMatrixElement::SVG_EDGEMODE_NONE},
nsSVGEnumMapping SVGFEConvolveMatrixElement::sEdgeModeMap[] = {
{&nsGkAtoms::duplicate, SVG_EDGEMODE_DUPLICATE},
{&nsGkAtoms::wrap, SVG_EDGEMODE_WRAP},
{&nsGkAtoms::none, SVG_EDGEMODE_NONE},
{nullptr, 0}
};
nsSVGElement::EnumInfo nsSVGFEConvolveMatrixElement::sEnumInfo[1] =
nsSVGElement::EnumInfo SVGFEConvolveMatrixElement::sEnumInfo[1] =
{
{ &nsGkAtoms::edgeMode,
sEdgeModeMap,
nsSVGFEConvolveMatrixElement::SVG_EDGEMODE_DUPLICATE
SVG_EDGEMODE_DUPLICATE
}
};
nsSVGElement::StringInfo nsSVGFEConvolveMatrixElement::sStringInfo[2] =
nsSVGElement::StringInfo SVGFEConvolveMatrixElement::sStringInfo[2] =
{
{ &nsGkAtoms::result, kNameSpaceID_None, true },
{ &nsGkAtoms::in, kNameSpaceID_None, true }
};
nsSVGElement::NumberListInfo nsSVGFEConvolveMatrixElement::sNumberListInfo[1] =
nsSVGElement::NumberListInfo SVGFEConvolveMatrixElement::sNumberListInfo[1] =
{
{ &nsGkAtoms::kernelMatrix }
};
NS_IMPL_NS_NEW_SVG_ELEMENT(FEConvolveMatrix)
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGFEConvolveMatrixElement,nsSVGFEConvolveMatrixElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGFEConvolveMatrixElement,nsSVGFEConvolveMatrixElementBase)
NS_IMPL_ADDREF_INHERITED(SVGFEConvolveMatrixElement,SVGFEConvolveMatrixElementBase)
NS_IMPL_RELEASE_INHERITED(SVGFEConvolveMatrixElement,SVGFEConvolveMatrixElementBase)
DOMCI_NODE_DATA(SVGFEConvolveMatrixElement, nsSVGFEConvolveMatrixElement)
NS_INTERFACE_TABLE_HEAD(nsSVGFEConvolveMatrixElement)
NS_NODE_INTERFACE_TABLE5(nsSVGFEConvolveMatrixElement, nsIDOMNode,
nsIDOMElement, nsIDOMSVGElement,
nsIDOMSVGFilterPrimitiveStandardAttributes,
nsIDOMSVGFEConvolveMatrixElement)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGFEConvolveMatrixElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGFEConvolveMatrixElementBase)
NS_INTERFACE_TABLE_HEAD(SVGFEConvolveMatrixElement)
NS_NODE_INTERFACE_TABLE3(SVGFEConvolveMatrixElement, nsIDOMNode,
nsIDOMElement, nsIDOMSVGElement)
NS_INTERFACE_MAP_END_INHERITING(SVGFEConvolveMatrixElementBase)
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEConvolveMatrixElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEConvolveMatrixElement)
//----------------------------------------------------------------------
// nsSVGFEConvolveMatrixElement methods
NS_IMETHODIMP nsSVGFEConvolveMatrixElement::GetIn1(nsIDOMSVGAnimatedString * *aIn)
already_AddRefed<nsIDOMSVGAnimatedString>
SVGFEConvolveMatrixElement::In1()
{
return mStringAttributes[IN1].ToDOMAnimatedString(aIn, this);
return mStringAttributes[IN1].ToDOMAnimatedString(this);
}
NS_IMETHODIMP nsSVGFEConvolveMatrixElement::GetOrderX(nsIDOMSVGAnimatedInteger * *aOrderX)
already_AddRefed<nsIDOMSVGAnimatedInteger>
SVGFEConvolveMatrixElement::OrderX()
{
return mIntegerPairAttributes[ORDER].ToDOMAnimatedInteger(aOrderX, nsSVGIntegerPair::eFirst, this);
return mIntegerPairAttributes[ORDER].ToDOMAnimatedInteger(nsSVGIntegerPair::eFirst, this);
}
NS_IMETHODIMP nsSVGFEConvolveMatrixElement::GetOrderY(nsIDOMSVGAnimatedInteger * *aOrderY)
already_AddRefed<nsIDOMSVGAnimatedInteger>
SVGFEConvolveMatrixElement::OrderY()
{
return mIntegerPairAttributes[ORDER].ToDOMAnimatedInteger(aOrderY, nsSVGIntegerPair::eSecond, this);
return mIntegerPairAttributes[ORDER].ToDOMAnimatedInteger(nsSVGIntegerPair::eSecond, this);
}
NS_IMETHODIMP nsSVGFEConvolveMatrixElement::GetKernelMatrix(nsISupports * *aKernelMatrix)
already_AddRefed<DOMSVGAnimatedNumberList>
SVGFEConvolveMatrixElement::KernelMatrix()
{
*aKernelMatrix = DOMSVGAnimatedNumberList::GetDOMWrapper(&mNumberListAttributes[KERNELMATRIX],
this, KERNELMATRIX).get();
return NS_OK;
return DOMSVGAnimatedNumberList::GetDOMWrapper(&mNumberListAttributes[KERNELMATRIX],
this, KERNELMATRIX);
}
NS_IMETHODIMP nsSVGFEConvolveMatrixElement::GetTargetX(nsIDOMSVGAnimatedInteger * *aTargetX)
already_AddRefed<nsIDOMSVGAnimatedInteger>
SVGFEConvolveMatrixElement::TargetX()
{
return mIntegerAttributes[TARGET_X].ToDOMAnimatedInteger(aTargetX, this);
return mIntegerAttributes[TARGET_X].ToDOMAnimatedInteger(this);
}
NS_IMETHODIMP nsSVGFEConvolveMatrixElement::GetTargetY(nsIDOMSVGAnimatedInteger * *aTargetY)
already_AddRefed<nsIDOMSVGAnimatedInteger>
SVGFEConvolveMatrixElement::TargetY()
{
return mIntegerAttributes[TARGET_Y].ToDOMAnimatedInteger(aTargetY, this);
return mIntegerAttributes[TARGET_Y].ToDOMAnimatedInteger(this);
}
NS_IMETHODIMP nsSVGFEConvolveMatrixElement::GetEdgeMode(nsIDOMSVGAnimatedEnumeration * *aEdgeMode)
already_AddRefed<nsIDOMSVGAnimatedEnumeration>
SVGFEConvolveMatrixElement::EdgeMode()
{
return mEnumAttributes[EDGEMODE].ToDOMAnimatedEnum(aEdgeMode, this);
return mEnumAttributes[EDGEMODE].ToDOMAnimatedEnum(this);
}
NS_IMETHODIMP nsSVGFEConvolveMatrixElement::GetPreserveAlpha(nsISupports * *aPreserveAlpha)
already_AddRefed<SVGAnimatedBoolean>
SVGFEConvolveMatrixElement::PreserveAlpha()
{
return mBooleanAttributes[PRESERVEALPHA].ToDOMAnimatedBoolean(aPreserveAlpha, this);
return mBooleanAttributes[PRESERVEALPHA].ToDOMAnimatedBoolean(this);
}
NS_IMETHODIMP
nsSVGFEConvolveMatrixElement::GetDivisor(nsIDOMSVGAnimatedNumber **aDivisor)
already_AddRefed<nsIDOMSVGAnimatedNumber>
SVGFEConvolveMatrixElement::Divisor()
{
return mNumberAttributes[DIVISOR].ToDOMAnimatedNumber(aDivisor, this);
return mNumberAttributes[DIVISOR].ToDOMAnimatedNumber(this);
}
NS_IMETHODIMP
nsSVGFEConvolveMatrixElement::GetBias(nsIDOMSVGAnimatedNumber **aBias)
already_AddRefed<nsIDOMSVGAnimatedNumber>
SVGFEConvolveMatrixElement::Bias()
{
return mNumberAttributes[BIAS].ToDOMAnimatedNumber(aBias, this);
return mNumberAttributes[BIAS].ToDOMAnimatedNumber(this);
}
NS_IMETHODIMP
nsSVGFEConvolveMatrixElement::GetKernelUnitLengthX(nsIDOMSVGAnimatedNumber **aKernelX)
already_AddRefed<nsIDOMSVGAnimatedNumber>
SVGFEConvolveMatrixElement::KernelUnitLengthX()
{
return mNumberPairAttributes[KERNEL_UNIT_LENGTH].ToDOMAnimatedNumber(aKernelX,
nsSVGNumberPair::eFirst,
return mNumberPairAttributes[KERNEL_UNIT_LENGTH].ToDOMAnimatedNumber(nsSVGNumberPair::eFirst,
this);
}
NS_IMETHODIMP
nsSVGFEConvolveMatrixElement::GetKernelUnitLengthY(nsIDOMSVGAnimatedNumber **aKernelY)
already_AddRefed<nsIDOMSVGAnimatedNumber>
SVGFEConvolveMatrixElement::KernelUnitLengthY()
{
return mNumberPairAttributes[KERNEL_UNIT_LENGTH].ToDOMAnimatedNumber(aKernelY,
nsSVGNumberPair::eSecond,
return mNumberPairAttributes[KERNEL_UNIT_LENGTH].ToDOMAnimatedNumber(nsSVGNumberPair::eSecond,
this);
}
void
nsSVGFEConvolveMatrixElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
SVGFEConvolveMatrixElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
{
aSources.AppendElement(nsSVGStringInfo(&mStringAttributes[IN1], this));
}
nsIntRect
nsSVGFEConvolveMatrixElement::ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
SVGFEConvolveMatrixElement::ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
const nsSVGFilterInstance& aInstance)
{
// XXX A more precise box is possible when 'bias' is zero and 'edgeMode' is
@ -175,7 +189,7 @@ nsSVGFEConvolveMatrixElement::ComputeTargetBBox(const nsTArray<nsIntRect>& aSour
}
void
nsSVGFEConvolveMatrixElement::ComputeNeededSourceBBoxes(const nsIntRect& aTargetBBox,
SVGFEConvolveMatrixElement::ComputeNeededSourceBBoxes(const nsIntRect& aTargetBBox,
nsTArray<nsIntRect>& aSourceBBoxes, const nsSVGFilterInstance& aInstance)
{
// XXX Precise results are possible but we're going to skip that work
@ -184,8 +198,8 @@ nsSVGFEConvolveMatrixElement::ComputeNeededSourceBBoxes(const nsIntRect& aTarget
}
nsIntRect
nsSVGFEConvolveMatrixElement::ComputeChangeBBox(const nsTArray<nsIntRect>& aSourceChangeBoxes,
const nsSVGFilterInstance& aInstance)
SVGFEConvolveMatrixElement::ComputeChangeBBox(const nsTArray<nsIntRect>& aSourceChangeBoxes,
const nsSVGFilterInstance& aInstance)
{
// XXX Precise results are possible but we're going to skip that work
// for now.
@ -234,13 +248,13 @@ ConvolvePixel(const uint8_t *aSourceData,
for (int32_t i = 0; i < channels; i++) {
if (overscanY || overscanX) {
switch (aEdgeMode) {
case nsSVGFEConvolveMatrixElement::SVG_EDGEMODE_DUPLICATE:
case SVG_EDGEMODE_DUPLICATE:
sum[i] +=
aSourceData[BoundInterval(sampleY, aHeight) * aStride +
BoundInterval(sampleX, aWidth) * 4 + offsets[i]] *
aKernel[aOrderX * y + x];
break;
case nsSVGFEConvolveMatrixElement::SVG_EDGEMODE_WRAP:
case SVG_EDGEMODE_WRAP:
sum[i] +=
aSourceData[WrapInterval(sampleY, aHeight) * aStride +
WrapInterval(sampleX, aWidth) * 4 + offsets[i]] *
@ -268,10 +282,10 @@ ConvolvePixel(const uint8_t *aSourceData,
}
nsresult
nsSVGFEConvolveMatrixElement::Filter(nsSVGFilterInstance *instance,
const nsTArray<const Image*>& aSources,
const Image* aTarget,
const nsIntRect& rect)
SVGFEConvolveMatrixElement::Filter(nsSVGFilterInstance* instance,
const nsTArray<const Image*>& aSources,
const Image* aTarget,
const nsIntRect& rect)
{
const SVGNumberList &kernelMatrix =
mNumberListAttributes[KERNELMATRIX].GetAnimValue();
@ -357,10 +371,10 @@ nsSVGFEConvolveMatrixElement::Filter(nsSVGFilterInstance *instance,
}
bool
nsSVGFEConvolveMatrixElement::AttributeAffectsRendering(int32_t aNameSpaceID,
nsIAtom* aAttribute) const
SVGFEConvolveMatrixElement::AttributeAffectsRendering(int32_t aNameSpaceID,
nsIAtom* aAttribute) const
{
return nsSVGFEConvolveMatrixElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
return SVGFEConvolveMatrixElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
(aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::in ||
aAttribute == nsGkAtoms::divisor ||
@ -378,56 +392,56 @@ nsSVGFEConvolveMatrixElement::AttributeAffectsRendering(int32_t aNameSpaceID,
// nsSVGElement methods
nsSVGElement::NumberAttributesInfo
nsSVGFEConvolveMatrixElement::GetNumberInfo()
SVGFEConvolveMatrixElement::GetNumberInfo()
{
return NumberAttributesInfo(mNumberAttributes, sNumberInfo,
ArrayLength(sNumberInfo));
}
nsSVGElement::NumberPairAttributesInfo
nsSVGFEConvolveMatrixElement::GetNumberPairInfo()
SVGFEConvolveMatrixElement::GetNumberPairInfo()
{
return NumberPairAttributesInfo(mNumberPairAttributes, sNumberPairInfo,
ArrayLength(sNumberPairInfo));
}
nsSVGElement::IntegerAttributesInfo
nsSVGFEConvolveMatrixElement::GetIntegerInfo()
SVGFEConvolveMatrixElement::GetIntegerInfo()
{
return IntegerAttributesInfo(mIntegerAttributes, sIntegerInfo,
ArrayLength(sIntegerInfo));
}
nsSVGElement::IntegerPairAttributesInfo
nsSVGFEConvolveMatrixElement::GetIntegerPairInfo()
SVGFEConvolveMatrixElement::GetIntegerPairInfo()
{
return IntegerPairAttributesInfo(mIntegerPairAttributes, sIntegerPairInfo,
ArrayLength(sIntegerPairInfo));
}
nsSVGElement::BooleanAttributesInfo
nsSVGFEConvolveMatrixElement::GetBooleanInfo()
SVGFEConvolveMatrixElement::GetBooleanInfo()
{
return BooleanAttributesInfo(mBooleanAttributes, sBooleanInfo,
ArrayLength(sBooleanInfo));
}
nsSVGElement::EnumAttributesInfo
nsSVGFEConvolveMatrixElement::GetEnumInfo()
SVGFEConvolveMatrixElement::GetEnumInfo()
{
return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
ArrayLength(sEnumInfo));
}
nsSVGElement::StringAttributesInfo
nsSVGFEConvolveMatrixElement::GetStringInfo()
SVGFEConvolveMatrixElement::GetStringInfo()
{
return StringAttributesInfo(mStringAttributes, sStringInfo,
ArrayLength(sStringInfo));
}
nsSVGElement::NumberListAttributesInfo
nsSVGFEConvolveMatrixElement::GetNumberListInfo()
SVGFEConvolveMatrixElement::GetNumberListInfo()
{
return NumberListAttributesInfo(mNumberListAttributes, sNumberListInfo,
ArrayLength(sNumberListInfo));

View File

@ -6,29 +6,43 @@
#ifndef mozilla_dom_SVGFEConvolveMatrixElement_h
#define mozilla_dom_SVGFEConvolveMatrixElement_h
#include "nsSVGBoolean.h"
#include "nsSVGEnum.h"
#include "nsSVGFilters.h"
#include "nsSVGInteger.h"
#include "nsSVGIntegerPair.h"
#include "nsSVGNumber2.h"
#include "nsSVGString.h"
#include "SVGAnimatedNumberList.h"
nsresult NS_NewSVGFEConvolveMatrixElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo);
namespace mozilla {
class DOMSVGAnimatedNumberList;
namespace dom {
class SVGAnimatedBoolean;
typedef nsSVGFE nsSVGFEConvolveMatrixElementBase;
typedef nsSVGFE SVGFEConvolveMatrixElementBase;
class nsSVGFEConvolveMatrixElement : public nsSVGFEConvolveMatrixElementBase,
public nsIDOMSVGFEConvolveMatrixElement
class SVGFEConvolveMatrixElement : public SVGFEConvolveMatrixElementBase,
public nsIDOMSVGElement
{
friend nsresult NS_NewSVGFEConvolveMatrixElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo);
friend nsresult (::NS_NewSVGFEConvolveMatrixElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo));
protected:
nsSVGFEConvolveMatrixElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsSVGFEConvolveMatrixElementBase(aNodeInfo) {}
SVGFEConvolveMatrixElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: SVGFEConvolveMatrixElementBase(aNodeInfo)
{
SetIsDOMBinding();
}
virtual JSObject* WrapNode(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
// FE Base
NS_FORWARD_NSIDOMSVGFILTERPRIMITIVESTANDARDATTRIBUTES(nsSVGFEConvolveMatrixElementBase::)
virtual nsresult Filter(nsSVGFilterInstance* aInstance,
const nsTArray<const Image*>& aSources,
const Image* aTarget,
@ -44,19 +58,29 @@ public:
virtual nsIntRect ComputeChangeBBox(const nsTArray<nsIntRect>& aSourceChangeBoxes,
const nsSVGFilterInstance& aInstance);
// Color Matrix
NS_DECL_NSIDOMSVGFECONVOLVEMATRIXELEMENT
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEConvolveMatrixElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(SVGFEConvolveMatrixElementBase::)
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; }
// WebIDL
already_AddRefed<nsIDOMSVGAnimatedString> In1();
already_AddRefed<nsIDOMSVGAnimatedInteger> OrderX();
already_AddRefed<nsIDOMSVGAnimatedInteger> OrderY();
already_AddRefed<DOMSVGAnimatedNumberList> KernelMatrix();
already_AddRefed<nsIDOMSVGAnimatedInteger> TargetX();
already_AddRefed<nsIDOMSVGAnimatedInteger> TargetY();
already_AddRefed<nsIDOMSVGAnimatedEnumeration> EdgeMode();
already_AddRefed<SVGAnimatedBoolean> PreserveAlpha();
already_AddRefed<nsIDOMSVGAnimatedNumber> Divisor();
already_AddRefed<nsIDOMSVGAnimatedNumber> Bias();
already_AddRefed<nsIDOMSVGAnimatedNumber> KernelUnitLengthX();
already_AddRefed<nsIDOMSVGAnimatedNumber> KernelUnitLengthY();
protected:
virtual bool OperatesOnPremultipledAlpha(int32_t) {
return !mBooleanAttributes[PRESERVEALPHA].GetAnimValue();

View File

@ -104,9 +104,8 @@ nsSVGBoolean::SetAnimValue(bool aValue, nsSVGElement *aSVGElement)
aSVGElement->DidAnimateBoolean(mAttrEnum);
}
nsresult
nsSVGBoolean::ToDOMAnimatedBoolean(nsISupports **aResult,
nsSVGElement *aSVGElement)
already_AddRefed<SVGAnimatedBoolean>
nsSVGBoolean::ToDOMAnimatedBoolean(nsSVGElement* aSVGElement)
{
nsRefPtr<SVGAnimatedBoolean> domAnimatedBoolean =
sSVGAnimatedBooleanTearoffTable.GetTearoff(this);
@ -115,8 +114,7 @@ nsSVGBoolean::ToDOMAnimatedBoolean(nsISupports **aResult,
sSVGAnimatedBooleanTearoffTable.AddTearoff(this, domAnimatedBoolean);
}
domAnimatedBoolean.forget(aResult);
return NS_OK;
return domAnimatedBoolean.forget();
}
SVGAnimatedBoolean::~SVGAnimatedBoolean()

View File

@ -6,6 +6,7 @@
#ifndef __NS_SVGBOOLEAN_H__
#define __NS_SVGBOOLEAN_H__
#include "nsCOMPtr.h"
#include "nsError.h"
#include "nsISMILAttr.h"
#include "mozilla/Attributes.h"
@ -18,6 +19,7 @@ class nsSVGElement;
namespace mozilla {
namespace dom {
class SVGAnimationElement;
class SVGAnimatedBoolean;
}
}
@ -42,8 +44,8 @@ public:
bool GetAnimValue() const
{ return mAnimVal; }
nsresult ToDOMAnimatedBoolean(nsISupports **aResult,
nsSVGElement* aSVGElement);
already_AddRefed<mozilla::dom::SVGAnimatedBoolean>
ToDOMAnimatedBoolean(nsSVGElement* aSVGElement);
// Returns a new nsISMILAttr object that the caller must delete
nsISMILAttr* ToSMILAttr(nsSVGElement* aSVGElement);

View File

@ -115,6 +115,13 @@ nsSVGInteger::SetAnimValue(int aValue, nsSVGElement *aSVGElement)
nsresult
nsSVGInteger::ToDOMAnimatedInteger(nsIDOMSVGAnimatedInteger **aResult,
nsSVGElement *aSVGElement)
{
*aResult = ToDOMAnimatedInteger(aSVGElement).get();
return NS_OK;
}
already_AddRefed<nsIDOMSVGAnimatedInteger>
nsSVGInteger::ToDOMAnimatedInteger(nsSVGElement *aSVGElement)
{
nsRefPtr<DOMAnimatedInteger> domAnimatedInteger =
sSVGAnimatedIntegerTearoffTable.GetTearoff(this);
@ -123,8 +130,7 @@ nsSVGInteger::ToDOMAnimatedInteger(nsIDOMSVGAnimatedInteger **aResult,
sSVGAnimatedIntegerTearoffTable.AddTearoff(this, domAnimatedInteger);
}
domAnimatedInteger.forget(aResult);
return NS_OK;
return domAnimatedInteger.forget();
}
nsSVGInteger::DOMAnimatedInteger::~DOMAnimatedInteger()

View File

@ -52,7 +52,9 @@ public:
// useable, and represents the default base value of the attribute.
bool IsExplicitlySet() const
{ return mIsAnimated || mIsBaseSet; }
already_AddRefed<nsIDOMSVGAnimatedInteger>
ToDOMAnimatedInteger(nsSVGElement* aSVGElement);
nsresult ToDOMAnimatedInteger(nsIDOMSVGAnimatedInteger **aResult,
nsSVGElement* aSVGElement);
// Returns a new nsISMILAttr object that the caller must delete

View File

@ -812,8 +812,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
// 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(SVGFEMorphologyElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFETurbulenceElement, nsElementSH,
@ -2227,12 +2225,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_EVENT_MAP_ENTRIES
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(SVGFEMorphologyElement, nsIDOMSVGFEMorphologyElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEMorphologyElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)

View File

@ -122,7 +122,6 @@ DOMCI_CLASS(SVGDocument)
// SVG element classes
DOMCI_CLASS(TimeEvent)
DOMCI_CLASS(SVGFEConvolveMatrixElement)
DOMCI_CLASS(SVGFEMorphologyElement)
DOMCI_CLASS(SVGFETurbulenceElement)
DOMCI_CLASS(SVGUnknownElement)

View File

@ -56,27 +56,3 @@ interface nsIDOMSVGFEMorphologyElement : nsIDOMSVGFilterPrimitiveStandardAttribu
void setRadius ( in float rx, in float ry );
};
[scriptable, uuid(7d49f132-5145-4b47-896a-ac5f9e6b6941)]
interface nsIDOMSVGFEConvolveMatrixElement : nsIDOMSVGFilterPrimitiveStandardAttributes
{
// Edge Mode Values
const unsigned short SVG_EDGEMODE_UNKNOWN = 0;
const unsigned short SVG_EDGEMODE_DUPLICATE = 1;
const unsigned short SVG_EDGEMODE_WRAP = 2;
const unsigned short SVG_EDGEMODE_NONE = 3;
readonly attribute nsIDOMSVGAnimatedString in1;
readonly attribute nsIDOMSVGAnimatedInteger orderX;
readonly attribute nsIDOMSVGAnimatedInteger orderY;
// SVGAnimatedNumberList
readonly attribute nsISupports kernelMatrix;
readonly attribute nsIDOMSVGAnimatedNumber divisor;
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;
};

View File

@ -0,0 +1,39 @@
/* -*- 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 SVGFEConvolveMatrixElement : SVGElement {
// Edge Mode Values
const unsigned short SVG_EDGEMODE_UNKNOWN = 0;
const unsigned short SVG_EDGEMODE_DUPLICATE = 1;
const unsigned short SVG_EDGEMODE_WRAP = 2;
const unsigned short SVG_EDGEMODE_NONE = 3;
readonly attribute SVGAnimatedString in1;
readonly attribute SVGAnimatedInteger orderX;
readonly attribute SVGAnimatedInteger orderY;
readonly attribute SVGAnimatedNumberList kernelMatrix;
readonly attribute SVGAnimatedNumber divisor;
readonly attribute SVGAnimatedNumber bias;
readonly attribute SVGAnimatedInteger targetX;
readonly attribute SVGAnimatedInteger targetY;
readonly attribute SVGAnimatedEnumeration edgeMode;
readonly attribute SVGAnimatedNumber kernelUnitLengthX;
readonly attribute SVGAnimatedNumber kernelUnitLengthY;
readonly attribute SVGAnimatedBoolean preserveAlpha;
};
SVGFEConvolveMatrixElement implements SVGFilterPrimitiveStandardAttributes;

View File

@ -190,6 +190,7 @@ webidl_files = \
SVGFEColorMatrixElement.webidl \
SVGFEComponentTransferElement.webidl \
SVGFECompositeElement.webidl \
SVGFEConvolveMatrixElement.webidl \
SVGFEDiffuseLightingElement.webidl \
SVGFEDisplacementMapElement.webidl \
SVGFEDistantLightElement.webidl \