Bug 835065 - Part c: Move SVGComponentTransferFunctionElement and subclasses to Paris bindings; r=bz

This commit is contained in:
Ms2ger 2013-02-12 11:10:24 +01:00
parent 833ca9a618
commit f38a4f23b0
11 changed files with 236 additions and 46 deletions

View File

@ -6,41 +6,11 @@
#ifndef mozilla_dom_SVGComponentTransferFunctionElement_h
#define mozilla_dom_SVGComponentTransferFunctionElement_h
#include "mozilla/Util.h"
#include "nsSVGElement.h"
#include "nsGkAtoms.h"
#include "nsSVGNumber2.h"
#include "nsSVGNumberPair.h"
#include "nsSVGInteger.h"
#include "nsSVGIntegerPair.h"
#include "nsSVGBoolean.h"
#include "nsIDOMSVGFilters.h"
#include "nsCOMPtr.h"
#include "nsSVGFilterInstance.h"
#include "nsIDOMSVGFilterElement.h"
#include "nsSVGEnum.h"
#include "SVGNumberList.h"
#include "SVGAnimatedNumberList.h"
#include "DOMSVGAnimatedNumberList.h"
#include "nsSVGFilters.h"
#include "nsLayoutUtils.h"
#include "nsSVGUtils.h"
#include "nsStyleContext.h"
#include "nsIDocument.h"
#include "nsIFrame.h"
#include "gfxContext.h"
#include "gfxMatrix.h"
#include "imgIContainer.h"
#include "nsNetUtil.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsSVGFilterElement.h"
#include "nsSVGString.h"
#include "nsSVGEffects.h"
#include "gfxUtils.h"
#include "SVGContentUtils.h"
#include <algorithm>
#include "nsContentUtils.h"
#include "nsSVGNumber2.h"
#include "SVGAnimatedNumberList.h"
#define NS_SVG_FE_COMPONENT_TRANSFER_FUNCTION_ELEMENT_CID \
{ 0xafab106d, 0xbc18, 0x4f7f, \
@ -50,6 +20,9 @@ nsresult NS_NewSVGComponentTransferFunctionElement(
nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo);
namespace mozilla {
class DOMSVGAnimatedNumberList;
namespace dom {
typedef SVGFEUnstyledElement SVGComponentTransferFunctionElementBase;
@ -60,7 +33,10 @@ class SVGComponentTransferFunctionElement : public SVGComponentTransferFunctionE
nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo));
protected:
SVGComponentTransferFunctionElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: SVGComponentTransferFunctionElementBase(aNodeInfo) {}
: SVGComponentTransferFunctionElementBase(aNodeInfo)
{
SetIsDOMBinding();
}
public:
// interfaces:
@ -75,6 +51,17 @@ public:
virtual int32_t GetChannel() = 0;
void GenerateLookupTable(uint8_t* aTable);
// WebIDL
virtual JSObject*
WrapNode(JSContext* aCx, JSObject* aScope, bool* aTriedToWrap) MOZ_OVERRIDE = 0;
already_AddRefed<nsIDOMSVGAnimatedEnumeration> Type();
already_AddRefed<DOMSVGAnimatedNumberList> TableValues();
already_AddRefed<nsIDOMSVGAnimatedNumber> Slope();
already_AddRefed<nsIDOMSVGAnimatedNumber> Intercept();
already_AddRefed<nsIDOMSVGAnimatedNumber> Amplitude();
already_AddRefed<nsIDOMSVGAnimatedNumber> Exponent();
already_AddRefed<nsIDOMSVGAnimatedNumber> Offset();
protected:
virtual NumberAttributesInfo GetNumberInfo();
virtual EnumAttributesInfo GetEnumInfo();
@ -132,6 +119,9 @@ public:
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
virtual JSObject*
WrapNode(JSContext* aCx, JSObject* aScope, bool* aTriedToWrap) MOZ_OVERRIDE;
};
} // namespace dom
@ -171,6 +161,9 @@ public:
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
virtual JSObject*
WrapNode(JSContext* aCx, JSObject* aScope, bool* aTriedToWrap) MOZ_OVERRIDE;
};
} // namespace dom
@ -210,6 +203,9 @@ public:
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
virtual JSObject*
WrapNode(JSContext* aCx, JSObject* aScope, bool* aTriedToWrap) MOZ_OVERRIDE;
};
} // namespace dom
@ -249,6 +245,9 @@ public:
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
virtual JSObject*
WrapNode(JSContext* aCx, JSObject* aScope, bool* aTriedToWrap) MOZ_OVERRIDE;
};
} // namespace dom

View File

@ -39,6 +39,10 @@
#include <algorithm>
#include "nsContentUtils.h"
#include "mozilla/dom/SVGComponentTransferFunctionElement.h"
#include "mozilla/dom/SVGFEFuncAElementBinding.h"
#include "mozilla/dom/SVGFEFuncBElementBinding.h"
#include "mozilla/dom/SVGFEFuncGElementBinding.h"
#include "mozilla/dom/SVGFEFuncRElementBinding.h"
#if defined(XP_WIN)
// Prevent Windows redefining LoadImage
@ -1889,47 +1893,88 @@ 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)
{
return mEnumAttributes[TYPE].ToDOMAnimatedEnum(aType, this);
*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 = DOMSVGAnimatedNumberList::GetDOMWrapper(&mNumberListAttributes[TABLEVALUES],
this, TABLEVALUES).get();
*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)
{
return mNumberAttributes[SLOPE].ToDOMAnimatedNumber(aSlope, this);
*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)
{
return mNumberAttributes[INTERCEPT].ToDOMAnimatedNumber(aIntercept, this);
*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)
{
return mNumberAttributes[AMPLITUDE].ToDOMAnimatedNumber(aAmplitude, this);
*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)
{
return mNumberAttributes[EXPONENT].ToDOMAnimatedNumber(aExponent, this);
*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)
{
return mNumberAttributes[OFFSET].ToDOMAnimatedNumber(aOffset, this);
*aOffset = Offset().get();
return NS_OK;
}
void
@ -2055,6 +2100,13 @@ NS_INTERFACE_TABLE_HEAD(SVGFEFuncRElement)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGFEFuncRElement)
NS_INTERFACE_MAP_END_INHERITING(SVGComponentTransferFunctionElement)
/* virtual */ JSObject*
SVGFEFuncRElement::WrapNode(JSContext* aCx, JSObject* aScope,
bool* aTriedToWrap)
{
return SVGFEFuncRElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
} // namespace dom
} // namespace mozilla
@ -2085,6 +2137,13 @@ NS_INTERFACE_TABLE_HEAD(SVGFEFuncGElement)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGFEFuncGElement)
NS_INTERFACE_MAP_END_INHERITING(SVGComponentTransferFunctionElement)
/* virtual */ JSObject*
SVGFEFuncGElement::WrapNode(JSContext* aCx, JSObject* aScope,
bool* aTriedToWrap)
{
return SVGFEFuncGElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
} // namespace dom
} // namespace mozilla
@ -2115,6 +2174,13 @@ NS_INTERFACE_TABLE_HEAD(SVGFEFuncBElement)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGFEFuncBElement)
NS_INTERFACE_MAP_END_INHERITING(SVGComponentTransferFunctionElement)
/* virtual */ JSObject*
SVGFEFuncBElement::WrapNode(JSContext* aCx, JSObject* aScope,
bool* aTriedToWrap)
{
return SVGFEFuncBElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
} // namespace dom
} // namespace mozilla
@ -2145,6 +2211,13 @@ NS_INTERFACE_TABLE_HEAD(SVGFEFuncAElement)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGFEFuncAElement)
NS_INTERFACE_MAP_END_INHERITING(SVGComponentTransferFunctionElement)
/* virtual */ JSObject*
SVGFEFuncAElement::WrapNode(JSContext* aCx, JSObject* aScope,
bool* aTriedToWrap)
{
return SVGFEFuncAElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
} // namespace dom
} // namespace mozilla

View File

@ -151,9 +151,8 @@ nsSVGNumber2::SetAnimValue(float aValue, nsSVGElement *aSVGElement)
aSVGElement->DidAnimateNumber(mAttrEnum);
}
nsresult
nsSVGNumber2::ToDOMAnimatedNumber(nsIDOMSVGAnimatedNumber **aResult,
nsSVGElement *aSVGElement)
already_AddRefed<nsIDOMSVGAnimatedNumber>
nsSVGNumber2::ToDOMAnimatedNumber(nsSVGElement* aSVGElement)
{
nsRefPtr<DOMAnimatedNumber> domAnimatedNumber =
sSVGAnimatedNumberTearoffTable.GetTearoff(this);
@ -162,7 +161,14 @@ nsSVGNumber2::ToDOMAnimatedNumber(nsIDOMSVGAnimatedNumber **aResult,
sSVGAnimatedNumberTearoffTable.AddTearoff(this, domAnimatedNumber);
}
domAnimatedNumber.forget(aResult);
return domAnimatedNumber.forget();
}
nsresult
nsSVGNumber2::ToDOMAnimatedNumber(nsIDOMSVGAnimatedNumber **aResult,
nsSVGElement *aSVGElement)
{
*aResult = ToDOMAnimatedNumber(aSVGElement).get();
return NS_OK;
}

View File

@ -48,6 +48,8 @@ public:
bool IsExplicitlySet() const
{ return mIsAnimated || mIsBaseSet; }
already_AddRefed<nsIDOMSVGAnimatedNumber>
ToDOMAnimatedNumber(nsSVGElement* aSVGElement);
nsresult ToDOMAnimatedNumber(nsIDOMSVGAnimatedNumber **aResult,
nsSVGElement* aSVGElement);
// Returns a new nsISMILAttr object that the caller must delete

View File

@ -736,6 +736,10 @@ DOMInterfaces = {
'concrete': False
},
'SVGComponentTransferFunctionElement': {
'concrete': False,
},
'SVGElement': {
'nativeType': 'nsSVGElement',
'hasXPConnectImpls': True,
@ -743,6 +747,22 @@ DOMInterfaces = {
'resultNotAddRefed': ['ownerSVGElement', 'viewportElement', 'style']
},
'SVGFEFuncAElement': {
'headerFile': 'mozilla/dom/SVGComponentTransferFunctionElement.h',
},
'SVGFEFuncBElement': {
'headerFile': 'mozilla/dom/SVGComponentTransferFunctionElement.h',
},
'SVGFEFuncGElement': {
'headerFile': 'mozilla/dom/SVGComponentTransferFunctionElement.h',
},
'SVGFEFuncRElement': {
'headerFile': 'mozilla/dom/SVGComponentTransferFunctionElement.h',
},
'SVGGraphicsElement': {
'concrete': False,
'resultNotAddRefed': ['nearestViewportElement', 'farthestViewportElement']

View File

@ -0,0 +1,29 @@
/* -*- 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
* https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html
*
* Copyright © 2013 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
interface SVGComponentTransferFunctionElement : SVGElement {
// 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 SVGAnimatedEnumeration type;
readonly attribute SVGAnimatedNumberList tableValues;
readonly attribute SVGAnimatedNumber slope;
readonly attribute SVGAnimatedNumber intercept;
readonly attribute SVGAnimatedNumber amplitude;
readonly attribute SVGAnimatedNumber exponent;
readonly attribute SVGAnimatedNumber offset;
};

View File

@ -0,0 +1,14 @@
/* -*- 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
* https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html
*
* Copyright © 2013 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
interface SVGFEFuncAElement : SVGComponentTransferFunctionElement {
};

View File

@ -0,0 +1,14 @@
/* -*- 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
* https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html
*
* Copyright © 2013 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
interface SVGFEFuncBElement : SVGComponentTransferFunctionElement {
};

View File

@ -0,0 +1,14 @@
/* -*- 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
* https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html
*
* Copyright © 2013 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
interface SVGFEFuncGElement : SVGComponentTransferFunctionElement {
};

View File

@ -0,0 +1,14 @@
/* -*- 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
* https://dvcs.w3.org/hg/FXTF/raw-file/tip/filters/index.html
*
* Copyright © 2013 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
interface SVGFEFuncRElement : SVGComponentTransferFunctionElement {
};

View File

@ -139,10 +139,15 @@ webidl_files = \
SVGAnimationElement.webidl \
SVGCircleElement.webidl \
SVGClipPathElement.webidl \
SVGComponentTransferFunctionElement.webidl \
SVGDefsElement.webidl \
SVGDescElement.webidl \
SVGElement.webidl \
SVGEllipseElement.webidl \
SVGFEFuncAElement.webidl \
SVGFEFuncBElement.webidl \
SVGFEFuncGElement.webidl \
SVGFEFuncRElement.webidl \
SVGFitToViewBox.webidl \
SVGForeignObjectElement.webidl \
SVGGElement.webidl \