Bug 825732: Convert SVGTextPositioningElement to WebIDL r=bz

--HG--
rename : content/svg/content/src/nsSVGTextPositioningElement.cpp => content/svg/content/src/SVGTextPositioningElement.cpp
rename : content/svg/content/src/nsSVGTextPositioningElement.h => content/svg/content/src/SVGTextPositioningElement.h
This commit is contained in:
David Zbarsky 2013-01-06 09:14:43 -05:00
parent af6c0fe225
commit 2ff60e5bf0
12 changed files with 182 additions and 112 deletions

View File

@ -68,7 +68,6 @@ CPPSRCS = \
nsSVGSymbolElement.cpp \
nsSVGTSpanElement.cpp \
nsSVGTextElement.cpp \
nsSVGTextPositioningElement.cpp \
nsSVGUnknownElement.cpp \
nsSVGUseElement.cpp \
nsSVGViewBox.cpp \
@ -130,6 +129,7 @@ CPPSRCS = \
SVGSwitchElement.cpp \
SVGTextContentElement.cpp \
SVGTextPathElement.cpp \
SVGTextPositioningElement.cpp \
SVGTitleElement.cpp \
SVGTransform.cpp \
SVGTransformableElement.cpp \
@ -182,6 +182,7 @@ EXPORTS_mozilla/dom = \
SVGSwitchElement.h \
SVGTextContentElement.h \
SVGTextPathElement.h \
SVGTextPositioningElement.h \
SVGTitleElement.h \
SVGTransformableElement.h \
$(NULL)

View File

@ -4,7 +4,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/SVGTextContentElement.h"
#include "mozilla/dom/SVGTextContentElementBinding.h"
#include "nsISVGPoint.h"
#include "nsSVGTextContainerFrame.h"
#include "nsIDOMSVGAnimatedLength.h"
@ -14,12 +13,6 @@
namespace mozilla {
namespace dom {
JSObject*
SVGTextContentElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
{
return SVGTextContentElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
nsSVGTextContainerFrame*
SVGTextContentElement::GetTextContainerFrame()
{

View File

@ -46,8 +46,6 @@ protected:
{}
nsSVGTextContainerFrame* GetTextContainerFrame();
virtual JSObject* WrapNode(JSContext *cx, JSObject *scope, bool *triedToWrap) MOZ_OVERRIDE;
};
} // namespace dom

View File

@ -0,0 +1,127 @@
/* -*- 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 "mozilla/dom/SVGTextPositioningElement.h"
#include "mozilla/dom/SVGTextPositioningElementBinding.h"
#include "SVGAnimatedLengthList.h"
#include "DOMSVGAnimatedLengthList.h"
#include "DOMSVGAnimatedNumberList.h"
#include "SVGContentUtils.h"
#include "SVGLengthList.h"
namespace mozilla {
namespace dom {
JSObject*
SVGTextPositioningElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
{
return SVGTextPositioningElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
nsSVGElement::LengthListInfo SVGTextPositioningElement::sLengthListInfo[4] =
{
{ &nsGkAtoms::x, SVGContentUtils::X, false },
{ &nsGkAtoms::y, SVGContentUtils::Y, false },
{ &nsGkAtoms::dx, SVGContentUtils::X, true },
{ &nsGkAtoms::dy, SVGContentUtils::Y, true }
};
nsSVGElement::LengthListAttributesInfo
SVGTextPositioningElement::GetLengthListInfo()
{
return LengthListAttributesInfo(mLengthListAttributes, sLengthListInfo,
ArrayLength(sLengthListInfo));
}
nsSVGElement::NumberListInfo SVGTextPositioningElement::sNumberListInfo[1] =
{
{ &nsGkAtoms::rotate }
};
nsSVGElement::NumberListAttributesInfo
SVGTextPositioningElement::GetNumberListInfo()
{
return NumberListAttributesInfo(mNumberListAttributes, sNumberListInfo,
ArrayLength(sNumberListInfo));
}
//----------------------------------------------------------------------
// nsIDOMSVGTextPositioningElement methods
/* readonly attribute DOMSVGAnimatedLengthList x; */
NS_IMETHODIMP SVGTextPositioningElement::GetX(nsISupports * *aX)
{
*aX = X().get();
return NS_OK;
}
already_AddRefed<DOMSVGAnimatedLengthList>
SVGTextPositioningElement::X()
{
return DOMSVGAnimatedLengthList::GetDOMWrapper(&mLengthListAttributes[ATTR_X],
this, ATTR_X, SVGContentUtils::X);
}
/* readonly attribute DOMSVGAnimatedLengthList y; */
NS_IMETHODIMP SVGTextPositioningElement::GetY(nsISupports * *aY)
{
*aY = Y().get();
return NS_OK;
}
already_AddRefed<DOMSVGAnimatedLengthList>
SVGTextPositioningElement::Y()
{
return DOMSVGAnimatedLengthList::GetDOMWrapper(&mLengthListAttributes[ATTR_Y],
this, ATTR_Y, SVGContentUtils::Y);
}
/* readonly attribute DOMSVGAnimatedLengthList dx; */
NS_IMETHODIMP SVGTextPositioningElement::GetDx(nsISupports * *aDx)
{
*aDx = Dx().get();
return NS_OK;
}
already_AddRefed<DOMSVGAnimatedLengthList>
SVGTextPositioningElement::Dx()
{
return DOMSVGAnimatedLengthList::GetDOMWrapper(&mLengthListAttributes[ATTR_DX],
this, ATTR_DX, SVGContentUtils::X);
}
/* readonly attribute DOMSVGAnimatedLengthList dy; */
NS_IMETHODIMP SVGTextPositioningElement::GetDy(nsISupports * *aDy)
{
*aDy = Dy().get();
return NS_OK;
}
already_AddRefed<DOMSVGAnimatedLengthList>
SVGTextPositioningElement::Dy()
{
return DOMSVGAnimatedLengthList::GetDOMWrapper(&mLengthListAttributes[ATTR_DY],
this, ATTR_DY, SVGContentUtils::Y);
}
/* readonly attribute DOMSVGAnimatedNumberList rotate; */
NS_IMETHODIMP SVGTextPositioningElement::GetRotate(nsISupports * *aRotate)
{
*aRotate = Rotate().get();
return NS_OK;
}
already_AddRefed<DOMSVGAnimatedNumberList>
SVGTextPositioningElement::Rotate()
{
return DOMSVGAnimatedNumberList::GetDOMWrapper(&mNumberListAttributes[ROTATE],
this, ROTATE);
}
} // namespace dom
} // namespace mozilla

View File

@ -3,11 +3,11 @@
* 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 __NS_SVGTEXTPOSITIONINGELEMENTBASE_H__
#define __NS_SVGTEXTPOSITIONINGELEMENTBASE_H__
#ifndef mozilla_dom_SVGTextPositioningElement_h
#define mozilla_dom_SVGTextPositioningElement_h
#include "nsIDOMSVGTextPositionElem.h"
#include "SVGTextContentElement.h"
#include "mozilla/dom/SVGTextContentElement.h"
#include "SVGAnimatedLengthList.h"
#include "SVGAnimatedNumberList.h"
@ -15,32 +15,42 @@ class nsSVGElement;
namespace mozilla {
class SVGAnimatedLengthList;
}
class DOMSVGAnimatedLengthList;
class DOMSVGAnimatedNumberList;
typedef mozilla::dom::SVGTextContentElement nsSVGTextPositioningElementBase;
namespace dom {
typedef SVGTextContentElement SVGTextPositioningElementBase;
/**
* Note that nsSVGTextElement does not inherit this class - it reimplements it
* instead (see its documenting comment). The upshot is that any changes to
* this class also need to be made in nsSVGTextElement.
*/
class nsSVGTextPositioningElement : public nsSVGTextPositioningElementBase
class SVGTextPositioningElement : public SVGTextPositioningElementBase
{
public:
NS_DECL_NSIDOMSVGTEXTPOSITIONINGELEMENT
// WebIDL
already_AddRefed<DOMSVGAnimatedLengthList> X();
already_AddRefed<DOMSVGAnimatedLengthList> Y();
already_AddRefed<DOMSVGAnimatedLengthList> Dx();
already_AddRefed<DOMSVGAnimatedLengthList> Dy();
already_AddRefed<DOMSVGAnimatedNumberList> Rotate();
protected:
nsSVGTextPositioningElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsSVGTextPositioningElementBase(aNodeInfo)
SVGTextPositioningElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: SVGTextPositioningElementBase(aNodeInfo)
{}
virtual JSObject* WrapNode(JSContext *cx, JSObject *scope, bool *triedToWrap) MOZ_OVERRIDE;
virtual LengthListAttributesInfo GetLengthListInfo();
virtual NumberListAttributesInfo GetNumberListInfo();
// nsIDOMSVGTextPositioning properties:
enum { X, Y, DX, DY };
enum { ATTR_X, ATTR_Y, ATTR_DX, ATTR_DY };
SVGAnimatedLengthList mLengthListAttributes[4];
static LengthListInfo sLengthListInfo[4];
@ -49,4 +59,7 @@ protected:
static NumberListInfo sNumberListInfo[1];
};
#endif
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_SVGTextPositioningElement_h

View File

@ -9,12 +9,12 @@
#include "nsIDOMSVGAltGlyphElement.h"
#include "nsIDOMSVGURIReference.h"
#include "nsSVGString.h"
#include "nsSVGTextPositioningElement.h"
#include "SVGTextPositioningElement.h"
#include "nsContentUtils.h"
using namespace mozilla;
typedef nsSVGTextPositioningElement nsSVGAltGlyphElementBase;
typedef dom::SVGTextPositioningElement nsSVGAltGlyphElementBase;
class nsSVGAltGlyphElement : public nsSVGAltGlyphElementBase, // = nsIDOMSVGTextPositioningElement
public nsIDOMSVGAltGlyphElement,

View File

@ -8,12 +8,12 @@
#include "nsGkAtoms.h"
#include "nsIDOMSVGTSpanElement.h"
#include "nsSVGSVGElement.h"
#include "nsSVGTextPositioningElement.h"
#include "SVGTextPositioningElement.h"
#include "nsContentUtils.h"
using namespace mozilla;
typedef nsSVGTextPositioningElement nsSVGTSpanElementBase;
typedef dom::SVGTextPositioningElement nsSVGTSpanElementBase;
class nsSVGTSpanElement : public nsSVGTSpanElementBase, // = nsIDOMSVGTextPositioningElement
public nsIDOMSVGTSpanElement

View File

@ -10,7 +10,7 @@
#include "nsIDOMSVGTextElement.h"
#include "nsCOMPtr.h"
#include "nsSVGSVGElement.h"
#include "nsSVGTextPositioningElement.h"
#include "SVGTextPositioningElement.h"
#include "nsError.h"
#include "SVGAnimatedLengthList.h"
#include "DOMSVGAnimatedLengthList.h"

View File

@ -1,87 +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 "nsSVGTextPositioningElement.h"
#include "SVGAnimatedLengthList.h"
#include "DOMSVGAnimatedLengthList.h"
#include "DOMSVGAnimatedNumberList.h"
#include "SVGContentUtils.h"
#include "SVGLengthList.h"
using namespace mozilla;
nsSVGElement::LengthListInfo nsSVGTextPositioningElement::sLengthListInfo[4] =
{
{ &nsGkAtoms::x, SVGContentUtils::X, false },
{ &nsGkAtoms::y, SVGContentUtils::Y, false },
{ &nsGkAtoms::dx, SVGContentUtils::X, true },
{ &nsGkAtoms::dy, SVGContentUtils::Y, true }
};
nsSVGElement::LengthListAttributesInfo
nsSVGTextPositioningElement::GetLengthListInfo()
{
return LengthListAttributesInfo(mLengthListAttributes, sLengthListInfo,
ArrayLength(sLengthListInfo));
}
nsSVGElement::NumberListInfo nsSVGTextPositioningElement::sNumberListInfo[1] =
{
{ &nsGkAtoms::rotate }
};
nsSVGElement::NumberListAttributesInfo
nsSVGTextPositioningElement::GetNumberListInfo()
{
return NumberListAttributesInfo(mNumberListAttributes, sNumberListInfo,
ArrayLength(sNumberListInfo));
}
//----------------------------------------------------------------------
// nsIDOMSVGTextPositioningElement methods
/* readonly attribute DOMSVGAnimatedLengthList x; */
NS_IMETHODIMP nsSVGTextPositioningElement::GetX(nsISupports * *aX)
{
*aX = DOMSVGAnimatedLengthList::GetDOMWrapper(&mLengthListAttributes[X],
this, X, SVGContentUtils::X).get();
return NS_OK;
}
/* readonly attribute DOMSVGAnimatedLengthList y; */
NS_IMETHODIMP nsSVGTextPositioningElement::GetY(nsISupports * *aY)
{
*aY = DOMSVGAnimatedLengthList::GetDOMWrapper(&mLengthListAttributes[Y],
this, Y, SVGContentUtils::Y).get();
return NS_OK;
}
/* readonly attribute DOMSVGAnimatedLengthList dx; */
NS_IMETHODIMP nsSVGTextPositioningElement::GetDx(nsISupports * *aDx)
{
*aDx = DOMSVGAnimatedLengthList::GetDOMWrapper(&mLengthListAttributes[DX],
this, DX, SVGContentUtils::X).get();
return NS_OK;
}
/* readonly attribute DOMSVGAnimatedLengthList dy; */
NS_IMETHODIMP nsSVGTextPositioningElement::GetDy(nsISupports * *aDy)
{
*aDy = DOMSVGAnimatedLengthList::GetDOMWrapper(&mLengthListAttributes[DY],
this, DY, SVGContentUtils::Y).get();
return NS_OK;
}
/* readonly attribute DOMSVGAnimatedNumberList rotate; */
NS_IMETHODIMP nsSVGTextPositioningElement::GetRotate(nsISupports * *aRotate)
{
*aRotate = DOMSVGAnimatedNumberList::GetDOMWrapper(&mNumberListAttributes[ROTATE],
this, ROTATE).get();
return NS_OK;
}

View File

@ -768,6 +768,10 @@ DOMInterfaces = {
'headerFile': 'SVGPreserveAspectRatio.h'
},
'SVGTextContentElement': {
'concrete': False
},
'SVGTitleElement': {
'hasInstanceInterface': 'nsIDOMSVGTitleElement',
},

View File

@ -0,0 +1,20 @@
/* -*- 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 SVGTextPositioningElement : SVGTextContentElement {
readonly attribute SVGAnimatedLengthList x;
readonly attribute SVGAnimatedLengthList y;
readonly attribute SVGAnimatedLengthList dx;
readonly attribute SVGAnimatedLengthList dy;
readonly attribute SVGAnimatedNumberList rotate;
};

View File

@ -140,6 +140,7 @@ webidl_files = \
SVGTests.webidl \
SVGTextContentElement.webidl \
SVGTextPathElement.webidl \
SVGTextPositioningElement.webidl \
SVGTitleElement.webidl \
SVGTransform.webidl \
SVGTransformableElement.webidl \