Bug 837044 - Convert SVGFilterElement to WebIDL r=bz

This commit is contained in:
David Zbarsky 2013-02-17 21:14:02 -05:00
parent 5d6eaa1ca9
commit fd6e8609f2
27 changed files with 157 additions and 133 deletions

View File

@ -24,17 +24,16 @@ nsSVGElement::EnumInfo SVGClipPathElement::sEnumInfo[1] =
{
{ &nsGkAtoms::clipPathUnits,
sSVGUnitTypesMap,
nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE
SVG_UNIT_TYPE_USERSPACEONUSE
}
};
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ISUPPORTS_INHERITED4(SVGClipPathElement, SVGClipPathElementBase,
NS_IMPL_ISUPPORTS_INHERITED3(SVGClipPathElement, SVGClipPathElementBase,
nsIDOMNode, nsIDOMElement,
nsIDOMSVGElement,
nsIDOMSVGUnitTypes)
nsIDOMSVGElement)
//----------------------------------------------------------------------
// Implementation

View File

@ -6,7 +6,6 @@
#ifndef mozilla_dom_SVGClipPathElement_h
#define mozilla_dom_SVGClipPathElement_h
#include "nsIDOMSVGUnitTypes.h"
#include "nsSVGEnum.h"
#include "mozilla/dom/SVGTransformableElement.h"
@ -21,8 +20,7 @@ namespace dom {
typedef SVGTransformableElement SVGClipPathElementBase;
class SVGClipPathElement MOZ_FINAL : public SVGClipPathElementBase,
public nsIDOMSVGElement,
public nsIDOMSVGUnitTypes
public nsIDOMSVGElement
{
friend class ::nsSVGClipPathFrame;

View File

@ -8,15 +8,20 @@
#include "nsGkAtoms.h"
#include "nsCOMPtr.h"
#include "mozilla/dom/SVGFilterElement.h"
#include "mozilla/dom/SVGFilterElementBinding.h"
#include "nsSVGEffects.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Filter)
DOMCI_NODE_DATA(SVGFilterElement, mozilla::dom::SVGFilterElement)
namespace mozilla {
namespace dom {
JSObject*
SVGFilterElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
{
return SVGFilterElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
nsSVGElement::LengthInfo SVGFilterElement::sLengthInfo[4] =
{
{ &nsGkAtoms::x, -10, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
@ -34,11 +39,11 @@ nsSVGElement::EnumInfo SVGFilterElement::sEnumInfo[2] =
{
{ &nsGkAtoms::filterUnits,
sSVGUnitTypesMap,
nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
},
{ &nsGkAtoms::primitiveUnits,
sSVGUnitTypesMap,
nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE
SVG_UNIT_TYPE_USERSPACEONUSE
}
};
@ -50,16 +55,9 @@ nsSVGElement::StringInfo SVGFilterElement::sStringInfo[1] =
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(SVGFilterElement,SVGFilterElementBase)
NS_IMPL_RELEASE_INHERITED(SVGFilterElement,SVGFilterElementBase)
NS_INTERFACE_TABLE_HEAD(SVGFilterElement)
NS_NODE_INTERFACE_TABLE5(SVGFilterElement, nsIDOMNode, nsIDOMElement,
nsIDOMSVGElement,
nsIDOMSVGFilterElement,
nsIDOMSVGURIReference)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGFilterElement)
NS_INTERFACE_MAP_END_INHERITING(SVGFilterElementBase)
NS_IMPL_ISUPPORTS_INHERITED4(SVGFilterElement, SVGFilterElementBase,
nsIDOMNode, nsIDOMElement,
nsIDOMSVGElement, nsIDOMSVGURIReference)
//----------------------------------------------------------------------
// Implementation
@ -67,6 +65,7 @@ NS_INTERFACE_MAP_END_INHERITING(SVGFilterElementBase)
SVGFilterElement::SVGFilterElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: SVGFilterElementBase(aNodeInfo)
{
SetIsDOMBinding();
}
//----------------------------------------------------------------------
@ -77,77 +76,77 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFilterElement)
//----------------------------------------------------------------------
// nsIDOMSVGFilterElement methods
/* readonly attribute nsIDOMSVGAnimatedLength x; */
NS_IMETHODIMP SVGFilterElement::GetX(nsIDOMSVGAnimatedLength * *aX)
already_AddRefed<SVGAnimatedLength>
SVGFilterElement::X()
{
return mLengthAttributes[X].ToDOMAnimatedLength(aX, this);
return mLengthAttributes[ATTR_X].ToDOMAnimatedLength(this);
}
/* readonly attribute nsIDOMSVGAnimatedLength y; */
NS_IMETHODIMP SVGFilterElement::GetY(nsIDOMSVGAnimatedLength * *aY)
already_AddRefed<SVGAnimatedLength>
SVGFilterElement::Y()
{
return mLengthAttributes[Y].ToDOMAnimatedLength(aY, this);
return mLengthAttributes[ATTR_Y].ToDOMAnimatedLength(this);
}
/* readonly attribute nsIDOMSVGAnimatedLength width; */
NS_IMETHODIMP SVGFilterElement::GetWidth(nsIDOMSVGAnimatedLength * *aWidth)
already_AddRefed<SVGAnimatedLength>
SVGFilterElement::Width()
{
return mLengthAttributes[WIDTH].ToDOMAnimatedLength(aWidth, this);
return mLengthAttributes[ATTR_WIDTH].ToDOMAnimatedLength(this);
}
/* readonly attribute nsIDOMSVGAnimatedLength height; */
NS_IMETHODIMP SVGFilterElement::GetHeight(nsIDOMSVGAnimatedLength * *aHeight)
already_AddRefed<SVGAnimatedLength>
SVGFilterElement::Height()
{
return mLengthAttributes[HEIGHT].ToDOMAnimatedLength(aHeight, this);
return mLengthAttributes[ATTR_HEIGHT].ToDOMAnimatedLength(this);
}
/* readonly attribute nsIDOMSVGAnimatedEnumeration filterUnits; */
NS_IMETHODIMP SVGFilterElement::GetFilterUnits(nsIDOMSVGAnimatedEnumeration * *aUnits)
already_AddRefed<nsIDOMSVGAnimatedEnumeration>
SVGFilterElement::FilterUnits()
{
return mEnumAttributes[FILTERUNITS].ToDOMAnimatedEnum(aUnits, this);
return mEnumAttributes[FILTERUNITS].ToDOMAnimatedEnum(this);
}
/* readonly attribute nsIDOMSVGAnimatedEnumeration primitiveUnits; */
NS_IMETHODIMP SVGFilterElement::GetPrimitiveUnits(nsIDOMSVGAnimatedEnumeration * *aUnits)
already_AddRefed<nsIDOMSVGAnimatedEnumeration>
SVGFilterElement::PrimitiveUnits()
{
return mEnumAttributes[PRIMITIVEUNITS].ToDOMAnimatedEnum(aUnits, this);
return mEnumAttributes[PRIMITIVEUNITS].ToDOMAnimatedEnum(this);
}
/* readonly attribute nsIDOMSVGAnimatedEnumeration filterResY; */
NS_IMETHODIMP SVGFilterElement::GetFilterResX(nsIDOMSVGAnimatedInteger * *aFilterResX)
already_AddRefed<nsIDOMSVGAnimatedInteger>
SVGFilterElement::FilterResX()
{
return mIntegerPairAttributes[FILTERRES].ToDOMAnimatedInteger(aFilterResX,
nsSVGIntegerPair::eFirst,
return mIntegerPairAttributes[FILTERRES].ToDOMAnimatedInteger(nsSVGIntegerPair::eFirst,
this);
}
/* readonly attribute nsIDOMSVGAnimatedEnumeration filterResY; */
NS_IMETHODIMP SVGFilterElement::GetFilterResY(nsIDOMSVGAnimatedInteger * *aFilterResY)
already_AddRefed<nsIDOMSVGAnimatedInteger>
SVGFilterElement::FilterResY()
{
return mIntegerPairAttributes[FILTERRES].ToDOMAnimatedInteger(aFilterResY,
nsSVGIntegerPair::eSecond,
return mIntegerPairAttributes[FILTERRES].ToDOMAnimatedInteger(nsSVGIntegerPair::eSecond,
this);
}
/* void setFilterRes (in unsigned long filterResX, in unsigned long filterResY);
*/
NS_IMETHODIMP
void
SVGFilterElement::SetFilterRes(uint32_t filterResX, uint32_t filterResY)
{
mIntegerPairAttributes[FILTERRES].SetBaseValues(filterResX, filterResY, this);
return NS_OK;
}
//----------------------------------------------------------------------
// nsIDOMSVGURIReference methods
/* readonly attribute nsIDOMSVGAnimatedString href; */
NS_IMETHODIMP
SVGFilterElement::GetHref(nsIDOMSVGAnimatedString * *aHref)
NS_IMETHODIMP
SVGFilterElement::GetHref(nsIDOMSVGAnimatedString** aHref)
{
return mStringAttributes[HREF].ToDOMAnimatedString(aHref, this);
*aHref = Href().get();
return NS_OK;
}
already_AddRefed<nsIDOMSVGAnimatedString>
SVGFilterElement::Href()
{
return mStringAttributes[HREF].ToDOMAnimatedString(this);
}
//----------------------------------------------------------------------
@ -192,10 +191,10 @@ SVGFilterElement::Invalidate()
/* virtual */ bool
SVGFilterElement::HasValidDimensions() const
{
return (!mLengthAttributes[WIDTH].IsExplicitlySet() ||
mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0) &&
(!mLengthAttributes[HEIGHT].IsExplicitlySet() ||
mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() > 0);
return (!mLengthAttributes[ATTR_WIDTH].IsExplicitlySet() ||
mLengthAttributes[ATTR_WIDTH].GetAnimValInSpecifiedUnits() > 0) &&
(!mLengthAttributes[ATTR_HEIGHT].IsExplicitlySet() ||
mLengthAttributes[ATTR_HEIGHT].GetAnimValInSpecifiedUnits() > 0);
}
nsSVGElement::LengthAttributesInfo

View File

@ -6,8 +6,6 @@
#ifndef mozilla_dom_SVGFilterElement_h
#define mozilla_dom_SVGFilterElement_h
#include "nsIDOMSVGFilterElement.h"
#include "nsIDOMSVGUnitTypes.h"
#include "nsIDOMSVGURIReference.h"
#include "nsSVGEnum.h"
#include "nsSVGElement.h"
@ -25,11 +23,11 @@ nsresult NS_NewSVGFilterElement(nsIContent **aResult,
namespace mozilla {
namespace dom {
class SVGAnimatedLength;
class SVGFilterElement : public SVGFilterElementBase,
public nsIDOMSVGFilterElement,
public nsIDOMSVGURIReference,
public nsIDOMSVGUnitTypes
public nsIDOMSVGElement,
public nsIDOMSVGURIReference
{
friend class ::nsSVGFilterFrame;
friend class ::nsAutoFilterInstance;
@ -38,12 +36,12 @@ protected:
friend nsresult (::NS_NewSVGFilterElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo));
SVGFilterElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual JSObject* WrapNode(JSContext *cx, JSObject *scope, bool *triedToWrap) MOZ_OVERRIDE;
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGFILTERELEMENT
NS_DECL_NSIDOMSVGURIREFERENCE
// xxx I wish we could use virtual inheritance
@ -58,12 +56,23 @@ public:
// Invalidate users of this filter
void Invalidate();
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
// nsSVGSVGElement methods:
virtual bool HasValidDimensions() const;
// WebIDL
already_AddRefed<SVGAnimatedLength> X();
already_AddRefed<SVGAnimatedLength> Y();
already_AddRefed<SVGAnimatedLength> Width();
already_AddRefed<SVGAnimatedLength> Height();
already_AddRefed<nsIDOMSVGAnimatedEnumeration> FilterUnits();
already_AddRefed<nsIDOMSVGAnimatedEnumeration> PrimitiveUnits();
already_AddRefed<nsIDOMSVGAnimatedInteger> FilterResX();
already_AddRefed<nsIDOMSVGAnimatedInteger> FilterResY();
void SetFilterRes(uint32_t filterResX, uint32_t filterResY);
already_AddRefed<nsIDOMSVGAnimatedString> Href();
protected:
virtual LengthAttributesInfo GetLengthInfo();
@ -71,7 +80,7 @@ protected:
virtual EnumAttributesInfo GetEnumInfo();
virtual StringAttributesInfo GetStringInfo();
enum { X, Y, WIDTH, HEIGHT };
enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT };
nsSVGLength2 mLengthAttributes[4];
static LengthInfo sLengthInfo[4];

View File

@ -36,7 +36,7 @@ nsSVGElement::EnumInfo SVGGradientElement::sEnumInfo[2] =
{
{ &nsGkAtoms::gradientUnits,
sSVGUnitTypesMap,
nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
},
{ &nsGkAtoms::spreadMethod,
sSpreadMethodMap,
@ -57,7 +57,6 @@ NS_IMPL_RELEASE_INHERITED(SVGGradientElement, SVGGradientElementBase)
NS_INTERFACE_MAP_BEGIN(SVGGradientElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGURIReference)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGUnitTypes)
NS_INTERFACE_MAP_END_INHERITING(SVGGradientElementBase)
//----------------------------------------------------------------------

View File

@ -7,7 +7,6 @@
#define __NS_SVGGRADIENTELEMENT_H__
#include "nsIDOMSVGURIReference.h"
#include "nsIDOMSVGUnitTypes.h"
#include "nsSVGElement.h"
#include "nsSVGLength2.h"
#include "nsSVGEnum.h"
@ -42,7 +41,6 @@ typedef nsSVGElement SVGGradientElementBase;
class SVGGradientElement : public SVGGradientElementBase
, public nsIDOMSVGURIReference
, public nsIDOMSVGUnitTypes
{
friend class ::nsSVGGradientFrame;

View File

@ -38,11 +38,11 @@ nsSVGElement::EnumInfo SVGMaskElement::sEnumInfo[2] =
{
{ &nsGkAtoms::maskUnits,
sSVGUnitTypesMap,
nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
},
{ &nsGkAtoms::maskContentUnits,
sSVGUnitTypesMap,
nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE
SVG_UNIT_TYPE_USERSPACEONUSE
}
};
@ -53,9 +53,9 @@ NS_IMPL_ADDREF_INHERITED(SVGMaskElement,SVGMaskElementBase)
NS_IMPL_RELEASE_INHERITED(SVGMaskElement,SVGMaskElementBase)
NS_INTERFACE_TABLE_HEAD(SVGMaskElement)
NS_NODE_INTERFACE_TABLE5(SVGMaskElement, nsIDOMNode, nsIDOMElement,
NS_NODE_INTERFACE_TABLE4(SVGMaskElement, nsIDOMNode, nsIDOMElement,
nsIDOMSVGElement,
nsIDOMSVGMaskElement, nsIDOMSVGUnitTypes)
nsIDOMSVGMaskElement)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGMaskElement)
NS_INTERFACE_MAP_END_INHERITING(SVGMaskElementBase)

View File

@ -7,7 +7,6 @@
#define mozilla_dom_SVGMaskElement_h
#include "nsIDOMSVGMaskElement.h"
#include "nsIDOMSVGUnitTypes.h"
#include "nsSVGEnum.h"
#include "nsSVGLength2.h"
#include "nsSVGElement.h"
@ -25,8 +24,7 @@ namespace dom {
typedef nsSVGElement SVGMaskElementBase;
class SVGMaskElement MOZ_FINAL : public SVGMaskElementBase,
public nsIDOMSVGMaskElement,
public nsIDOMSVGUnitTypes
public nsIDOMSVGMaskElement
{
friend class ::nsSVGMaskFrame;

View File

@ -38,11 +38,11 @@ nsSVGElement::EnumInfo SVGPatternElement::sEnumInfo[2] =
{
{ &nsGkAtoms::patternUnits,
sSVGUnitTypesMap,
nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
},
{ &nsGkAtoms::patternContentUnits,
sSVGUnitTypesMap,
nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE
SVG_UNIT_TYPE_USERSPACEONUSE
}
};
@ -54,11 +54,10 @@ nsSVGElement::StringInfo SVGPatternElement::sStringInfo[1] =
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ISUPPORTS_INHERITED5(SVGPatternElement, SVGPatternElementBase,
NS_IMPL_ISUPPORTS_INHERITED4(SVGPatternElement, SVGPatternElementBase,
nsIDOMNode, nsIDOMElement,
nsIDOMSVGElement,
nsIDOMSVGURIReference,
nsIDOMSVGUnitTypes)
nsIDOMSVGURIReference)
//----------------------------------------------------------------------
// Implementation

View File

@ -6,7 +6,6 @@
#ifndef mozilla_dom_SVGPatternElement_h
#define mozilla_dom_SVGPatternElement_h
#include "nsIDOMSVGUnitTypes.h"
#include "nsIDOMSVGURIReference.h"
#include "nsSVGEnum.h"
#include "nsSVGLength2.h"
@ -30,8 +29,7 @@ typedef nsSVGElement SVGPatternElementBase;
class SVGPatternElement MOZ_FINAL : public SVGPatternElementBase,
public nsIDOMSVGElement,
public nsIDOMSVGURIReference,
public nsIDOMSVGUnitTypes
public nsIDOMSVGURIReference
{
friend class ::nsSVGPatternFrame;

View File

@ -49,7 +49,6 @@
#include "SVGAnimatedTransformList.h"
#include "SVGContentUtils.h"
#include "DOMSVGTests.h"
#include "nsIDOMSVGUnitTypes.h"
#include "nsSVGRect.h"
#include "nsIFrame.h"
#include "prdtoa.h"
@ -72,8 +71,8 @@ PR_STATIC_ASSERT(sizeof(void*) == sizeof(nullptr));
nsSVGEnumMapping nsSVGElement::sSVGUnitTypesMap[] = {
{&nsGkAtoms::userSpaceOnUse, nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE},
{&nsGkAtoms::objectBoundingBox, nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX},
{&nsGkAtoms::userSpaceOnUse, SVG_UNIT_TYPE_USERSPACEONUSE},
{&nsGkAtoms::objectBoundingBox, SVG_UNIT_TYPE_OBJECTBOUNDINGBOX},
{nullptr, 0}
};

View File

@ -38,6 +38,11 @@ namespace mozilla {
namespace dom {
class CSSValue;
class SVGSVGElement;
static const unsigned short SVG_UNIT_TYPE_UNKNOWN = 0;
static const unsigned short SVG_UNIT_TYPE_USERSPACEONUSE = 1;
static const unsigned short SVG_UNIT_TYPE_OBJECTBOUNDINGBOX = 2;
}
class SVGAnimatedNumberList;

View File

@ -15,7 +15,6 @@
#include "nsIDOMSVGFilters.h"
#include "nsCOMPtr.h"
#include "nsSVGFilterInstance.h"
#include "nsIDOMSVGFilterElement.h"
#include "nsSVGEnum.h"
#include "SVGNumberList.h"
#include "SVGAnimatedNumberList.h"
@ -5754,8 +5753,7 @@ nsSVGFEImageElement::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRec
void
nsSVGFEImageElement::Invalidate()
{
nsCOMPtr<nsIDOMSVGFilterElement> filter = do_QueryInterface(GetParent());
if (filter) {
if (GetParent()->IsSVG(nsGkAtoms::filter)) {
static_cast<SVGFilterElement*>(GetParent())->Invalidate();
}
}

View File

@ -172,6 +172,14 @@ nsresult
nsSVGIntegerPair::ToDOMAnimatedInteger(nsIDOMSVGAnimatedInteger **aResult,
PairIndex aIndex,
nsSVGElement *aSVGElement)
{
*aResult = ToDOMAnimatedInteger(aIndex, aSVGElement).get();
return NS_OK;
}
already_AddRefed<nsIDOMSVGAnimatedInteger>
nsSVGIntegerPair::ToDOMAnimatedInteger(PairIndex aIndex,
nsSVGElement* aSVGElement)
{
nsRefPtr<DOMAnimatedInteger> domAnimatedInteger =
aIndex == eFirst ? sSVGFirstAnimatedIntegerTearoffTable.GetTearoff(this) :
@ -185,8 +193,7 @@ nsSVGIntegerPair::ToDOMAnimatedInteger(nsIDOMSVGAnimatedInteger **aResult,
}
}
domAnimatedInteger.forget(aResult);
return NS_OK;
return domAnimatedInteger.forget();
}
nsSVGIntegerPair::DOMAnimatedInteger::~DOMAnimatedInteger()

View File

@ -57,7 +57,10 @@ public:
nsresult ToDOMAnimatedInteger(nsIDOMSVGAnimatedInteger **aResult,
PairIndex aIndex,
nsSVGElement* aSVGElement);
// Returns a new nsISMILAttr object that the caller must delete
already_AddRefed<nsIDOMSVGAnimatedInteger>
ToDOMAnimatedInteger(PairIndex aIndex,
nsSVGElement* aSVGElement);
// Returns a new nsISMILAttr object that the caller must delete
nsISMILAttr* ToSMILAttr(nsSVGElement* aSVGElement);
private:

View File

@ -320,7 +320,6 @@
#include "nsIDOMSVGDocument.h"
#include "nsIDOMSVGElement.h"
#include "nsIDOMSVGEvent.h"
#include "nsIDOMSVGFilterElement.h"
#include "nsIDOMSVGFilters.h"
#include "nsIDOMSVGImageElement.h"
#include "nsIDOMSVGLength.h"
@ -329,7 +328,6 @@
#include "nsIDOMSVGNumber.h"
#include "nsIDOMSVGRect.h"
#include "nsIDOMSVGTitleElement.h"
#include "nsIDOMSVGUnitTypes.h"
#include "nsIDOMSVGURIReference.h"
#include "nsIDOMSVGZoomEvent.h"
@ -1074,8 +1072,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFETurbulenceElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFilterElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGImageElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGMarkerElement, nsElementSH,
@ -3012,13 +3008,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGFilterElement, nsIDOMSVGFilterElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGURIReference)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGUnitTypes)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGImageElement, nsIDOMSVGImageElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGImageElement)
DOM_CLASSINFO_MAP_ENTRY(nsIImageLoadingContent)
@ -3033,7 +3022,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_BEGIN(SVGMaskElement, nsIDOMSVGMaskElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGMaskElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGUnitTypes)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END

View File

@ -219,7 +219,6 @@ DOMCI_CLASS(SVGFESpecularLightingElement)
DOMCI_CLASS(SVGFESpotLightElement)
DOMCI_CLASS(SVGFETileElement)
DOMCI_CLASS(SVGFETurbulenceElement)
DOMCI_CLASS(SVGFilterElement)
DOMCI_CLASS(SVGImageElement)
DOMCI_CLASS(SVGMarkerElement)
DOMCI_CLASS(SVGMaskElement)

View File

@ -27,7 +27,6 @@ XPIDLSRCS = \
nsIDOMSVGDocument.idl \
nsIDOMSVGElement.idl \
nsIDOMSVGEvent.idl \
nsIDOMSVGFilterElement.idl \
nsIDOMSVGFilters.idl \
nsIDOMSVGImageElement.idl \
nsIDOMSVGLength.idl \

View File

@ -0,0 +1,32 @@
/* -*- 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 SVGAnimatedEnumeration;
interface SVGAnimatedInteger;
interface SVGFilterElement : SVGElement {
readonly attribute SVGAnimatedEnumeration filterUnits;
readonly attribute SVGAnimatedEnumeration primitiveUnits;
readonly attribute SVGAnimatedLength x;
readonly attribute SVGAnimatedLength y;
readonly attribute SVGAnimatedLength width;
readonly attribute SVGAnimatedLength height;
readonly attribute SVGAnimatedInteger filterResX;
readonly attribute SVGAnimatedInteger filterResY;
void setFilterRes(unsigned long filterResX, unsigned long filterResY);
// ImageData apply(ImageData source);
};
SVGFilterElement implements SVGURIReference;
SVGFilterElement implements SVGUnitTypes;

View File

@ -10,7 +10,6 @@
* liability, trademark and document use rules apply.
*/
[NoInterfaceObject]
interface SVGUnitTypes {
// Unit Types
const unsigned short SVG_UNIT_TYPE_UNKNOWN = 0;

View File

@ -149,6 +149,7 @@ webidl_files = \
SVGDescElement.webidl \
SVGElement.webidl \
SVGEllipseElement.webidl \
SVGFilterElement.webidl \
SVGFEFuncAElement.webidl \
SVGFEFuncBElement.webidl \
SVGFEFuncGElement.webidl \

View File

@ -165,10 +165,10 @@ nsAutoFilterInstance::nsAutoFilterInstance(nsIFrame *aTarget,
NS_ABORT_IF_FALSE(sizeof(filter->mLengthAttributes) == sizeof(XYWH),
"XYWH size incorrect");
memcpy(XYWH, filter->mLengthAttributes, sizeof(filter->mLengthAttributes));
XYWH[0] = *aFilterFrame->GetLengthValue(SVGFilterElement::X);
XYWH[1] = *aFilterFrame->GetLengthValue(SVGFilterElement::Y);
XYWH[2] = *aFilterFrame->GetLengthValue(SVGFilterElement::WIDTH);
XYWH[3] = *aFilterFrame->GetLengthValue(SVGFilterElement::HEIGHT);
XYWH[0] = *aFilterFrame->GetLengthValue(SVGFilterElement::ATTR_X);
XYWH[1] = *aFilterFrame->GetLengthValue(SVGFilterElement::ATTR_Y);
XYWH[2] = *aFilterFrame->GetLengthValue(SVGFilterElement::ATTR_WIDTH);
XYWH[3] = *aFilterFrame->GetLengthValue(SVGFilterElement::ATTR_HEIGHT);
// The filter region in user space, in user units:
gfxRect filterRegion = nsSVGUtils::GetRelativeRect(filterUnits,
XYWH, bbox, aTarget);

View File

@ -9,7 +9,6 @@
// Keep others in (case-insensitive) order:
#include "gfxPlatform.h"
#include "gfxUtils.h"
#include "nsIDOMSVGUnitTypes.h"
#include "nsISVGChildFrame.h"
#include "nsRenderingContext.h"
#include "mozilla/dom/SVGFilterElement.h"
@ -25,7 +24,7 @@ nsSVGFilterInstance::GetPrimitiveNumber(uint8_t aCtxType, float aValue) const
nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER);
float value;
if (mPrimitiveUnits == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
if (mPrimitiveUnits == mozilla::dom::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
value = nsSVGUtils::ObjectSpace(mTargetBBox, &val);
} else {
value = nsSVGUtils::UserSpace(mTargetFrame, &val);

View File

@ -181,7 +181,7 @@ nsSVGGradientFrame::GetGradientTransform(nsIFrame *aSource,
gfxMatrix bboxMatrix;
uint16_t gradientUnits = GetGradientUnits();
if (gradientUnits == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) {
if (gradientUnits == SVG_UNIT_TYPE_USERSPACEONUSE) {
// If this gradient is applied to text, our caller
// will be the glyph, which is not a container, so we
// need to get the parent
@ -191,7 +191,7 @@ nsSVGGradientFrame::GetGradientTransform(nsIFrame *aSource,
mSource = aSource;
} else {
NS_ASSERTION(
gradientUnits == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX,
gradientUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX,
"Unknown gradientUnits type");
// objectBoundingBox is the default anyway
@ -474,12 +474,12 @@ nsSVGLinearGradientFrame::GetLengthValue(uint32_t aIndex)
// space units as part of the individual Get* routines. Fixes 323669.
uint16_t gradientUnits = GetGradientUnits();
if (gradientUnits == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) {
if (gradientUnits == SVG_UNIT_TYPE_USERSPACEONUSE) {
return nsSVGUtils::UserSpace(mSource, &length);
}
NS_ASSERTION(
gradientUnits == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX,
gradientUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX,
"Unknown gradientUnits type");
return length.GetAnimValue(static_cast<SVGSVGElement*>(nullptr));
@ -605,12 +605,12 @@ nsSVGRadialGradientFrame::GetLengthValueFromElement(uint32_t aIndex,
// space units as part of the individual Get* routines. Fixes 323669.
uint16_t gradientUnits = GetGradientUnits();
if (gradientUnits == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE) {
if (gradientUnits == SVG_UNIT_TYPE_USERSPACEONUSE) {
return nsSVGUtils::UserSpace(mSource, &length);
}
NS_ASSERTION(
gradientUnits == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX,
gradientUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX,
"Unknown gradientUnits type");
return length.GetAnimValue(static_cast<SVGSVGElement*>(nullptr));

View File

@ -46,7 +46,7 @@ nsSVGMaskFrame::ComputeMaskAlpha(nsRenderingContext *aContext,
uint16_t units =
mask->mEnumAttributes[SVGMaskElement::MASKUNITS].GetAnimValue();
gfxRect bbox;
if (units == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
if (units == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
bbox = nsSVGUtils::GetBBox(aParent);
}

View File

@ -155,9 +155,9 @@ IncludeBBoxScale(const nsSVGViewBox& aViewBox,
uint32_t aPatternContentUnits, uint32_t aPatternUnits)
{
return (!aViewBox.IsExplicitlySet() &&
aPatternContentUnits == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) ||
aPatternContentUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) ||
(aViewBox.IsExplicitlySet() &&
aPatternUnits == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
aPatternUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX);
}
// Given the matrix for the pattern element's own transform, this returns a
@ -173,7 +173,7 @@ GetPatternMatrix(uint16_t aPatternUnits,
gfxFloat minx = bbox.X();
gfxFloat miny = bbox.Y();
if (aPatternUnits == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
if (aPatternUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
minx += callerBBox.X();
miny += callerBBox.Y();
}
@ -593,7 +593,7 @@ nsSVGPatternFrame::GetPatternRect(uint16_t aPatternUnits,
tmpHeight = GetLengthValue(SVGPatternElement::ATTR_HEIGHT);
tmpWidth = GetLengthValue(SVGPatternElement::ATTR_WIDTH);
if (aPatternUnits == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
if (aPatternUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
x = nsSVGUtils::ObjectSpace(aTargetBBox, tmpX);
y = nsSVGUtils::ObjectSpace(aTargetBBox, tmpY);
width = nsSVGUtils::ObjectSpace(aTargetBBox, tmpWidth);

View File

@ -23,7 +23,6 @@
#include "nsGkAtoms.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsIDOMSVGUnitTypes.h"
#include "nsIFrame.h"
#include "nsINameSpaceManager.h"
#include "nsIPresShell.h"
@ -1260,7 +1259,7 @@ nsSVGUtils::GetRelativeRect(uint16_t aUnits, const nsSVGLength2 *aXYWH,
const gfxRect &aBBox, nsIFrame *aFrame)
{
float x, y, width, height;
if (aUnits == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
if (aUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
x = aBBox.X() + ObjectSpace(aBBox, &aXYWH[0]);
y = aBBox.Y() + ObjectSpace(aBBox, &aXYWH[1]);
width = ObjectSpace(aBBox, &aXYWH[2]);
@ -1326,8 +1325,7 @@ nsSVGUtils::AdjustMatrixForUnits(const gfxMatrix &aMatrix,
nsIFrame *aFrame)
{
if (aFrame &&
aUnits->GetAnimValue() ==
nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
aUnits->GetAnimValue() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
gfxRect bbox = GetBBox(aFrame);
return gfxMatrix().Scale(bbox.Width(), bbox.Height()) *
gfxMatrix().Translate(gfxPoint(bbox.X(), bbox.Y())) *