Bug 832155: Convert SVGFEDistantLightElement to WebIDL r=Ms2ger

This commit is contained in:
David Zbarsky 2013-03-15 03:01:38 -04:00
parent ee4f45a3aa
commit 91d2d6293e
7 changed files with 86 additions and 51 deletions

View File

@ -4,10 +4,20 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/SVGFEDistantLightElement.h"
#include "mozilla/dom/SVGFEDistantLightElementBinding.h"
NS_IMPL_NS_NEW_SVG_ELEMENT(FEDistantLight)
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(FEDistantLight)
nsSVGElement::NumberInfo nsSVGFEDistantLightElement::sNumberInfo[2] =
namespace mozilla {
namespace dom {
JSObject*
SVGFEDistantLightElement::WrapNode(JSContext* aCx, JSObject* aScope)
{
return SVGFEDistantLightElementBinding::Wrap(aCx, aScope, this);
}
nsSVGElement::NumberInfo SVGFEDistantLightElement::sNumberInfo[2] =
{
{ &nsGkAtoms::azimuth, 0, false },
{ &nsGkAtoms::elevation, 0, false }
@ -16,48 +26,52 @@ nsSVGElement::NumberInfo nsSVGFEDistantLightElement::sNumberInfo[2] =
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGFEDistantLightElement,nsSVGFEDistantLightElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGFEDistantLightElement,nsSVGFEDistantLightElementBase)
NS_IMPL_ADDREF_INHERITED(SVGFEDistantLightElement,SVGFEDistantLightElementBase)
NS_IMPL_RELEASE_INHERITED(SVGFEDistantLightElement,SVGFEDistantLightElementBase)
DOMCI_NODE_DATA(SVGFEDistantLightElement, nsSVGFEDistantLightElement)
NS_INTERFACE_TABLE_HEAD(nsSVGFEDistantLightElement)
NS_NODE_INTERFACE_TABLE4(nsSVGFEDistantLightElement, nsIDOMNode,
nsIDOMElement, nsIDOMSVGElement,
nsIDOMSVGFEDistantLightElement)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGFEDistantLightElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGFEDistantLightElementBase)
NS_INTERFACE_TABLE_HEAD(SVGFEDistantLightElement)
NS_NODE_INTERFACE_TABLE3(SVGFEDistantLightElement, nsIDOMNode,
nsIDOMElement, nsIDOMSVGElement)
NS_INTERFACE_MAP_END_INHERITING(SVGFEDistantLightElementBase)
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEDistantLightElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEDistantLightElement)
//----------------------------------------------------------------------
// nsFEUnstyledElement methods
bool
nsSVGFEDistantLightElement::AttributeAffectsRendering(int32_t aNameSpaceID,
nsIAtom* aAttribute) const
SVGFEDistantLightElement::AttributeAffectsRendering(int32_t aNameSpaceID,
nsIAtom* aAttribute) const
{
return aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::azimuth ||
aAttribute == nsGkAtoms::elevation);
}
already_AddRefed<nsIDOMSVGAnimatedNumber>
SVGFEDistantLightElement::Azimuth()
{
return mNumberAttributes[AZIMUTH].ToDOMAnimatedNumber(this);
}
already_AddRefed<nsIDOMSVGAnimatedNumber>
SVGFEDistantLightElement::Elevation()
{
return mNumberAttributes[ELEVATION].ToDOMAnimatedNumber(this);
}
//----------------------------------------------------------------------
// nsIDOMSVGFEDistantLightElement methods
// nsSVGElement methods
NS_IMETHODIMP
nsSVGFEDistantLightElement::GetAzimuth(nsIDOMSVGAnimatedNumber **aAzimuth)
nsSVGElement::NumberAttributesInfo
SVGFEDistantLightElement::GetNumberInfo()
{
return mNumberAttributes[AZIMUTH].ToDOMAnimatedNumber(aAzimuth,
this);
return NumberAttributesInfo(mNumberAttributes, sNumberInfo,
ArrayLength(sNumberInfo));
}
NS_IMETHODIMP
nsSVGFEDistantLightElement::GetElevation(nsIDOMSVGAnimatedNumber **aElevation)
{
return mNumberAttributes[ELEVATION].ToDOMAnimatedNumber(aElevation,
this);
}
} // namespace dom
} // namespace mozilla

View File

@ -7,24 +7,34 @@
#define mozilla_dom_SVGFEDistantLightElement_h
#include "nsSVGFilters.h"
#include "nsSVGNumber2.h"
typedef SVGFEUnstyledElement nsSVGFEDistantLightElementBase;
typedef SVGFEUnstyledElement SVGFEDistantLightElementBase;
class nsSVGFEDistantLightElement : public nsSVGFEDistantLightElementBase,
public nsIDOMSVGFEDistantLightElement
nsresult NS_NewSVGFEDistantLightElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo);
namespace mozilla {
namespace dom {
class SVGFEDistantLightElement : public SVGFEDistantLightElementBase,
public nsIDOMSVGElement
{
friend nsresult NS_NewSVGFEDistantLightElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo);
friend nsresult (::NS_NewSVGFEDistantLightElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo));
protected:
nsSVGFEDistantLightElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsSVGFEDistantLightElementBase(aNodeInfo) {}
SVGFEDistantLightElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: SVGFEDistantLightElementBase(aNodeInfo)
{
SetIsDOMBinding();
}
virtual JSObject* WrapNode(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGFEDISTANTLIGHTELEMENT
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEDistantLightElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(SVGFEDistantLightElementBase::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
@ -33,9 +43,12 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
// WebIDL
already_AddRefed<nsIDOMSVGAnimatedNumber> Azimuth();
already_AddRefed<nsIDOMSVGAnimatedNumber> Elevation();
protected:
virtual NumberAttributesInfo GetNumberInfo();
@ -44,4 +57,7 @@ protected:
static NumberInfo sNumberInfo[2];
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_SVGFEDistantLightElement_h

View File

@ -828,8 +828,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFEDisplacementMapElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFEDistantLightElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFEGaussianBlurElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFEMorphologyElement, nsElementSH,
@ -2296,11 +2294,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGFEDistantLightElement, nsIDOMSVGFEDistantLightElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEDistantLightElement)
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)

View File

@ -128,7 +128,6 @@ DOMCI_CLASS(SVGFECompositeElement)
DOMCI_CLASS(SVGFEConvolveMatrixElement)
DOMCI_CLASS(SVGFEDiffuseLightingElement)
DOMCI_CLASS(SVGFEDisplacementMapElement)
DOMCI_CLASS(SVGFEDistantLightElement)
DOMCI_CLASS(SVGFEGaussianBlurElement)
DOMCI_CLASS(SVGFEMorphologyElement)
DOMCI_CLASS(SVGFEOffsetElement)

View File

@ -206,12 +206,6 @@ interface nsIDOMSVGFESpecularLightingElement : nsIDOMSVGFilterPrimitiveStandardA
readonly attribute nsIDOMSVGAnimatedNumber kernelUnitLengthY;
};
[scriptable, uuid(3265edba-d5b0-4c24-ad89-d6b6c85655bf)]
interface nsIDOMSVGFEDistantLightElement : nsIDOMSVGElement {
readonly attribute nsIDOMSVGAnimatedNumber azimuth;
readonly attribute nsIDOMSVGAnimatedNumber elevation;
};
[scriptable, uuid(e9bd8308-dc52-438b-a315-a0d545dfeda3)]
interface nsIDOMSVGFESpotLightElement : nsIDOMSVGElement {
readonly attribute nsIDOMSVGAnimatedNumber x;

View File

@ -0,0 +1,18 @@
/* -*- 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 SVGFEDistantLightElement : SVGElement {
readonly attribute SVGAnimatedNumber azimuth;
readonly attribute SVGAnimatedNumber elevation;
};

View File

@ -168,6 +168,7 @@ webidl_files = \
SVGFilterElement.webidl \
SVGFilterPrimitiveStandardAttributes.webidl \
SVGFEBlendElement.webidl \
SVGFEDistantLightElement.webidl \
SVGFEFloodElement.webidl \
SVGFEFuncAElement.webidl \
SVGFEFuncBElement.webidl \