зеркало из https://github.com/mozilla/gecko-dev.git
Bug 853692: Convert SVGFESpotLightElement to WebIDL r=Ms2ger
This commit is contained in:
Родитель
cd95659ab1
Коммит
7c03a639ff
|
@ -4,13 +4,20 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/SVGFESpotLightElement.h"
|
||||
#include "mozilla/dom/SVGFESpotLightElementBinding.h"
|
||||
|
||||
NS_IMPL_NS_NEW_SVG_ELEMENT(FESpotLight)
|
||||
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(FESpotLight)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
nsSVGElement::NumberInfo nsSVGFESpotLightElement::sNumberInfo[8] =
|
||||
JSObject*
|
||||
SVGFESpotLightElement::WrapNode(JSContext* aCx, JSObject* aScope)
|
||||
{
|
||||
return SVGFESpotLightElementBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
nsSVGElement::NumberInfo SVGFESpotLightElement::sNumberInfo[8] =
|
||||
{
|
||||
{ &nsGkAtoms::x, 0, false },
|
||||
{ &nsGkAtoms::y, 0, false },
|
||||
|
@ -25,29 +32,25 @@ nsSVGElement::NumberInfo nsSVGFESpotLightElement::sNumberInfo[8] =
|
|||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsSVGFESpotLightElement,nsSVGFESpotLightElementBase)
|
||||
NS_IMPL_RELEASE_INHERITED(nsSVGFESpotLightElement,nsSVGFESpotLightElementBase)
|
||||
NS_IMPL_ADDREF_INHERITED(SVGFESpotLightElement,SVGFESpotLightElementBase)
|
||||
NS_IMPL_RELEASE_INHERITED(SVGFESpotLightElement,SVGFESpotLightElementBase)
|
||||
|
||||
DOMCI_NODE_DATA(SVGFESpotLightElement, nsSVGFESpotLightElement)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(nsSVGFESpotLightElement)
|
||||
NS_NODE_INTERFACE_TABLE4(nsSVGFESpotLightElement, nsIDOMNode,
|
||||
nsIDOMElement, nsIDOMSVGElement,
|
||||
nsIDOMSVGFESpotLightElement)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGFESpotLightElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsSVGFESpotLightElementBase)
|
||||
NS_INTERFACE_TABLE_HEAD(SVGFESpotLightElement)
|
||||
NS_NODE_INTERFACE_TABLE3(SVGFESpotLightElement, nsIDOMNode,
|
||||
nsIDOMElement, nsIDOMSVGElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(SVGFESpotLightElementBase)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode methods
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFESpotLightElement)
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFESpotLightElement)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsFEUnstyledElement methods
|
||||
|
||||
bool
|
||||
nsSVGFESpotLightElement::AttributeAffectsRendering(int32_t aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
SVGFESpotLightElement::AttributeAffectsRendering(int32_t aNameSpaceID,
|
||||
nsIAtom* aAttribute) const
|
||||
{
|
||||
return aNameSpaceID == kNameSpaceID_None &&
|
||||
(aAttribute == nsGkAtoms::x ||
|
||||
|
@ -61,63 +64,60 @@ nsSVGFESpotLightElement::AttributeAffectsRendering(int32_t aNameSpaceID,
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGFESpotLightElement methods
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGFESpotLightElement::GetX(nsIDOMSVGAnimatedNumber **aX)
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber>
|
||||
SVGFESpotLightElement::X()
|
||||
{
|
||||
return mNumberAttributes[X].ToDOMAnimatedNumber(aX, this);
|
||||
return mNumberAttributes[ATTR_X].ToDOMAnimatedNumber(this);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGFESpotLightElement::GetY(nsIDOMSVGAnimatedNumber **aY)
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber>
|
||||
SVGFESpotLightElement::Y()
|
||||
{
|
||||
return mNumberAttributes[Y].ToDOMAnimatedNumber(aY, this);
|
||||
return mNumberAttributes[ATTR_Y].ToDOMAnimatedNumber(this);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGFESpotLightElement::GetZ(nsIDOMSVGAnimatedNumber **aZ)
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber>
|
||||
SVGFESpotLightElement::Z()
|
||||
{
|
||||
return mNumberAttributes[Z].ToDOMAnimatedNumber(aZ, this);
|
||||
return mNumberAttributes[ATTR_Z].ToDOMAnimatedNumber(this);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGFESpotLightElement::GetPointsAtX(nsIDOMSVGAnimatedNumber **aX)
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber>
|
||||
SVGFESpotLightElement::PointsAtX()
|
||||
{
|
||||
return mNumberAttributes[POINTS_AT_X].ToDOMAnimatedNumber(aX, this);
|
||||
return mNumberAttributes[POINTS_AT_X].ToDOMAnimatedNumber(this);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGFESpotLightElement::GetPointsAtY(nsIDOMSVGAnimatedNumber **aY)
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber>
|
||||
SVGFESpotLightElement::PointsAtY()
|
||||
{
|
||||
return mNumberAttributes[POINTS_AT_Y].ToDOMAnimatedNumber(aY, this);
|
||||
return mNumberAttributes[POINTS_AT_Y].ToDOMAnimatedNumber(this);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGFESpotLightElement::GetPointsAtZ(nsIDOMSVGAnimatedNumber **aZ)
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber>
|
||||
SVGFESpotLightElement::PointsAtZ()
|
||||
{
|
||||
return mNumberAttributes[POINTS_AT_Z].ToDOMAnimatedNumber(aZ, this);
|
||||
return mNumberAttributes[POINTS_AT_Z].ToDOMAnimatedNumber(this);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGFESpotLightElement::GetSpecularExponent(nsIDOMSVGAnimatedNumber **aExponent)
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber>
|
||||
SVGFESpotLightElement::SpecularExponent()
|
||||
{
|
||||
return mNumberAttributes[SPECULAR_EXPONENT].ToDOMAnimatedNumber(aExponent,
|
||||
this);
|
||||
return mNumberAttributes[SPECULAR_EXPONENT].ToDOMAnimatedNumber(this);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGFESpotLightElement::GetLimitingConeAngle(nsIDOMSVGAnimatedNumber **aAngle)
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber>
|
||||
SVGFESpotLightElement::LimitingConeAngle()
|
||||
{
|
||||
return mNumberAttributes[LIMITING_CONE_ANGLE].ToDOMAnimatedNumber(aAngle,
|
||||
this);
|
||||
return mNumberAttributes[LIMITING_CONE_ANGLE].ToDOMAnimatedNumber(this);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
nsSVGElement::NumberAttributesInfo
|
||||
nsSVGFESpotLightElement::GetNumberInfo()
|
||||
SVGFESpotLightElement::GetNumberInfo()
|
||||
{
|
||||
return NumberAttributesInfo(mNumberAttributes, sNumberInfo,
|
||||
ArrayLength(sNumberInfo));
|
||||
|
|
|
@ -6,27 +6,38 @@
|
|||
#ifndef mozilla_dom_SVGFESpotLightElement_h
|
||||
#define mozilla_dom_SVGFESpotLightElement_h
|
||||
|
||||
#include "nsSVGFilters.h"
|
||||
#include "nsSVGNumber2.h"
|
||||
|
||||
class nsSVGFELightingElement;
|
||||
|
||||
nsresult NS_NewSVGFESpotLightElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
typedef SVGFEUnstyledElement nsSVGFESpotLightElementBase;
|
||||
typedef SVGFEUnstyledElement SVGFESpotLightElementBase;
|
||||
|
||||
class nsSVGFESpotLightElement : public nsSVGFESpotLightElementBase,
|
||||
public nsIDOMSVGFESpotLightElement
|
||||
class SVGFESpotLightElement : public SVGFESpotLightElementBase,
|
||||
public nsIDOMSVGElement
|
||||
{
|
||||
friend nsresult NS_NewSVGFESpotLightElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
friend class nsSVGFELightingElement;
|
||||
friend nsresult (::NS_NewSVGFESpotLightElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo));
|
||||
friend class ::nsSVGFELightingElement;
|
||||
protected:
|
||||
nsSVGFESpotLightElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsSVGFESpotLightElementBase(aNodeInfo) {}
|
||||
SVGFESpotLightElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: SVGFESpotLightElementBase(aNodeInfo)
|
||||
{
|
||||
SetIsDOMBinding();
|
||||
}
|
||||
virtual JSObject* WrapNode(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
|
||||
|
||||
public:
|
||||
// interfaces:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDOMSVGFESPOTLIGHTELEMENT
|
||||
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFESpotLightElementBase::)
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(SVGFESpotLightElementBase::)
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
|
||||
|
@ -35,13 +46,22 @@ public:
|
|||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
|
||||
// WebIDL
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber> X();
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber> Y();
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber> Z();
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber> PointsAtX();
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber> PointsAtY();
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber> PointsAtZ();
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber> SpecularExponent();
|
||||
already_AddRefed<nsIDOMSVGAnimatedNumber> LimitingConeAngle();
|
||||
|
||||
protected:
|
||||
virtual NumberAttributesInfo GetNumberInfo();
|
||||
|
||||
enum { X, Y, Z, POINTS_AT_X, POINTS_AT_Y, POINTS_AT_Z,
|
||||
enum { ATTR_X, ATTR_Y, ATTR_Z, POINTS_AT_X, POINTS_AT_Y, POINTS_AT_Z,
|
||||
SPECULAR_EXPONENT, LIMITING_CONE_ANGLE };
|
||||
nsSVGNumber2 mNumberAttributes[8];
|
||||
static NumberInfo sNumberInfo[8];
|
||||
|
|
|
@ -42,8 +42,9 @@
|
|||
#include "mozilla/dom/SVGFEFuncGElementBinding.h"
|
||||
#include "mozilla/dom/SVGFEFuncRElementBinding.h"
|
||||
#include "mozilla/dom/SVGFEPointLightElement.h"
|
||||
#include "mozilla/dom/SVGFESpotLightElement.h"
|
||||
|
||||
#if defined(XP_WIN)
|
||||
#if defined(XP_WIN)
|
||||
// Prevent Windows redefining LoadImage
|
||||
#undef LoadImage
|
||||
#endif
|
||||
|
@ -2359,7 +2360,7 @@ nsSVGFELightingElement::Filter(nsSVGFilterInstance *instance,
|
|||
instance->ConvertLocation(lightPos);
|
||||
instance->ConvertLocation(pointsAt);
|
||||
|
||||
if (spotLight->mNumberAttributes[nsSVGFESpotLightElement::LIMITING_CONE_ANGLE].
|
||||
if (spotLight->mNumberAttributes[SVGFESpotLightElement::LIMITING_CONE_ANGLE].
|
||||
IsExplicitlySet()) {
|
||||
cosConeAngle = std::max<double>(cos(limitingConeAngle * radPerDeg), 0.0);
|
||||
}
|
||||
|
|
|
@ -822,8 +822,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGFESpecularLightingElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGFESpotLightElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA(SVGFETurbulenceElement, nsElementSH,
|
||||
ELEMENT_SCRIPTABLE_FLAGS)
|
||||
NS_DEFINE_CLASSINFO_DATA_WITH_NAME(SVGUnknownElement, SVGElement, nsElementSH,
|
||||
|
@ -2265,11 +2263,6 @@ nsDOMClassInfo::Init()
|
|||
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(SVGFESpotLightElement, nsIDOMSVGFESpotLightElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFESpotLightElement)
|
||||
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
|
||||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(SVGFETurbulenceElement, nsIDOMSVGFETurbulenceElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFETurbulenceElement)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
|
||||
|
|
|
@ -127,7 +127,6 @@ DOMCI_CLASS(SVGFEDiffuseLightingElement)
|
|||
DOMCI_CLASS(SVGFEDisplacementMapElement)
|
||||
DOMCI_CLASS(SVGFEMorphologyElement)
|
||||
DOMCI_CLASS(SVGFESpecularLightingElement)
|
||||
DOMCI_CLASS(SVGFESpotLightElement)
|
||||
DOMCI_CLASS(SVGFETurbulenceElement)
|
||||
DOMCI_CLASS(SVGUnknownElement)
|
||||
|
||||
|
|
|
@ -102,18 +102,6 @@ interface nsIDOMSVGFESpecularLightingElement : nsIDOMSVGFilterPrimitiveStandardA
|
|||
readonly attribute nsIDOMSVGAnimatedNumber kernelUnitLengthY;
|
||||
};
|
||||
|
||||
[scriptable, uuid(99068af4-1156-46b6-afcc-4b9f37621d10)]
|
||||
interface nsIDOMSVGFESpotLightElement : nsIDOMSVGElement {
|
||||
readonly attribute nsIDOMSVGAnimatedNumber x;
|
||||
readonly attribute nsIDOMSVGAnimatedNumber y;
|
||||
readonly attribute nsIDOMSVGAnimatedNumber z;
|
||||
readonly attribute nsIDOMSVGAnimatedNumber pointsAtX;
|
||||
readonly attribute nsIDOMSVGAnimatedNumber pointsAtY;
|
||||
readonly attribute nsIDOMSVGAnimatedNumber pointsAtZ;
|
||||
readonly attribute nsIDOMSVGAnimatedNumber specularExponent;
|
||||
readonly attribute nsIDOMSVGAnimatedNumber limitingConeAngle;
|
||||
};
|
||||
|
||||
[scriptable, uuid(5ab43048-d59a-4e3c-ad2f-6a5d8593f6d0)]
|
||||
interface nsIDOMSVGFEDisplacementMapElement : nsIDOMSVGFilterPrimitiveStandardAttributes
|
||||
{
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
/* -*- 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 SVGFESpotLightElement : SVGElement {
|
||||
readonly attribute SVGAnimatedNumber x;
|
||||
readonly attribute SVGAnimatedNumber y;
|
||||
readonly attribute SVGAnimatedNumber z;
|
||||
readonly attribute SVGAnimatedNumber pointsAtX;
|
||||
readonly attribute SVGAnimatedNumber pointsAtY;
|
||||
readonly attribute SVGAnimatedNumber pointsAtZ;
|
||||
readonly attribute SVGAnimatedNumber specularExponent;
|
||||
readonly attribute SVGAnimatedNumber limitingConeAngle;
|
||||
};
|
|
@ -202,6 +202,7 @@ webidl_files = \
|
|||
SVGFEMergeNodeElement.webidl \
|
||||
SVGFEOffsetElement.webidl \
|
||||
SVGFEPointLightElement.webidl \
|
||||
SVGFESpotLightElement.webidl \
|
||||
SVGFETileElement.webidl \
|
||||
SVGFitToViewBox.webidl \
|
||||
SVGForeignObjectElement.webidl \
|
||||
|
|
Загрузка…
Ссылка в новой задаче