Bug 824327: Convert SVGStopElement to WebIDL r=bz

--HG--
rename : content/svg/content/src/nsSVGStopElement.cpp => content/svg/content/src/SVGStopElement.cpp
rename : content/svg/content/src/nsSVGStopElement.cpp => content/svg/content/src/SVGStopElement.h
This commit is contained in:
David Zbarsky 2013-01-04 17:28:05 -05:00
parent e23a76a563
commit 7ff930a99f
7 changed files with 180 additions and 119 deletions

View File

@ -78,7 +78,6 @@ CPPSRCS = \
nsSVGRect.cpp \
nsSVGRectElement.cpp \
nsSVGSVGElement.cpp \
nsSVGStopElement.cpp \
nsSVGStyleElement.cpp \
nsSVGSwitchElement.cpp \
nsSVGSymbolElement.cpp \
@ -133,6 +132,7 @@ CPPSRCS = \
SVGOrientSMILType.cpp \
SVGPathSegListSMILType.cpp \
SVGPointListSMILType.cpp \
SVGStopElement.cpp \
SVGTransformListSMILType.cpp \
SVGViewBoxSMILType.cpp \
$(NULL)
@ -155,6 +155,7 @@ EXPORTS_mozilla/dom = \
SVGAnimatedAngle.h \
SVGAnimatedBoolean.h \
SVGDescElement.h \
SVGStopElement.h \
SVGTitleElement.h \
$(NULL)

View File

@ -0,0 +1,93 @@
/* -*- 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/SVGStopElement.h"
#include "mozilla/dom/SVGStopElementBinding.h"
DOMCI_NODE_DATA(SVGStopElement, mozilla::dom::SVGStopElement)
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Stop)
namespace mozilla {
namespace dom {
JSObject*
SVGStopElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
{
return SVGStopElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
nsSVGElement::NumberInfo SVGStopElement::sNumberInfo =
{ &nsGkAtoms::offset, 0, true };
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(SVGStopElement, SVGStopElementBase)
NS_IMPL_RELEASE_INHERITED(SVGStopElement, SVGStopElementBase)
NS_INTERFACE_TABLE_HEAD(SVGStopElement)
NS_NODE_INTERFACE_TABLE4(SVGStopElement, nsIDOMNode, nsIDOMElement,
nsIDOMSVGElement, nsIDOMSVGStopElement)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGStopElement)
NS_INTERFACE_MAP_END_INHERITING(SVGStopElementBase)
//----------------------------------------------------------------------
// Implementation
SVGStopElement::SVGStopElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: SVGStopElementBase(aNodeInfo)
{
SetIsDOMBinding();
}
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGStopElement)
//----------------------------------------------------------------------
// nsIDOMSVGStopElement methods
/* readonly attribute nsIDOMSVGAnimatedNumber offset; */
NS_IMETHODIMP SVGStopElement::GetOffset(nsIDOMSVGAnimatedNumber * *aOffset)
{
return mOffset.ToDOMAnimatedNumber(aOffset,this);
}
already_AddRefed<nsIDOMSVGAnimatedNumber>
SVGStopElement::Offset()
{
nsCOMPtr<nsIDOMSVGAnimatedNumber> offset;
mOffset.ToDOMAnimatedNumber(getter_AddRefs(offset), this);
return offset.forget();
}
//----------------------------------------------------------------------
// sSVGElement methods
nsSVGElement::NumberAttributesInfo
SVGStopElement::GetNumberInfo()
{
return NumberAttributesInfo(&mOffset, &sNumberInfo, 1);
}
//----------------------------------------------------------------------
// nsIContent methods
NS_IMETHODIMP_(bool)
SVGStopElement::IsAttributeMapped(const nsIAtom* name) const
{
static const MappedAttributeEntry* const map[] = {
sGradientStopMap
};
return FindAttributeDependence(name, map) ||
SVGStopElementBase::IsAttributeMapped(name);
}
} // namespace dom
} // namespace mozilla

View File

@ -0,0 +1,65 @@
/* -*- 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_SVGStopElement_h
#define mozilla_dom_SVGStopElement_h
#include "nsSVGElement.h"
#include "nsSVGNumber2.h"
#include "nsIDOMSVGStopElement.h"
nsresult NS_NewSVGStopElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo);
typedef nsSVGElement SVGStopElementBase;
namespace mozilla {
namespace dom {
class SVGStopElement MOZ_FINAL : public SVGStopElementBase,
public nsIDOMSVGStopElement
{
protected:
friend nsresult (::NS_NewSVGStopElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo));
SVGStopElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual JSObject* WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap) MOZ_OVERRIDE;
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGSTOPELEMENT
// xxx If xpcom allowed virtual inheritance we wouldn't need to
// forward here :-(
NS_FORWARD_NSIDOMNODE_TO_NSINODE
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
NS_FORWARD_NSIDOMSVGELEMENT(SVGStopElementBase::)
// nsIContent interface
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
// WebIDL
already_AddRefed<nsIDOMSVGAnimatedNumber> Offset();
protected:
virtual NumberAttributesInfo GetNumberInfo();
// nsIDOMSVGStopElement properties:
nsSVGNumber2 mOffset;
static NumberInfo sNumberInfo;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_SVGStopElement_h

View File

@ -1,118 +0,0 @@
/* -*- 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/Util.h"
#include "nsSVGElement.h"
#include "nsIDOMSVGStopElement.h"
#include "nsSVGNumber2.h"
#include "nsGenericHTMLElement.h"
using namespace mozilla;
typedef nsSVGElement nsSVGStopElementBase;
class nsSVGStopElement : public nsSVGStopElementBase,
public nsIDOMSVGStopElement
{
protected:
friend nsresult NS_NewSVGStopElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo);
nsSVGStopElement(already_AddRefed<nsINodeInfo> aNodeInfo);
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGSTOPELEMENT
// xxx If xpcom allowed virtual inheritance we wouldn't need to
// forward here :-(
NS_FORWARD_NSIDOMNODE_TO_NSINODE
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGStopElementBase::)
// nsIContent interface
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual nsXPCClassInfo* GetClassInfo();
virtual nsIDOMNode* AsDOMNode() { return this; }
protected:
virtual NumberAttributesInfo GetNumberInfo();
// nsIDOMSVGStopElement properties:
nsSVGNumber2 mOffset;
static NumberInfo sNumberInfo;
};
nsSVGElement::NumberInfo nsSVGStopElement::sNumberInfo =
{ &nsGkAtoms::offset, 0, true };
NS_IMPL_NS_NEW_SVG_ELEMENT(Stop)
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGStopElement,nsSVGStopElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGStopElement,nsSVGStopElementBase)
DOMCI_NODE_DATA(SVGStopElement, nsSVGStopElement)
NS_INTERFACE_TABLE_HEAD(nsSVGStopElement)
NS_NODE_INTERFACE_TABLE4(nsSVGStopElement, nsIDOMNode, nsIDOMElement,
nsIDOMSVGElement, nsIDOMSVGStopElement)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGStopElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGStopElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGStopElement::nsSVGStopElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsSVGStopElementBase(aNodeInfo)
{
}
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGStopElement)
//----------------------------------------------------------------------
// nsIDOMSVGStopElement methods
/* readonly attribute nsIDOMSVGAnimatedNumber offset; */
NS_IMETHODIMP nsSVGStopElement::GetOffset(nsIDOMSVGAnimatedNumber * *aOffset)
{
return mOffset.ToDOMAnimatedNumber(aOffset,this);
}
//----------------------------------------------------------------------
// nsSVGElement methods
nsSVGElement::NumberAttributesInfo
nsSVGStopElement::GetNumberInfo()
{
return NumberAttributesInfo(&mOffset, &sNumberInfo, 1);
}
//----------------------------------------------------------------------
// nsIContent methods
NS_IMETHODIMP_(bool)
nsSVGStopElement::IsAttributeMapped(const nsIAtom* name) const
{
static const MappedAttributeEntry* const map[] = {
sGradientStopMap
};
return FindAttributeDependence(name, map) ||
nsSVGStopElementBase::IsAttributeMapped(name);
}

View File

@ -1122,6 +1122,7 @@ addExternalIface('ProcessingInstruction', nativeType='nsXMLProcessingInstruction
addExternalIface('Range', nativeType='nsRange')
addExternalIface('Selection', nativeType='nsISelection')
addExternalIface('StyleSheetList')
addExternalIface('SVGAnimatedNumber')
addExternalIface('SVGAnimatedString')
addExternalIface('SVGLength')
addExternalIface('SVGNumber')

View File

@ -0,0 +1,18 @@
/* -*- 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 SVGAnimatedNumber;
interface SVGStopElement : SVGElement {
readonly attribute SVGAnimatedNumber offset;
};

View File

@ -106,6 +106,7 @@ webidl_files = \
SVGPoint.webidl \
SVGPointList.webidl \
SVGPreserveAspectRatio.webidl \
SVGStopElement.webidl \
SVGTitleElement.webidl \
SVGTransform.webidl \
SVGTransformList.webidl \