Bug 849710 - Convert SVGFEComponentTransferElement to WebIDL r=Ms2ger

This commit is contained in:
David Zbarsky 2013-03-16 00:13:31 -04:00
parent 1a629806ca
commit 06a2c9fce5
7 changed files with 61 additions and 58 deletions

View File

@ -3,16 +3,23 @@
* 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/SVGComponentTransferFunctionElement.h"
#include "mozilla/dom/SVGFEComponentTransferElement.h"
DOMCI_NODE_DATA(SVGFEComponentTransferElement, nsSVGFEComponentTransferElement)
#include "mozilla/dom/SVGFEComponentTransferElementBinding.h"
#include "nsSVGUtils.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(FEComponentTransfer)
namespace mozilla {
namespace dom {
nsSVGElement::StringInfo nsSVGFEComponentTransferElement::sStringInfo[2] =
JSObject*
SVGFEComponentTransferElement::WrapNode(JSContext* aCx, JSObject* aScope)
{
return SVGFEComponentTransferElementBinding::Wrap(aCx, aScope, this);
}
nsSVGElement::StringInfo SVGFEComponentTransferElement::sStringInfo[2] =
{
{ &nsGkAtoms::result, kNameSpaceID_None, true },
{ &nsGkAtoms::in, kNameSpaceID_None, true }
@ -21,37 +28,30 @@ nsSVGElement::StringInfo nsSVGFEComponentTransferElement::sStringInfo[2] =
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGFEComponentTransferElement,nsSVGFEComponentTransferElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGFEComponentTransferElement,nsSVGFEComponentTransferElementBase)
NS_IMPL_ADDREF_INHERITED(SVGFEComponentTransferElement,SVGFEComponentTransferElementBase)
NS_IMPL_RELEASE_INHERITED(SVGFEComponentTransferElement,SVGFEComponentTransferElementBase)
NS_INTERFACE_TABLE_HEAD(nsSVGFEComponentTransferElement)
NS_NODE_INTERFACE_TABLE5(nsSVGFEComponentTransferElement, nsIDOMNode,
nsIDOMElement, nsIDOMSVGElement,
nsIDOMSVGFilterPrimitiveStandardAttributes,
nsIDOMSVGFEComponentTransferElement)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGFEComponentTransferElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGFEComponentTransferElementBase)
NS_INTERFACE_TABLE_HEAD(SVGFEComponentTransferElement)
NS_NODE_INTERFACE_TABLE3(SVGFEComponentTransferElement, nsIDOMNode,
nsIDOMElement, nsIDOMSVGElement)
NS_INTERFACE_MAP_END_INHERITING(SVGFEComponentTransferElementBase)
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEComponentTransferElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEComponentTransferElement)
//----------------------------------------------------------------------
// nsIDOMSVGFEComponentTransferElement methods
/* readonly attribute nsIDOMSVGAnimatedString in1; */
NS_IMETHODIMP
nsSVGFEComponentTransferElement::GetIn1(nsIDOMSVGAnimatedString * *aIn)
already_AddRefed<nsIDOMSVGAnimatedString>
SVGFEComponentTransferElement::In1()
{
return mStringAttributes[IN1].ToDOMAnimatedString(aIn, this);
return mStringAttributes[IN1].ToDOMAnimatedString(this);
}
//----------------------------------------------------------------------
// nsSVGElement methods
nsSVGElement::StringAttributesInfo
nsSVGFEComponentTransferElement::GetStringInfo()
SVGFEComponentTransferElement::GetStringInfo()
{
return StringAttributesInfo(mStringAttributes, sStringInfo,
ArrayLength(sStringInfo));
@ -60,10 +60,10 @@ nsSVGFEComponentTransferElement::GetStringInfo()
//--------------------------------------------
nsresult
nsSVGFEComponentTransferElement::Filter(nsSVGFilterInstance *instance,
const nsTArray<const Image*>& aSources,
const Image* aTarget,
const nsIntRect& rect)
SVGFEComponentTransferElement::Filter(nsSVGFilterInstance *instance,
const nsTArray<const Image*>& aSources,
const Image* aTarget,
const nsIntRect& rect)
{
uint8_t* sourceData = aSources[0]->mImage->Data();
uint8_t* targetData = aTarget->mImage->Data();
@ -104,16 +104,16 @@ nsSVGFEComponentTransferElement::Filter(nsSVGFilterInstance *instance,
}
bool
nsSVGFEComponentTransferElement::AttributeAffectsRendering(int32_t aNameSpaceID,
nsIAtom* aAttribute) const
SVGFEComponentTransferElement::AttributeAffectsRendering(int32_t aNameSpaceID,
nsIAtom* aAttribute) const
{
return nsSVGFEComponentTransferElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
return SVGFEComponentTransferElementBase::AttributeAffectsRendering(aNameSpaceID, aAttribute) ||
(aNameSpaceID == kNameSpaceID_None &&
aAttribute == nsGkAtoms::in);
}
void
nsSVGFEComponentTransferElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
SVGFEComponentTransferElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
{
aSources.AppendElement(nsSVGStringInfo(&mStringAttributes[IN1], this));
}

View File

@ -8,7 +8,7 @@
#include "nsSVGFilters.h"
typedef nsSVGFE nsSVGFEComponentTransferElementBase;
typedef nsSVGFE SVGFEComponentTransferElementBase;
nsresult NS_NewSVGFEComponentTransferElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo);
@ -16,22 +16,23 @@ nsresult NS_NewSVGFEComponentTransferElement(nsIContent **aResult,
namespace mozilla {
namespace dom {
class nsSVGFEComponentTransferElement : public nsSVGFEComponentTransferElementBase,
public nsIDOMSVGFEComponentTransferElement
class SVGFEComponentTransferElement : public SVGFEComponentTransferElementBase,
public nsIDOMSVGElement
{
friend nsresult (::NS_NewSVGFEComponentTransferElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo));
protected:
nsSVGFEComponentTransferElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsSVGFEComponentTransferElementBase(aNodeInfo) {}
SVGFEComponentTransferElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: SVGFEComponentTransferElementBase(aNodeInfo)
{
SetIsDOMBinding();
}
virtual JSObject* WrapNode(JSContext* aCx, JSObject* aScope) MOZ_OVERRIDE;
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
// FE Base
NS_FORWARD_NSIDOMSVGFILTERPRIMITIVESTANDARDATTRIBUTES(nsSVGFEComponentTransferElementBase::)
virtual nsresult Filter(nsSVGFilterInstance* aInstance,
const nsTArray<const Image*>& aSources,
const Image* aTarget,
@ -41,10 +42,7 @@ public:
virtual nsSVGString& GetResultImageName() { return mStringAttributes[RESULT]; }
virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources);
// Component Transfer
NS_DECL_NSIDOMSVGFECOMPONENTTRANSFERELEMENT
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEComponentTransferElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(SVGFEComponentTransferElementBase::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
@ -52,9 +50,11 @@ public:
// nsIContent
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
// WebIDL
already_AddRefed<nsIDOMSVGAnimatedString> In1();
protected:
virtual bool OperatesOnPremultipledAlpha(int32_t) { return false; }

View File

@ -820,8 +820,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFEColorMatrixElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFEComponentTransferElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFECompositeElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFEConvolveMatrixElement, nsElementSH,
@ -2273,12 +2271,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGFEComponentTransferElement, nsIDOMSVGFEComponentTransferElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEComponentTransferElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGFECompositeElement, nsIDOMSVGFECompositeElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFECompositeElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)

View File

@ -123,7 +123,6 @@ DOMCI_CLASS(SVGDocument)
// SVG element classes
DOMCI_CLASS(TimeEvent)
DOMCI_CLASS(SVGFEColorMatrixElement)
DOMCI_CLASS(SVGFEComponentTransferElement)
DOMCI_CLASS(SVGFECompositeElement)
DOMCI_CLASS(SVGFEConvolveMatrixElement)
DOMCI_CLASS(SVGFEDiffuseLightingElement)

View File

@ -37,12 +37,6 @@ interface nsIDOMSVGFEColorMatrixElement : nsIDOMSVGFilterPrimitiveStandardAttrib
readonly attribute nsISupports values;
};
[scriptable, uuid(338e96e3-ad22-4d79-a9a8-51602862f3ac)]
interface nsIDOMSVGFEComponentTransferElement : nsIDOMSVGFilterPrimitiveStandardAttributes
{
readonly attribute nsIDOMSVGAnimatedString in1;
};
[scriptable, uuid(87e1d0d5-6ee4-4287-a268-cb87e75ed092)]
interface nsIDOMSVGComponentTransferFunctionElement : nsIDOMSVGElement
{

View File

@ -0,0 +1,17 @@
/* -*- 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 SVGAnimatedString;
interface SVGFEComponentTransferElement : SVGElement {
readonly attribute SVGAnimatedString in1;
};

View File

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