Bug 825732: Convert SVGTSpanElement to WebIDL r=bz

--HG--
rename : content/svg/content/src/nsSVGTSpanElement.cpp => content/svg/content/src/SVGTSpanElement.cpp
rename : content/svg/content/src/nsSVGTSpanElement.cpp => content/svg/content/src/SVGTSpanElement.h
This commit is contained in:
David Zbarsky 2013-01-06 09:14:44 -05:00
parent 8408a43708
commit cb9307ea4a
6 changed files with 165 additions and 123 deletions

View File

@ -66,7 +66,6 @@ CPPSRCS = \
nsSVGRect.cpp \
nsSVGSVGElement.cpp \
nsSVGSymbolElement.cpp \
nsSVGTSpanElement.cpp \
nsSVGUnknownElement.cpp \
nsSVGUseElement.cpp \
nsSVGViewBox.cpp \
@ -136,6 +135,7 @@ CPPSRCS = \
SVGTransformList.cpp \
SVGTransformListParser.cpp \
SVGTransformListSMILType.cpp \
SVGTSpanElement.cpp \
SVGViewBoxSMILType.cpp \
$(NULL)
@ -186,6 +186,7 @@ EXPORTS_mozilla/dom = \
SVGTextPositioningElement.h \
SVGTitleElement.h \
SVGTransformableElement.h \
SVGTSpanElement.h \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -0,0 +1,87 @@
/* -*- 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/SVGTSpanElement.h"
#include "mozilla/dom/SVGTSpanElementBinding.h"
DOMCI_NODE_DATA(SVGTSpanElement, mozilla::dom::SVGTSpanElement)
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(TSpan)
namespace mozilla {
namespace dom {
JSObject*
SVGTSpanElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
{
return SVGTSpanElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(SVGTSpanElement,SVGTSpanElementBase)
NS_IMPL_RELEASE_INHERITED(SVGTSpanElement,SVGTSpanElementBase)
NS_INTERFACE_TABLE_HEAD(SVGTSpanElement)
NS_NODE_INTERFACE_TABLE6(SVGTSpanElement, nsIDOMNode, nsIDOMElement,
nsIDOMSVGElement, nsIDOMSVGTSpanElement,
nsIDOMSVGTextPositioningElement,
nsIDOMSVGTextContentElement)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGTSpanElement)
NS_INTERFACE_MAP_END_INHERITING(SVGTSpanElementBase)
//----------------------------------------------------------------------
// Implementation
SVGTSpanElement::SVGTSpanElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: SVGTSpanElementBase(aNodeInfo)
{
SetIsDOMBinding();
}
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGTSpanElement)
//----------------------------------------------------------------------
// nsIDOMSVGTSpanElement methods
// - no methods -
//----------------------------------------------------------------------
// nsIContent methods
NS_IMETHODIMP_(bool)
SVGTSpanElement::IsAttributeMapped(const nsIAtom* name) const
{
static const MappedAttributeEntry* const map[] = {
sColorMap,
sFillStrokeMap,
sFontSpecificationMap,
sGraphicsMap,
sTextContentElementsMap
};
return FindAttributeDependence(name, map) ||
SVGTSpanElementBase::IsAttributeMapped(name);
}
//----------------------------------------------------------------------
// nsSVGElement overrides
bool
SVGTSpanElement::IsEventName(nsIAtom* aName)
{
return nsContentUtils::IsEventAttributeName(aName, EventNameType_SVGGraphic);
}
} // namespace dom
} // namespace mozilla

View File

@ -0,0 +1,60 @@
/* -*- 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_SVGTSpanElement_h
#define mozilla_dom_SVGTSpanElement_h
#include "mozilla/dom/SVGTextPositioningElement.h"
#include "nsIDOMSVGTSpanElement.h"
nsresult NS_NewSVGTSpanElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo);
namespace mozilla {
namespace dom {
typedef SVGTextPositioningElement SVGTSpanElementBase;
class SVGTSpanElement MOZ_FINAL : public SVGTSpanElementBase, // = nsIDOMSVGTextPositioningElement
public nsIDOMSVGTSpanElement
{
protected:
friend nsresult (::NS_NewSVGTSpanElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo));
SVGTSpanElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual JSObject* WrapNode(JSContext *cx, JSObject *scope, bool *triedToWrap) MOZ_OVERRIDE;
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGTSPANELEMENT
// 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(SVGTSpanElementBase::)
NS_FORWARD_NSIDOMSVGTEXTCONTENTELEMENT(SVGTSpanElementBase::)
NS_FORWARD_NSIDOMSVGTEXTPOSITIONINGELEMENT(SVGTSpanElementBase::)
// 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:
// nsSVGElement overrides
virtual bool IsEventName(nsIAtom* aName);
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_SVGTSpanElement_h

View File

@ -1,122 +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 "nsGkAtoms.h"
#include "nsIDOMSVGTSpanElement.h"
#include "nsSVGSVGElement.h"
#include "SVGTextPositioningElement.h"
#include "nsContentUtils.h"
using namespace mozilla;
typedef dom::SVGTextPositioningElement nsSVGTSpanElementBase;
class nsSVGTSpanElement : public nsSVGTSpanElementBase, // = nsIDOMSVGTextPositioningElement
public nsIDOMSVGTSpanElement
{
protected:
friend nsresult NS_NewSVGTSpanElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo);
nsSVGTSpanElement(already_AddRefed<nsINodeInfo> aNodeInfo);
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGTSPANELEMENT
// 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(nsSVGTSpanElementBase::)
NS_FORWARD_NSIDOMSVGTEXTCONTENTELEMENT(nsSVGTSpanElementBase::)
NS_FORWARD_NSIDOMSVGTEXTPOSITIONINGELEMENT(nsSVGTSpanElementBase::)
// 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; }
virtual bool IsEventAttributeName(nsIAtom* aName) MOZ_OVERRIDE;
};
NS_IMPL_NS_NEW_SVG_ELEMENT(TSpan)
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGTSpanElement,nsSVGTSpanElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGTSpanElement,nsSVGTSpanElementBase)
DOMCI_NODE_DATA(SVGTSpanElement, nsSVGTSpanElement)
NS_INTERFACE_TABLE_HEAD(nsSVGTSpanElement)
NS_NODE_INTERFACE_TABLE6(nsSVGTSpanElement, nsIDOMNode, nsIDOMElement,
nsIDOMSVGElement, nsIDOMSVGTSpanElement,
nsIDOMSVGTextPositioningElement,
nsIDOMSVGTextContentElement)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGTSpanElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGTSpanElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGTSpanElement::nsSVGTSpanElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsSVGTSpanElementBase(aNodeInfo)
{
}
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGTSpanElement)
//----------------------------------------------------------------------
// nsIDOMSVGTSpanElement methods
// - no methods -
//----------------------------------------------------------------------
// nsIContent methods
NS_IMETHODIMP_(bool)
nsSVGTSpanElement::IsAttributeMapped(const nsIAtom* name) const
{
static const MappedAttributeEntry* const map[] = {
sColorMap,
sFillStrokeMap,
sFontSpecificationMap,
sGraphicsMap,
sTextContentElementsMap
};
return FindAttributeDependence(name, map) ||
nsSVGTSpanElementBase::IsAttributeMapped(name);
}
bool
nsSVGTSpanElement::IsEventAttributeName(nsIAtom* aName)
{
return nsContentUtils::IsEventAttributeName(aName, EventNameType_SVGGraphic);
}
//----------------------------------------------------------------------
// nsSVGElement overrides
// - no methods -

View File

@ -0,0 +1,15 @@
/* -*- 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 SVGTSpanElement : SVGTextPositioningElement {
};

View File

@ -146,6 +146,7 @@ webidl_files = \
SVGTransform.webidl \
SVGTransformableElement.webidl \
SVGTransformList.webidl \
SVGTSpanElement.webidl \
SVGURIReference.webidl \
Text.webidl \
TextDecoder.webidl \