Bug 824229 Part 6: Move SVGGraphicsElement to mozilla::dom r=bz,longsonr

--HG--
rename : content/svg/content/src/nsSVGGraphicElement.cpp => content/svg/content/src/SVGGraphicsElement.cpp
rename : content/svg/content/src/nsSVGGraphicElement.h => content/svg/content/src/SVGGraphicsElement.h
This commit is contained in:
David Zbarsky 2013-01-03 01:17:03 -05:00
parent f69c2e36f7
commit 937861a33d
20 changed files with 80 additions and 70 deletions

View File

@ -55,7 +55,6 @@ CPPSRCS = \
nsSVGForeignObjectElement.cpp \
nsSVGGElement.cpp \
nsSVGGradientElement.cpp \
nsSVGGraphicElement.cpp \
nsSVGImageElement.cpp \
nsSVGInteger.cpp \
nsSVGIntegerPair.cpp \
@ -97,6 +96,7 @@ CPPSRCS = \
SVGAnimatedPreserveAspectRatio.cpp \
SVGAnimatedTransformList.cpp \
SVGFragmentIdentifier.cpp \
SVGGraphicsElement.cpp \
SVGLength.cpp \
SVGLengthList.cpp \
SVGNumberList.cpp \
@ -157,6 +157,7 @@ EXPORTS_mozilla/dom = \
SVGAnimatedAngle.h \
SVGAnimatedBoolean.h \
SVGDescElement.h \
SVGGraphicsElement.h \
SVGLocatableElement.h \
SVGMetadataElement.h \
SVGMPathElement.h \

View File

@ -5,7 +5,7 @@
#include "mozilla/Util.h"
#include "nsSVGGraphicElement.h"
#include "mozilla/dom/SVGGraphicsElement.h"
#include "nsSVGSVGElement.h"
#include "DOMSVGAnimatedTransformList.h"
#include "DOMSVGMatrix.h"
@ -20,11 +20,11 @@
#include "nsContentUtils.h"
#include "mozilla/dom/SVGGraphicsElementBinding.h"
using namespace mozilla;
using namespace mozilla::dom;
namespace mozilla {
namespace dom {
JSObject*
nsSVGGraphicElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
SVGGraphicsElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap)
{
return SVGGraphicsElementBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
@ -32,18 +32,18 @@ nsSVGGraphicElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWr
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGGraphicElement, nsSVGGraphicElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGGraphicElement, nsSVGGraphicElementBase)
NS_IMPL_ADDREF_INHERITED(SVGGraphicsElement, SVGGraphicsElementBase)
NS_IMPL_RELEASE_INHERITED(SVGGraphicsElement, SVGGraphicsElementBase)
NS_INTERFACE_MAP_BEGIN(nsSVGGraphicElement)
NS_INTERFACE_MAP_BEGIN(SVGGraphicsElement)
NS_INTERFACE_MAP_ENTRY(nsIDOMSVGTests)
NS_INTERFACE_MAP_END_INHERITING(nsSVGGraphicElementBase)
NS_INTERFACE_MAP_END_INHERITING(SVGGraphicsElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGGraphicElement::nsSVGGraphicElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsSVGGraphicElementBase(aNodeInfo)
SVGGraphicsElement::SVGGraphicsElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: SVGGraphicsElementBase(aNodeInfo)
{
}
@ -51,30 +51,30 @@ nsSVGGraphicElement::nsSVGGraphicElement(already_AddRefed<nsINodeInfo> aNodeInfo
// nsIContent methods
NS_IMETHODIMP_(bool)
nsSVGGraphicElement::IsAttributeMapped(const nsIAtom* name) const
SVGGraphicsElement::IsAttributeMapped(const nsIAtom* name) const
{
static const MappedAttributeEntry* const map[] = {
sColorMap,
sFillStrokeMap,
sGraphicsMap
};
return FindAttributeDependence(name, map) ||
nsSVGGraphicElementBase::IsAttributeMapped(name);
SVGGraphicsElementBase::IsAttributeMapped(name);
}
nsChangeHint
nsSVGGraphicElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
int32_t aModType) const
SVGGraphicsElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
int32_t aModType) const
{
nsChangeHint retval =
nsSVGGraphicElementBase::GetAttributeChangeHint(aAttribute, aModType);
SVGGraphicsElementBase::GetAttributeChangeHint(aAttribute, aModType);
if (aAttribute == nsGkAtoms::transform ||
aAttribute == nsGkAtoms::mozAnimateMotionDummyAttr) {
// We add nsChangeHint_UpdateOverflow so that nsFrame::UpdateOverflow()
// will be called on us and our ancestors.
nsIFrame* frame =
const_cast<nsSVGGraphicElement*>(this)->GetPrimaryFrame();
const_cast<SVGGraphicsElement*>(this)->GetPrimaryFrame();
if (!frame || (frame->GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) {
return retval; // no change
}
@ -94,7 +94,7 @@ nsSVGGraphicElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
}
bool
nsSVGGraphicElement::IsEventAttributeName(nsIAtom* aName)
SVGGraphicsElement::IsEventAttributeName(nsIAtom* aName)
{
return nsContentUtils::IsEventAttributeName(aName, EventNameType_SVGGraphic);
}
@ -103,8 +103,8 @@ nsSVGGraphicElement::IsEventAttributeName(nsIAtom* aName)
// nsSVGElement overrides
gfxMatrix
nsSVGGraphicElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich) const
SVGGraphicsElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich) const
{
NS_ABORT_IF_FALSE(aWhich != eChildToUserSpace || aMatrix.IsIdentity(),
"Skipping eUserSpaceToParent transforms makes no sense");
@ -137,13 +137,13 @@ nsSVGGraphicElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
}
const gfxMatrix*
nsSVGGraphicElement::GetAnimateMotionTransform() const
SVGGraphicsElement::GetAnimateMotionTransform() const
{
return mAnimateMotionTransform.get();
}
void
nsSVGGraphicElement::SetAnimateMotionTransform(const gfxMatrix* aMatrix)
SVGGraphicsElement::SetAnimateMotionTransform(const gfxMatrix* aMatrix)
{
if ((!aMatrix && !mAnimateMotionTransform) ||
(aMatrix && mAnimateMotionTransform && *aMatrix == *mAnimateMotionTransform)) {
@ -154,10 +154,13 @@ nsSVGGraphicElement::SetAnimateMotionTransform(const gfxMatrix* aMatrix)
}
SVGAnimatedTransformList*
nsSVGGraphicElement::GetAnimatedTransformList(uint32_t aFlags)
SVGGraphicsElement::GetAnimatedTransformList(uint32_t aFlags)
{
if (!mTransforms && (aFlags & DO_ALLOCATE)) {
mTransforms = new SVGAnimatedTransformList();
}
return mTransforms;
}
} // namespace dom
} // namespace mozilla

View File

@ -3,32 +3,35 @@
* 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_SVGGRAPHICELEMENT_H__
#define __NS_SVGGRAPHICELEMENT_H__
#ifndef mozilla_dom_SVGGraphicsElement_h
#define mozilla_dom_SVGGraphicsElement_h
#include "gfxMatrix.h"
#include "SVGTransformableElement.h"
#include "SVGAnimatedTransformList.h"
#include "DOMSVGTests.h"
typedef mozilla::dom::SVGTransformableElement nsSVGGraphicElementBase;
#define MOZILLA_SVGGRAPHICSELEMENT_IID \
{ 0xe57b8fe5, 0x9088, 0x446e, \
{0xa1, 0x87, 0xd1, 0xdb, 0xbb, 0x58, 0xce, 0xdc}}
class nsSVGGraphicElement : public nsSVGGraphicElementBase,
public DOMSVGTests
namespace mozilla {
namespace dom {
typedef SVGTransformableElement SVGGraphicsElementBase;
class SVGGraphicsElement : public SVGGraphicsElementBase,
public DOMSVGTests
{
protected:
nsSVGGraphicElement(already_AddRefed<nsINodeInfo> aNodeInfo);
SVGGraphicsElement(already_AddRefed<nsINodeInfo> aNodeInfo);
public:
// interfaces:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_SVGGRAPHICSELEMENT_IID)
NS_FORWARD_NSIDOMSVGLOCATABLE(mozilla::dom::SVGLocatableElement::)
NS_FORWARD_NSIDOMSVGTRANSFORMABLE(mozilla::dom::SVGTransformableElement::)
NS_FORWARD_NSIDOMSVGLOCATABLE(SVGLocatableElement::)
NS_FORWARD_NSIDOMSVGTRANSFORMABLE(SVGTransformableElement::)
// nsIContent interface
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
@ -45,7 +48,7 @@ public:
virtual const gfxMatrix* GetAnimateMotionTransform() const;
virtual void SetAnimateMotionTransform(const gfxMatrix* aMatrix);
virtual mozilla::SVGAnimatedTransformList*
virtual SVGAnimatedTransformList*
GetAnimatedTransformList(uint32_t aFlags = 0);
virtual nsIAtom* GetTransformListAttrName() const {
return nsGkAtoms::transform;
@ -56,13 +59,16 @@ protected:
// nsSVGElement overrides
nsAutoPtr<mozilla::SVGAnimatedTransformList> mTransforms;
nsAutoPtr<SVGAnimatedTransformList> mTransforms;
// XXX maybe move this to property table, to save space on un-animated elems?
nsAutoPtr<gfxMatrix> mAnimateMotionTransform;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsSVGGraphicElement,
NS_DEFINE_STATIC_IID_ACCESSOR(SVGGraphicsElement,
MOZILLA_SVGGRAPHICSELEMENT_IID)
#endif // __NS_SVGGRAPHICELEMENT_H__
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_SVGGraphicsElement_h

View File

@ -6,7 +6,6 @@
#include "mozilla/Util.h"
#include "nsSVGAElement.h"
#include "nsSVGGraphicElement.h"
#include "nsIDOMSVGAElement.h"
#include "nsIDOMSVGURIReference.h"
#include "nsILink.h"

View File

@ -10,10 +10,10 @@
#include "nsIDOMSVGAElement.h"
#include "nsIDOMSVGURIReference.h"
#include "nsILink.h"
#include "nsSVGGraphicElement.h"
#include "nsSVGString.h"
#include "SVGGraphicsElement.h"
typedef nsSVGGraphicElement nsSVGAElementBase;
typedef mozilla::dom::SVGGraphicsElement nsSVGAElementBase;
class nsSVGAElement : public nsSVGAElementBase,
public nsIDOMSVGAElement,

View File

@ -9,9 +9,9 @@
#include "nsIDOMSVGClipPathElement.h"
#include "nsIDOMSVGUnitTypes.h"
#include "nsSVGEnum.h"
#include "nsSVGGraphicElement.h"
#include "SVGGraphicsElement.h"
typedef nsSVGGraphicElement nsSVGClipPathElementBase;
typedef mozilla::dom::SVGGraphicsElement nsSVGClipPathElementBase;
class nsSVGClipPathElement : public nsSVGClipPathElementBase,
public nsIDOMSVGClipPathElement,

View File

@ -5,12 +5,12 @@
#include "mozilla/Util.h"
#include "nsSVGGraphicElement.h"
#include "SVGGraphicsElement.h"
#include "nsIDOMSVGDefsElement.h"
using namespace mozilla;
typedef nsSVGGraphicElement nsSVGDefsElementBase;
typedef mozilla::dom::SVGGraphicsElement nsSVGDefsElementBase;
class nsSVGDefsElement : public nsSVGDefsElementBase,
public nsIDOMSVGDefsElement

View File

@ -10,7 +10,7 @@
#include "nsIDOMSVGUnitTypes.h"
#include "nsIDOMSVGURIReference.h"
#include "nsSVGEnum.h"
#include "nsSVGGraphicElement.h"
#include "nsSVGElement.h"
#include "nsSVGIntegerPair.h"
#include "nsSVGLength2.h"
#include "nsSVGString.h"

View File

@ -6,11 +6,11 @@
#ifndef __NS_SVGFOREIGNOBJECTELEMENT_H__
#define __NS_SVGFOREIGNOBJECTELEMENT_H__
#include "SVGGraphicsElement.h"
#include "nsIDOMSVGForeignObjectElem.h"
#include "nsSVGGraphicElement.h"
#include "nsSVGLength2.h"
typedef nsSVGGraphicElement nsSVGForeignObjectElementBase;
typedef mozilla::dom::SVGGraphicsElement nsSVGForeignObjectElementBase;
class nsSVGForeignObjectElement : public nsSVGForeignObjectElementBase,
public nsIDOMSVGForeignObjectElement

View File

@ -5,12 +5,12 @@
#include "mozilla/Util.h"
#include "nsSVGGraphicElement.h"
#include "SVGGraphicsElement.h"
#include "nsIDOMSVGGElement.h"
using namespace mozilla;
typedef nsSVGGraphicElement nsSVGGElementBase;
typedef dom::SVGGraphicsElement nsSVGGElementBase;
class nsSVGGElement : public nsSVGGElementBase,
public nsIDOMSVGGElement

View File

@ -11,10 +11,10 @@
#include "nsIDOMSVGMarkerElement.h"
#include "nsSVGAngle.h"
#include "nsSVGEnum.h"
#include "nsSVGGraphicElement.h"
#include "nsSVGLength2.h"
#include "nsSVGViewBox.h"
#include "SVGAnimatedPreserveAspectRatio.h"
#include "SVGGraphicsElement.h"
#include "mozilla/Attributes.h"
class nsSVGOrientType
@ -68,7 +68,7 @@ private:
};
};
typedef nsSVGGraphicElement nsSVGMarkerElementBase;
typedef mozilla::dom::SVGGraphicsElement nsSVGMarkerElementBase;
class nsSVGMarkerElement : public nsSVGMarkerElementBase,
public nsIDOMSVGMarkerElement,

View File

@ -7,7 +7,7 @@
#define __NS_SVGPATHGEOMETRYELEMENT_H__
#include "gfxMatrix.h"
#include "nsSVGGraphicElement.h"
#include "SVGGraphicsElement.h"
#include "nsTArray.h"
struct nsSVGMark {
@ -18,7 +18,7 @@ struct nsSVGMark {
class gfxContext;
typedef nsSVGGraphicElement nsSVGPathGeometryElementBase;
typedef mozilla::dom::SVGGraphicsElement nsSVGPathGeometryElementBase;
class nsSVGPathGeometryElement : public nsSVGPathGeometryElementBase
{

View File

@ -14,7 +14,7 @@
#include "nsIDOMSVGZoomAndPan.h"
#include "nsSVGEnum.h"
#include "nsSVGLength2.h"
#include "nsSVGGraphicElement.h"
#include "SVGGraphicsElement.h"
#include "nsSVGViewBox.h"
#include "SVGPreserveAspectRatio.h"
#include "SVGAnimatedPreserveAspectRatio.h"
@ -27,7 +27,7 @@ namespace mozilla {
class SVGFragmentIdentifier;
}
typedef nsSVGGraphicElement nsSVGSVGElementBase;
typedef mozilla::dom::SVGGraphicsElement nsSVGSVGElementBase;
class nsSVGSVGElement;

View File

@ -7,9 +7,9 @@
#define __NS_SVGSWITCHELEMENT_H__
#include "nsIDOMSVGSwitchElement.h"
#include "nsSVGGraphicElement.h"
#include "SVGGraphicsElement.h"
typedef nsSVGGraphicElement nsSVGSwitchElementBase;
typedef mozilla::dom::SVGGraphicsElement nsSVGSwitchElementBase;
class nsSVGSwitchElement : public nsSVGSwitchElementBase,
public nsIDOMSVGSwitchElement

View File

@ -5,7 +5,7 @@
#include "mozilla/Util.h"
#include "nsSVGGraphicElement.h"
#include "SVGGraphicsElement.h"
#include "nsGkAtoms.h"
#include "nsIDOMSVGTextElement.h"
#include "nsCOMPtr.h"
@ -22,7 +22,7 @@
using namespace mozilla;
typedef nsSVGGraphicElement nsSVGTextElementBase;
typedef dom::SVGGraphicsElement nsSVGTextElementBase;
/**
* This class does not inherit nsSVGTextPositioningElement - it reimplements it

View File

@ -11,7 +11,7 @@
#include "nsIDOMSVGUseElement.h"
#include "nsReferencedElement.h"
#include "nsStubMutationObserver.h"
#include "nsSVGGraphicElement.h"
#include "SVGGraphicsElement.h"
#include "nsSVGLength2.h"
#include "nsSVGString.h"
#include "nsTArray.h"
@ -28,7 +28,7 @@ NS_NewSVGSVGElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo,
mozilla::dom::FromParser aFromParser);
typedef nsSVGGraphicElement nsSVGUseElementBase;
typedef mozilla::dom::SVGGraphicsElement nsSVGUseElementBase;
class nsSVGUseElement : public nsSVGUseElementBase,
public nsIDOMSVGUseElement,

View File

@ -611,7 +611,6 @@ DOMInterfaces = {
'SVGGraphicsElement': {
'hasXPConnectImpls': True,
'nativeType': 'nsSVGGraphicElement'
},
'SVGLocatableElement': {

View File

@ -10,10 +10,12 @@
#include "nsGkAtoms.h"
#include "nsIDOMSVGTransformable.h"
#include "nsIFrame.h"
#include "nsSVGGraphicElement.h"
#include "SVGGraphicsElement.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGUtils.h"
using namespace mozilla::dom;
//----------------------------------------------------------------------
// Implementation
@ -75,7 +77,7 @@ nsSVGGFrame::GetCanvasTM(uint32_t aFor)
NS_ASSERTION(mParent, "null parent");
nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(mParent);
nsSVGGraphicElement *content = static_cast<nsSVGGraphicElement*>(mContent);
SVGGraphicsElement *content = static_cast<SVGGraphicsElement*>(mContent);
gfxMatrix tm = content->PrependLocalTransformsTo(parent->GetCanvasTM(aFor));

View File

@ -14,12 +14,12 @@
#include "nsGkAtoms.h"
#include "nsRenderingContext.h"
#include "nsSVGEffects.h"
#include "nsSVGGraphicElement.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGMarkerFrame.h"
#include "nsSVGPathGeometryElement.h"
#include "nsSVGUtils.h"
#include "SVGAnimatedTransformList.h"
#include "SVGGraphicsElement.h"
using namespace mozilla;
@ -492,7 +492,7 @@ nsSVGPathGeometryFrame::GetCanvasTM(uint32_t aFor)
NS_ASSERTION(mParent, "null parent");
nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(mParent);
nsSVGGraphicElement *content = static_cast<nsSVGGraphicElement*>(mContent);
dom::SVGGraphicsElement *content = static_cast<dom::SVGGraphicsElement*>(mContent);
return content->PrependLocalTransformsTo(parent->GetCanvasTM(aFor));
}

View File

@ -12,11 +12,11 @@
#include "nsIDOMSVGTextElement.h"
#include "nsISVGGlyphFragmentNode.h"
#include "nsSVGGlyphFrame.h"
#include "nsSVGGraphicElement.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGPathElement.h"
#include "nsSVGTextPathFrame.h"
#include "nsSVGUtils.h"
#include "SVGGraphicsElement.h"
#include "SVGLengthList.h"
using namespace mozilla;
@ -280,7 +280,7 @@ nsSVGTextFrame::GetCanvasTM(uint32_t aFor)
NS_ASSERTION(mParent, "null parent");
nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(mParent);
nsSVGGraphicElement *content = static_cast<nsSVGGraphicElement*>(mContent);
dom::SVGGraphicsElement *content = static_cast<dom::SVGGraphicsElement*>(mContent);
gfxMatrix tm =
content->PrependLocalTransformsTo(parent->GetCanvasTM(aFor));