[Bug 851972] Remove XPIDL for ComponentTransferFunctionElement r=Ms2ger

This commit is contained in:
David Zbarsky 2013-03-18 13:54:04 -04:00
parent 7f4fde7151
commit 9f022df7cf
3 changed files with 36 additions and 139 deletions

View File

@ -38,7 +38,6 @@ public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_SVG_FE_COMPONENT_TRANSFER_FUNCTION_ELEMENT_CID)
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGCOMPONENTTRANSFERFUNCTIONELEMENT
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const;
@ -62,7 +61,6 @@ protected:
virtual EnumAttributesInfo GetEnumInfo();
virtual NumberListAttributesInfo GetNumberListInfo();
// nsIDOMSVGComponentTransferFunctionElement properties:
enum { TABLEVALUES };
SVGAnimatedNumberList mNumberListAttributes[1];
static NumberListInfo sNumberListInfo[1];
@ -87,24 +85,20 @@ namespace mozilla {
namespace dom {
class SVGFEFuncRElement : public SVGComponentTransferFunctionElement,
public nsIDOMSVGFEFuncRElement
public nsIDOMSVGElement
{
friend nsresult (::NS_NewSVGFEFuncRElement(
nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo));
protected:
SVGFEFuncRElement(already_AddRefed<nsINodeInfo> aNodeInfo)
SVGFEFuncRElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: SVGComponentTransferFunctionElement(aNodeInfo) {}
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_FORWARD_NSIDOMSVGCOMPONENTTRANSFERFUNCTIONELEMENT(SVGComponentTransferFunctionElement::)
NS_DECL_NSIDOMSVGFEFUNCRELEMENT
virtual int32_t GetChannel() { return 0; }
NS_FORWARD_NSIDOMSVGELEMENT(SVGComponentTransferFunctionElement::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
@ -127,22 +121,18 @@ namespace mozilla {
namespace dom {
class SVGFEFuncGElement : public SVGComponentTransferFunctionElement,
public nsIDOMSVGFEFuncGElement
public nsIDOMSVGElement
{
friend nsresult (::NS_NewSVGFEFuncGElement(
nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo));
protected:
SVGFEFuncGElement(already_AddRefed<nsINodeInfo> aNodeInfo)
SVGFEFuncGElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: SVGComponentTransferFunctionElement(aNodeInfo) {}
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_FORWARD_NSIDOMSVGCOMPONENTTRANSFERFUNCTIONELEMENT(SVGComponentTransferFunctionElement::)
NS_DECL_NSIDOMSVGFEFUNCGELEMENT
virtual int32_t GetChannel() { return 1; }
NS_FORWARD_NSIDOMSVGELEMENT(SVGComponentTransferFunctionElement::)
@ -167,22 +157,18 @@ namespace mozilla {
namespace dom {
class SVGFEFuncBElement : public SVGComponentTransferFunctionElement,
public nsIDOMSVGFEFuncBElement
public nsIDOMSVGElement
{
friend nsresult (::NS_NewSVGFEFuncBElement(
nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo));
protected:
SVGFEFuncBElement(already_AddRefed<nsINodeInfo> aNodeInfo)
SVGFEFuncBElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: SVGComponentTransferFunctionElement(aNodeInfo) {}
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_FORWARD_NSIDOMSVGCOMPONENTTRANSFERFUNCTIONELEMENT(SVGComponentTransferFunctionElement::)
NS_DECL_NSIDOMSVGFEFUNCBELEMENT
virtual int32_t GetChannel() { return 2; }
NS_FORWARD_NSIDOMSVGELEMENT(SVGComponentTransferFunctionElement::)
@ -207,22 +193,18 @@ namespace mozilla {
namespace dom {
class SVGFEFuncAElement : public SVGComponentTransferFunctionElement,
public nsIDOMSVGFEFuncAElement
public nsIDOMSVGElement
{
friend nsresult (::NS_NewSVGFEFuncAElement(
nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo));
protected:
SVGFEFuncAElement(already_AddRefed<nsINodeInfo> aNodeInfo)
SVGFEFuncAElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: SVGComponentTransferFunctionElement(aNodeInfo) {}
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_FORWARD_NSIDOMSVGCOMPONENTTRANSFERFUNCTIONELEMENT(SVGComponentTransferFunctionElement::)
NS_DECL_NSIDOMSVGFEFUNCAELEMENT
virtual int32_t GetChannel() { return 3; }
NS_FORWARD_NSIDOMSVGELEMENT(SVGComponentTransferFunctionElement::)

View File

@ -53,6 +53,13 @@
using namespace mozilla;
using namespace mozilla::dom;
static const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN = 0;
static const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY = 1;
static const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_TABLE = 2;
static const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE = 3;
static const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_LINEAR = 4;
static const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_GAMMA = 5;
void
CopyDataRect(uint8_t *aDest, const uint8_t *aSrc, uint32_t aStride,
const nsIntRect& aDataRect)
@ -1479,15 +1486,15 @@ nsSVGElement::NumberInfo SVGComponentTransferFunctionElement::sNumberInfo[5] =
nsSVGEnumMapping SVGComponentTransferFunctionElement::sTypeMap[] = {
{&nsGkAtoms::identity,
nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY},
SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY},
{&nsGkAtoms::table,
nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_TABLE},
SVG_FECOMPONENTTRANSFER_TYPE_TABLE},
{&nsGkAtoms::discrete,
nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE},
SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE},
{&nsGkAtoms::linear,
nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_LINEAR},
SVG_FECOMPONENTTRANSFER_TYPE_LINEAR},
{&nsGkAtoms::gamma,
nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_GAMMA},
SVG_FECOMPONENTTRANSFER_TYPE_GAMMA},
{nullptr, 0}
};
@ -1495,7 +1502,7 @@ nsSVGElement::EnumInfo SVGComponentTransferFunctionElement::sEnumInfo[1] =
{
{ &nsGkAtoms::type,
sTypeMap,
nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY
SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY
}
};
@ -1521,7 +1528,7 @@ NS_INTERFACE_MAP_END_INHERITING(SVGComponentTransferFunctionElementBase)
bool
SVGComponentTransferFunctionElement::AttributeAffectsRendering(int32_t aNameSpaceID,
nsIAtom* aAttribute) const
nsIAtom* aAttribute) const
{
return aNameSpaceID == kNameSpaceID_None &&
(aAttribute == nsGkAtoms::tableValues ||
@ -1534,92 +1541,49 @@ SVGComponentTransferFunctionElement::AttributeAffectsRendering(int32_t aNameSpac
}
//----------------------------------------------------------------------
// nsIDOMSVGComponentTransferFunctionElement methods
/* readonly attribute nsIDOMSVGAnimatedEnumeration type; */
already_AddRefed<nsIDOMSVGAnimatedEnumeration>
SVGComponentTransferFunctionElement::Type()
{
return mEnumAttributes[TYPE].ToDOMAnimatedEnum(this);
}
NS_IMETHODIMP SVGComponentTransferFunctionElement::GetType(nsIDOMSVGAnimatedEnumeration * *aType)
{
*aType = Type().get();
return NS_OK;
}
/* readonly attribute DOMSVGAnimatedNumberList tableValues; */
already_AddRefed<DOMSVGAnimatedNumberList>
SVGComponentTransferFunctionElement::TableValues()
{
return DOMSVGAnimatedNumberList::GetDOMWrapper(
&mNumberListAttributes[TABLEVALUES], this, TABLEVALUES);
}
NS_IMETHODIMP SVGComponentTransferFunctionElement::GetTableValues(nsISupports * *aTableValues)
{
*aTableValues = TableValues().get();
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedNumber slope; */
already_AddRefed<nsIDOMSVGAnimatedNumber>
SVGComponentTransferFunctionElement::Slope()
{
return mNumberAttributes[SLOPE].ToDOMAnimatedNumber(this);
}
NS_IMETHODIMP SVGComponentTransferFunctionElement::GetSlope(nsIDOMSVGAnimatedNumber * *aSlope)
{
*aSlope = Slope().get();
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedNumber intercept; */
already_AddRefed<nsIDOMSVGAnimatedNumber>
SVGComponentTransferFunctionElement::Intercept()
{
return mNumberAttributes[INTERCEPT].ToDOMAnimatedNumber(this);
}
NS_IMETHODIMP SVGComponentTransferFunctionElement::GetIntercept(nsIDOMSVGAnimatedNumber * *aIntercept)
{
*aIntercept = Intercept().get();
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedNumber amplitude; */
already_AddRefed<nsIDOMSVGAnimatedNumber>
SVGComponentTransferFunctionElement::Amplitude()
{
return mNumberAttributes[AMPLITUDE].ToDOMAnimatedNumber(this);
}
NS_IMETHODIMP SVGComponentTransferFunctionElement::GetAmplitude(nsIDOMSVGAnimatedNumber * *aAmplitude)
{
*aAmplitude = Amplitude().get();
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedNumber exponent; */
already_AddRefed<nsIDOMSVGAnimatedNumber>
SVGComponentTransferFunctionElement::Exponent()
{
return mNumberAttributes[EXPONENT].ToDOMAnimatedNumber(this);
}
NS_IMETHODIMP SVGComponentTransferFunctionElement::GetExponent(nsIDOMSVGAnimatedNumber * *aExponent)
{
*aExponent = Exponent().get();
return NS_OK;
}
/* readonly attribute nsIDOMSVGAnimatedNumber offset; */
already_AddRefed<nsIDOMSVGAnimatedNumber>
SVGComponentTransferFunctionElement::Offset()
{
return mNumberAttributes[OFFSET].ToDOMAnimatedNumber(this);
}
NS_IMETHODIMP SVGComponentTransferFunctionElement::GetOffset(nsIDOMSVGAnimatedNumber * *aOffset)
{
*aOffset = Offset().get();
return NS_OK;
}
bool
SVGComponentTransferFunctionElement::GenerateLookupTable(uint8_t *aTable)
@ -1637,7 +1601,7 @@ SVGComponentTransferFunctionElement::GenerateLookupTable(uint8_t *aTable)
uint32_t i;
switch (type) {
case nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_TABLE:
case SVG_FECOMPONENTTRANSFER_TYPE_TABLE:
{
if (tableValues.Length() < 2)
return false;
@ -1655,7 +1619,7 @@ SVGComponentTransferFunctionElement::GenerateLookupTable(uint8_t *aTable)
break;
}
case nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE:
case SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE:
{
if (tableValues.Length() < 1)
return false;
@ -1672,7 +1636,7 @@ SVGComponentTransferFunctionElement::GenerateLookupTable(uint8_t *aTable)
break;
}
case nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_LINEAR:
case SVG_FECOMPONENTTRANSFER_TYPE_LINEAR:
{
for (i = 0; i < 256; i++) {
int32_t val = int32_t(slope * i + 255 * intercept);
@ -1683,7 +1647,7 @@ SVGComponentTransferFunctionElement::GenerateLookupTable(uint8_t *aTable)
break;
}
case nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_GAMMA:
case SVG_FECOMPONENTTRANSFER_TYPE_GAMMA:
{
for (i = 0; i < 256; i++) {
int32_t val = int32_t(255 * (amplitude * pow(i / 255.0f, exponent) + offset));
@ -1694,7 +1658,7 @@ SVGComponentTransferFunctionElement::GenerateLookupTable(uint8_t *aTable)
break;
}
case nsIDOMSVGComponentTransferFunctionElement::SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY:
case SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY:
default:
break;
}
@ -1725,12 +1689,10 @@ SVGComponentTransferFunctionElement::GetNumberInfo()
ArrayLength(sNumberInfo));
}
NS_IMPL_ISUPPORTS_INHERITED5(SVGFEFuncRElement,
NS_IMPL_ISUPPORTS_INHERITED3(SVGFEFuncRElement,
SVGComponentTransferFunctionElement,
nsIDOMNode, nsIDOMElement,
nsIDOMSVGElement,
nsIDOMSVGComponentTransferFunctionElement,
nsIDOMSVGFEFuncRElement)
nsIDOMSVGElement)
/* virtual */ JSObject*
SVGFEFuncRElement::WrapNode(JSContext* aCx, JSObject* aScope)
@ -1748,12 +1710,10 @@ namespace dom {
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEFuncRElement)
NS_IMPL_ISUPPORTS_INHERITED5(SVGFEFuncGElement,
NS_IMPL_ISUPPORTS_INHERITED3(SVGFEFuncGElement,
SVGComponentTransferFunctionElement,
nsIDOMNode, nsIDOMElement,
nsIDOMSVGElement,
nsIDOMSVGComponentTransferFunctionElement,
nsIDOMSVGFEFuncGElement)
nsIDOMSVGElement)
/* virtual */ JSObject*
SVGFEFuncGElement::WrapNode(JSContext* aCx, JSObject* aScope)
@ -1771,12 +1731,10 @@ namespace dom {
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEFuncGElement)
NS_IMPL_ISUPPORTS_INHERITED5(SVGFEFuncBElement,
NS_IMPL_ISUPPORTS_INHERITED3(SVGFEFuncBElement,
SVGComponentTransferFunctionElement,
nsIDOMNode, nsIDOMElement,
nsIDOMSVGElement,
nsIDOMSVGComponentTransferFunctionElement,
nsIDOMSVGFEFuncBElement)
nsIDOMSVGElement)
/* virtual */ JSObject*
SVGFEFuncBElement::WrapNode(JSContext* aCx, JSObject* aScope)
@ -1794,12 +1752,10 @@ namespace dom {
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEFuncBElement)
NS_IMPL_ISUPPORTS_INHERITED5(SVGFEFuncAElement,
NS_IMPL_ISUPPORTS_INHERITED3(SVGFEFuncAElement,
SVGComponentTransferFunctionElement,
nsIDOMNode, nsIDOMElement,
nsIDOMSVGElement,
nsIDOMSVGComponentTransferFunctionElement,
nsIDOMSVGFEFuncAElement)
nsIDOMSVGElement)
/* virtual */ JSObject*
SVGFEFuncAElement::WrapNode(JSContext* aCx, JSObject* aScope)

View File

@ -37,27 +37,6 @@ interface nsIDOMSVGFEColorMatrixElement : nsIDOMSVGFilterPrimitiveStandardAttrib
readonly attribute nsISupports values;
};
[scriptable, uuid(3fa8c369-df5b-4bfb-9651-c999bc22fbc7)]
interface nsIDOMSVGComponentTransferFunctionElement : nsIDOMSVGElement
{
// Component Transfer Types
const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN = 0;
const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY = 1;
const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_TABLE = 2;
const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE = 3;
const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_LINEAR = 4;
const unsigned short SVG_FECOMPONENTTRANSFER_TYPE_GAMMA = 5;
readonly attribute nsIDOMSVGAnimatedEnumeration type;
// SVGAnimatedNumberList
readonly attribute nsISupports tableValues;
readonly attribute nsIDOMSVGAnimatedNumber slope;
readonly attribute nsIDOMSVGAnimatedNumber intercept;
readonly attribute nsIDOMSVGAnimatedNumber amplitude;
readonly attribute nsIDOMSVGAnimatedNumber exponent;
readonly attribute nsIDOMSVGAnimatedNumber offset;
};
[scriptable, uuid(f264fd1f-b272-4796-99b5-68c90cbd030c)]
interface nsIDOMSVGFECompositeElement : nsIDOMSVGFilterPrimitiveStandardAttributes
{
@ -82,26 +61,6 @@ interface nsIDOMSVGFECompositeElement : nsIDOMSVGFilterPrimitiveStandardAttribut
};
[scriptable, uuid(7ff6cba9-65e0-48d2-9d81-4ab26782a945)]
interface nsIDOMSVGFEFuncRElement : nsIDOMSVGComponentTransferFunctionElement
{
};
[scriptable, uuid(b6a7ad39-724f-42ab-8d3f-a05d1cf7ab0c)]
interface nsIDOMSVGFEFuncGElement : nsIDOMSVGComponentTransferFunctionElement
{
};
[scriptable, uuid(c414b7dd-7ff2-4158-988a-20943d22db52)]
interface nsIDOMSVGFEFuncBElement : nsIDOMSVGComponentTransferFunctionElement
{
};
[scriptable, uuid(f4f5fe63-9570-48f7-ba7e-a5300fa71aed)]
interface nsIDOMSVGFEFuncAElement : nsIDOMSVGComponentTransferFunctionElement
{
};
[scriptable, uuid(08f2d7e5-b79f-405c-8140-7faa72c53ead)]
interface nsIDOMSVGFEGaussianBlurElement : nsIDOMSVGFilterPrimitiveStandardAttributes
{