Bug 847202: Convert SVGFEMergeNodeElement to WebIDL r=Ms2ger

--HG--
rename : content/svg/content/src/nsSVGFilters.cpp => content/svg/content/src/SVGFEMergeNodeElement.cpp
rename : content/svg/content/src/nsSVGFilters.cpp => content/svg/content/src/SVGFEMergeNodeElement.h
This commit is contained in:
David Zbarsky 2013-03-07 04:15:22 -05:00
Родитель d14158014b
Коммит cfdd9c0f5b
10 изменённых файлов: 155 добавлений и 129 удалений

Просмотреть файл

@ -81,6 +81,7 @@ CPPSRCS = \
SVGEllipseElement.cpp \
SVGFEBlendElement.cpp \
SVGFEMergeElement.cpp \
SVGFEMergeNodeElement.cpp \
SVGFilterElement.cpp \
SVGForeignObjectElement.cpp \
SVGFragmentIdentifier.cpp \
@ -174,6 +175,7 @@ EXPORTS_mozilla/dom = \
SVGEllipseElement.h \
SVGFEBlendElement.h \
SVGFEMergeElement.h \
SVGFEMergeNodeElement.h \
SVGFilterElement.h \
SVGForeignObjectElement.h \
SVGGElement.h \

Просмотреть файл

@ -5,6 +5,7 @@
#include "mozilla/dom/SVGFEMergeElement.h"
#include "mozilla/dom/SVGFEMergeElementBinding.h"
#include "mozilla/dom/SVGFEMergeNodeElement.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(FEMerge)
@ -53,10 +54,9 @@ SVGFEMergeElement::GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources)
for (nsIContent* child = nsINode::GetFirstChild();
child;
child = child->GetNextSibling()) {
nsRefPtr<nsSVGFEMergeNodeElement> node;
CallQueryInterface(child, (nsSVGFEMergeNodeElement**)getter_AddRefs(node));
if (node) {
aSources.AppendElement(nsSVGStringInfo(node->In1(), node));
if (child->IsSVG(nsGkAtoms::feMergeNode)) {
SVGFEMergeNodeElement* node = static_cast<SVGFEMergeNodeElement*>(child);
aSources.AppendElement(nsSVGStringInfo(node->GetIn1(), node));
}
}
}

Просмотреть файл

@ -0,0 +1,68 @@
/* -*- Mode: C++; 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/. */
#include "mozilla/dom/SVGFEMergeNodeElement.h"
#include "mozilla/dom/SVGFEMergeNodeElementBinding.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(FEMergeNode)
namespace mozilla {
namespace dom {
JSObject*
SVGFEMergeNodeElement::WrapNode(JSContext* aCx, JSObject* aScope, bool* aTriedToWrap)
{
return SVGFEMergeNodeElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
nsSVGElement::StringInfo SVGFEMergeNodeElement::sStringInfo[1] =
{
{ &nsGkAtoms::in, kNameSpaceID_None, true }
};
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(SVGFEMergeNodeElement,SVGFEMergeNodeElementBase)
NS_IMPL_RELEASE_INHERITED(SVGFEMergeNodeElement,SVGFEMergeNodeElementBase)
NS_INTERFACE_TABLE_HEAD(SVGFEMergeNodeElement)
NS_NODE_INTERFACE_TABLE3(SVGFEMergeNodeElement, nsIDOMNode, nsIDOMElement,
nsIDOMSVGElement)
NS_INTERFACE_MAP_END_INHERITING(SVGFEMergeNodeElementBase)
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEMergeNodeElement)
//----------------------------------------------------------------------
// nsFEUnstyledElement methods
bool
SVGFEMergeNodeElement::AttributeAffectsRendering(int32_t aNameSpaceID,
nsIAtom* aAttribute) const
{
return aNameSpaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::in;
}
already_AddRefed<nsIDOMSVGAnimatedString>
SVGFEMergeNodeElement::In1()
{
return mStringAttributes[IN1].ToDOMAnimatedString(this);
}
//----------------------------------------------------------------------
// nsSVGElement methods
nsSVGElement::StringAttributesInfo
SVGFEMergeNodeElement::GetStringInfo()
{
return StringAttributesInfo(mStringAttributes, sStringInfo,
ArrayLength(sStringInfo));
}
} // namespace dom
} // namespace mozilla

Просмотреть файл

@ -0,0 +1,63 @@
/* -*- Mode: C++; 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/. */
#ifndef mozilla_dom_SVGFEMergeNodeElement_h
#define mozilla_dom_SVGFEMergeNodeElement_h
#include "nsSVGFilters.h"
nsresult NS_NewSVGFEMergeNodeElement(nsIContent** aResult,
already_AddRefed<nsINodeInfo> aNodeInfo);
namespace mozilla {
namespace dom {
typedef SVGFEUnstyledElement SVGFEMergeNodeElementBase;
class SVGFEMergeNodeElement : public SVGFEMergeNodeElementBase,
public nsIDOMSVGElement
{
friend nsresult (::NS_NewSVGFEMergeNodeElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo));
protected:
SVGFEMergeNodeElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: SVGFEMergeNodeElementBase(aNodeInfo)
{
SetIsDOMBinding();
}
virtual JSObject* WrapNode(JSContext* aCx, JSObject* aScope, bool* aTriedToWrap) MOZ_OVERRIDE;
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_FORWARD_NSIDOMSVGELEMENT(SVGFEMergeNodeElementBase::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const;
const nsSVGString* GetIn1() { return &mStringAttributes[IN1]; }
virtual nsIDOMNode* AsDOMNode() { return this; }
// WebIDL
already_AddRefed<nsIDOMSVGAnimatedString> In1();
protected:
virtual StringAttributesInfo GetStringInfo();
enum { IN1 };
nsSVGString mStringAttributes[1];
static StringInfo sStringInfo[1];
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_SVGFEMergeNodeElement_h

Просмотреть файл

@ -1988,118 +1988,6 @@ NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFEFuncAElement)
} // namespace dom
} // namespace mozilla
typedef SVGFEUnstyledElement nsSVGFEMergeNodeElementBase;
#define NS_SVG_FE_MERGE_NODE_CID \
{ 0x413687ec, 0x77fd, 0x4077, \
{ 0x9d, 0x7a, 0x97, 0x51, 0xa8, 0x4b, 0x7b, 0x40 } }
class nsSVGFEMergeNodeElement : public nsSVGFEMergeNodeElementBase,
public nsIDOMSVGFEMergeNodeElement
{
friend nsresult NS_NewSVGFEMergeNodeElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo);
protected:
nsSVGFEMergeNodeElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsSVGFEMergeNodeElementBase(aNodeInfo) {}
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_SVG_FE_MERGE_NODE_CID)
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGFEMERGENODEELEMENT
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGFEMergeNodeElementBase::)
NS_FORWARD_NSIDOMNODE_TO_NSINODE
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual bool AttributeAffectsRendering(
int32_t aNameSpaceID, nsIAtom* aAttribute) const;
const nsSVGString* In1() { return &mStringAttributes[IN1]; }
operator nsISupports*() { return static_cast<nsIContent*>(this); }
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
protected:
virtual StringAttributesInfo GetStringInfo();
enum { IN1 };
nsSVGString mStringAttributes[1];
static StringInfo sStringInfo[1];
};
//---------------------Merge Node------------------------
NS_DEFINE_STATIC_IID_ACCESSOR(nsSVGFEMergeNodeElement, NS_SVG_FE_MERGE_NODE_CID)
nsSVGElement::StringInfo nsSVGFEMergeNodeElement::sStringInfo[1] =
{
{ &nsGkAtoms::in, kNameSpaceID_None, true }
};
NS_IMPL_NS_NEW_SVG_ELEMENT(FEMergeNode)
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGFEMergeNodeElement,nsSVGFEMergeNodeElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGFEMergeNodeElement,nsSVGFEMergeNodeElementBase)
DOMCI_NODE_DATA(SVGFEMergeNodeElement, nsSVGFEMergeNodeElement)
NS_INTERFACE_TABLE_HEAD(nsSVGFEMergeNodeElement)
NS_NODE_INTERFACE_TABLE4(nsSVGFEMergeNodeElement, nsIDOMNode, nsIDOMElement,
nsIDOMSVGElement, nsIDOMSVGFEMergeNodeElement)
// nsISupports is an ambiguous base of nsSVGFE so we have to work
// around that
if ( aIID.Equals(NS_GET_IID(nsSVGFEMergeNodeElement)) )
foundInterface = static_cast<nsISupports*>(static_cast<void*>(this));
else
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGFEMergeNodeElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGFEMergeNodeElementBase)
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFEMergeNodeElement)
//----------------------------------------------------------------------
// nsFEUnstyledElement methods
bool
nsSVGFEMergeNodeElement::AttributeAffectsRendering(int32_t aNameSpaceID,
nsIAtom* aAttribute) const
{
return aNameSpaceID == kNameSpaceID_None && aAttribute == nsGkAtoms::in;
}
//----------------------------------------------------------------------
// nsIDOMSVGFEMergeNodeElement methods
/* readonly attribute nsIDOMSVGAnimatedString in1; */
NS_IMETHODIMP nsSVGFEMergeNodeElement::GetIn1(nsIDOMSVGAnimatedString * *aIn)
{
return mStringAttributes[IN1].ToDOMAnimatedString(aIn, this);
}
//----------------------------------------------------------------------
// nsSVGElement methods
nsSVGElement::StringAttributesInfo
nsSVGFEMergeNodeElement::GetStringInfo()
{
return StringAttributesInfo(mStringAttributes, sStringInfo,
ArrayLength(sStringInfo));
}
//---------------------Offset------------------------
typedef nsSVGFE nsSVGFEOffsetElementBase;

Просмотреть файл

@ -836,8 +836,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFEImageElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFEMergeNodeElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFEMorphologyElement, nsElementSH,
ELEMENT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(SVGFEOffsetElement, nsElementSH,
@ -2337,11 +2335,6 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGFEMergeNodeElement, nsIDOMSVGFEMergeNodeElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEMergeNodeElement)
DOM_CLASSINFO_SVG_ELEMENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(SVGFEOffsetElement, nsIDOMSVGFEOffsetElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFEOffsetElement)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGFilterPrimitiveStandardAttributes)

Просмотреть файл

@ -131,7 +131,6 @@ DOMCI_CLASS(SVGFEDistantLightElement)
DOMCI_CLASS(SVGFEFloodElement)
DOMCI_CLASS(SVGFEGaussianBlurElement)
DOMCI_CLASS(SVGFEImageElement)
DOMCI_CLASS(SVGFEMergeNodeElement)
DOMCI_CLASS(SVGFEMorphologyElement)
DOMCI_CLASS(SVGFEOffsetElement)
DOMCI_CLASS(SVGFEPointLightElement)

Просмотреть файл

@ -118,11 +118,6 @@ interface nsIDOMSVGFEGaussianBlurElement : nsIDOMSVGFilterPrimitiveStandardAttri
void setStdDeviation ( in float stdDeviationX, in float stdDeviationY );
};
[scriptable, uuid(517828DE-69F7-4FAB-915E-862E4F77493D)]
interface nsIDOMSVGFEMergeNodeElement : nsIDOMSVGElement {
readonly attribute nsIDOMSVGAnimatedString in1;
};
[scriptable, uuid(0BAE928A-92FE-4C5F-A8CB-DAED171FA6A2)]
interface nsIDOMSVGFEOffsetElement : nsIDOMSVGFilterPrimitiveStandardAttributes {
readonly attribute nsIDOMSVGAnimatedString in1;

Просмотреть файл

@ -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 SVGFEMergeNodeElement : SVGElement {
readonly attribute SVGAnimatedString in1;
};

Просмотреть файл

@ -166,6 +166,7 @@ webidl_files = \
SVGFEFuncGElement.webidl \
SVGFEFuncRElement.webidl \
SVGFEMergeElement.webidl \
SVGFEMergeNodeElement.webidl \
SVGFitToViewBox.webidl \
SVGForeignObjectElement.webidl \
SVGGElement.webidl \