Bug 847120: Convert SVGFETileElement to WebIDL r=Ms2ger

This commit is contained in:
David Zbarsky 2013-03-11 03:27:08 -04:00
parent bc2a13320a
commit b82e6139d5
9 changed files with 75 additions and 70 deletions

View File

@ -15,4 +15,4 @@
#
# Note: The description below will be part of the error message shown to users.
#
Bug 848395 resulted in Windows test failures when landed without clobber
Bug 847120 needs a clobber

View File

@ -4,15 +4,22 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/SVGFETileElement.h"
DOMCI_NODE_DATA(SVGFETileElement, nsSVGFETileElement)
#include "mozilla/dom/SVGFETileElementBinding.h"
#include "nsSVGFilterInstance.h"
#include "gfxUtils.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(FETile)
namespace mozilla {
namespace dom {
nsSVGElement::StringInfo nsSVGFETileElement::sStringInfo[2] =
JSObject*
SVGFETileElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
{
return SVGFETileElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
nsSVGElement::StringInfo SVGFETileElement::sStringInfo[2] =
{
{ &nsGkAtoms::result, kNameSpaceID_None, true },
{ &nsGkAtoms::in, kNameSpaceID_None, true }
@ -21,66 +28,53 @@ nsSVGElement::StringInfo nsSVGFETileElement::sStringInfo[2] =
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGFETileElement,nsSVGFETileElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGFETileElement,nsSVGFETileElementBase)
NS_IMPL_ADDREF_INHERITED(SVGFETileElement,SVGFETileElementBase)
NS_IMPL_RELEASE_INHERITED(SVGFETileElement,SVGFETileElementBase)
NS_INTERFACE_TABLE_HEAD(nsSVGFETileElement)
NS_NODE_INTERFACE_TABLE5(nsSVGFETileElement, nsIDOMNode, nsIDOMElement,
nsIDOMSVGElement,
nsIDOMSVGFilterPrimitiveStandardAttributes,
nsIDOMSVGFETileElement)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGFETileElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGFETileElementBase)
NS_INTERFACE_TABLE_HEAD(SVGFETileElement)
NS_NODE_INTERFACE_TABLE3(SVGFETileElement, nsIDOMNode, nsIDOMElement,
nsIDOMSVGElement)
NS_INTERFACE_MAP_END_INHERITING(SVGFETileElementBase)
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFETileElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFETileElement)
//----------------------------------------------------------------------
// nsSVGFETileElement methods
/* readonly attribute nsIDOMSVGAnimatedString in1; */
NS_IMETHODIMP nsSVGFETileElement::GetIn1(nsIDOMSVGAnimatedString * *aIn)
already_AddRefed<nsIDOMSVGAnimatedString>
SVGFETileElement::In1()
{
return mStringAttributes[IN1].ToDOMAnimatedString(aIn, this);
return mStringAttributes[IN1].ToDOMAnimatedString(this);
}
void
nsSVGFETileElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
SVGFETileElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
{
aSources.AppendElement(nsSVGStringInfo(&mStringAttributes[IN1], this));
}
nsIntRect
nsSVGFETileElement::ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
SVGFETileElement::ComputeTargetBBox(const nsTArray<nsIntRect>& aSourceBBoxes,
const nsSVGFilterInstance& aInstance)
{
return GetMaxRect();
}
void
nsSVGFETileElement::ComputeNeededSourceBBoxes(const nsIntRect& aTargetBBox,
SVGFETileElement::ComputeNeededSourceBBoxes(const nsIntRect& aTargetBBox,
nsTArray<nsIntRect>& aSourceBBoxes, const nsSVGFilterInstance& aInstance)
{
// Just assume we need the entire source bounding box, so do nothing.
}
nsIntRect
nsSVGFETileElement::ComputeChangeBBox(const nsTArray<nsIntRect>& aSourceChangeBoxes,
const nsSVGFilterInstance& aInstance)
SVGFETileElement::ComputeChangeBBox(const nsTArray<nsIntRect>& aSourceChangeBoxes,
const nsSVGFilterInstance& aInstance)
{
return GetMaxRect();
}
static int32_t WrapInterval(int32_t aVal, int32_t aMax)
{
aVal = aVal % aMax;
return aVal < 0 ? aMax + aVal : aVal;
}
//----------------------------------------------------------------------
// nsSVGElement methods
@ -230,10 +224,10 @@ TilePixels(uint8_t *aTargetData,
}
nsresult
nsSVGFETileElement::Filter(nsSVGFilterInstance *instance,
const nsTArray<const Image*>& aSources,
const Image* aTarget,
const nsIntRect& rect)
SVGFETileElement::Filter(nsSVGFilterInstance *instance,
const nsTArray<const Image*>& aSources,
const Image* aTarget,
const nsIntRect& rect)
{
// XXX This code depends on the surface rect containing the filter
// primitive subregion. ComputeTargetBBox, ComputeNeededSourceBBoxes
@ -425,11 +419,11 @@ nsSVGFETileElement::Filter(nsSVGFilterInstance *instance,
}
bool
nsSVGFETileElement::AttributeAffectsRendering(int32_t aNameSpaceID,
nsIAtom* aAttribute) const
SVGFETileElement::AttributeAffectsRendering(int32_t aNameSpaceID,
nsIAtom* aAttribute) const
{
return nsSVGFETileElementBase::AttributeAffectsRendering(aNameSpaceID,
aAttribute) ||
return SVGFETileElementBase::AttributeAffectsRendering(aNameSpaceID,
aAttribute) ||
(aNameSpaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::in);
}
@ -437,7 +431,7 @@ nsSVGFETileElement::AttributeAffectsRendering(int32_t aNameSpaceID,
// nsSVGElement methods
nsSVGElement::StringAttributesInfo
nsSVGFETileElement::GetStringInfo()
SVGFETileElement::GetStringInfo()
{
return StringAttributesInfo(mStringAttributes, sStringInfo,
ArrayLength(sStringInfo));

View File

@ -14,16 +14,20 @@ nsresult NS_NewSVGFETileElement(nsIContent **aResult,
namespace mozilla {
namespace dom {
typedef nsSVGFE nsSVGFETileElementBase;
typedef nsSVGFE SVGFETileElementBase;
class nsSVGFETileElement : public nsSVGFETileElementBase,
public nsIDOMSVGFETileElement
class SVGFETileElement : public SVGFETileElementBase,
public nsIDOMSVGElement
{
friend nsresult (::NS_NewSVGFETileElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo));
protected:
nsSVGFETileElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsSVGFETileElementBase(aNodeInfo) {}
SVGFETileElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: SVGFETileElementBase(aNodeInfo)
{
SetIsDOMBinding();
}
virtual JSObject* WrapNode(JSContext *cx, JSObject *scope, bool *triedToWrap) MOZ_OVERRIDE;
public:
virtual bool SubregionIsUnionOfRegions() { return false; }
@ -31,9 +35,6 @@ public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
// FE Base
NS_FORWARD_NSIDOMSVGFILTERPRIMITIVESTANDARDATTRIBUTES(nsSVGFETileElementBase::)
virtual nsresult Filter(nsSVGFilterInstance* aInstance,
const nsTArray<const Image*>& aSources,
const Image* aTarget,
@ -49,19 +50,18 @@ public:
virtual nsIntRect ComputeChangeBBox(const nsTArray<nsIntRect>& aSourceChangeBoxes,
const nsSVGFilterInstance& aInstance);
// Tile
NS_DECL_NSIDOMSVGFETILEELEMENT
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFETileElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(SVGFETileElementBase::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
// WebIDL
already_AddRefed<nsIDOMSVGAnimatedString> In1();
protected:
virtual StringAttributesInfo GetStringInfo();

View File

@ -3336,6 +3336,12 @@ static int32_t BoundInterval(int32_t aVal, int32_t aMax)
return std::min(aVal, aMax - 1);
}
static int32_t WrapInterval(int32_t aVal, int32_t aMax)
{
aVal = aVal % aMax;
return aVal < 0 ? aMax + aVal : aVal;
}
static void
ConvolvePixel(const uint8_t *aSourceData,
uint8_t *aTargetData,

View File

@ -842,8 +842,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFESpotLightElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFETileElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFETurbulenceElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA_WITH_NAME(SVGUnknownElement, SVGElement, nsElementSH,
@ -2334,12 +2332,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGFETileElement, nsIDOMSVGFETileElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFETileElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)
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)

View File

@ -134,7 +134,6 @@ DOMCI_CLASS(SVGFEOffsetElement)
DOMCI_CLASS(SVGFEPointLightElement)
DOMCI_CLASS(SVGFESpecularLightingElement)
DOMCI_CLASS(SVGFESpotLightElement)
DOMCI_CLASS(SVGFETileElement)
DOMCI_CLASS(SVGFETurbulenceElement)
DOMCI_CLASS(SVGUnknownElement)

View File

@ -125,12 +125,6 @@ interface nsIDOMSVGFEOffsetElement : nsIDOMSVGFilterPrimitiveStandardAttributes
readonly attribute nsIDOMSVGAnimatedNumber dy;
};
[scriptable, uuid(5c7c7ad9-1829-43c4-87b3-1e64c4f51f7a)]
interface nsIDOMSVGFETileElement : nsIDOMSVGFilterPrimitiveStandardAttributes
{
readonly attribute nsIDOMSVGAnimatedString in1;
};
[scriptable, uuid(d60f68fc-179f-430d-ab0d-ff868db7d548)]
interface nsIDOMSVGFETurbulenceElement : nsIDOMSVGFilterPrimitiveStandardAttributes
{

View File

@ -0,0 +1,19 @@
/* -*- 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 SVGFETileElement : SVGElement {
readonly attribute SVGAnimatedString in1;
};
SVGFETileElement implements SVGFilterPrimitiveStandardAttributes;

View File

@ -171,6 +171,7 @@ webidl_files = \
SVGFEImageElement.webidl \
SVGFEMergeElement.webidl \
SVGFEMergeNodeElement.webidl \
SVGFETileElement.webidl \
SVGFitToViewBox.webidl \
SVGForeignObjectElement.webidl \
SVGGElement.webidl \