Bug 831669: Move SVGClipPathElement to mozilla::dom r=bz

--HG--
rename : content/svg/content/src/nsSVGClipPathElement.cpp => content/svg/content/src/SVGClipPathElement.cpp
rename : content/svg/content/src/nsSVGClipPathElement.h => content/svg/content/src/SVGClipPathElement.h
This commit is contained in:
David Zbarsky 2013-01-18 14:52:40 -05:00
parent a1f9daeb50
commit 2f19359c49
4 changed files with 51 additions and 34 deletions

View File

@ -39,7 +39,6 @@ CPPSRCS = \
nsSVGAngle.cpp \
nsSVGBoolean.cpp \
nsSVGClass.cpp \
nsSVGClipPathElement.cpp \
nsSVGDataParser.cpp \
nsSVGElement.cpp \
nsSVGElementFactory.cpp \
@ -77,6 +76,7 @@ CPPSRCS = \
SVGAnimateMotionElement.cpp \
SVGAnimationElement.cpp \
SVGAttrValueWrapper.cpp \
SVGClipPathElement.cpp \
SVGCircleElement.cpp \
SVGContentUtils.cpp \
SVGDefsElement.cpp \
@ -163,6 +163,7 @@ EXPORTS_mozilla/dom = \
SVGAnimateTransformElement.h \
SVGAnimateMotionElement.h \
SVGAnimationElement.h \
SVGClipPathElement.h \
SVGCircleElement.h \
SVGDefsElement.h \
SVGDescElement.h \

View File

@ -5,12 +5,17 @@
#include "mozilla/Util.h"
#include "nsSVGClipPathElement.h"
#include "mozilla/dom/SVGClipPathElement.h"
#include "nsGkAtoms.h"
using namespace mozilla;
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(ClipPath)
nsSVGElement::EnumInfo nsSVGClipPathElement::sEnumInfo[1] =
DOMCI_NODE_DATA(SVGClipPathElement, mozilla::dom::SVGClipPathElement)
namespace mozilla {
namespace dom {
nsSVGElement::EnumInfo SVGClipPathElement::sEnumInfo[1] =
{
{ &nsGkAtoms::clipPathUnits,
sSVGUnitTypesMap,
@ -18,40 +23,36 @@ nsSVGElement::EnumInfo nsSVGClipPathElement::sEnumInfo[1] =
}
};
NS_IMPL_NS_NEW_SVG_ELEMENT(ClipPath)
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_ADDREF_INHERITED(nsSVGClipPathElement,nsSVGClipPathElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGClipPathElement,nsSVGClipPathElementBase)
NS_IMPL_ADDREF_INHERITED(SVGClipPathElement,SVGClipPathElementBase)
NS_IMPL_RELEASE_INHERITED(SVGClipPathElement,SVGClipPathElementBase)
DOMCI_NODE_DATA(SVGClipPathElement, nsSVGClipPathElement)
NS_INTERFACE_TABLE_HEAD(nsSVGClipPathElement)
NS_NODE_INTERFACE_TABLE5(nsSVGClipPathElement, nsIDOMNode, nsIDOMElement,
NS_INTERFACE_TABLE_HEAD(SVGClipPathElement)
NS_NODE_INTERFACE_TABLE5(SVGClipPathElement, nsIDOMNode, nsIDOMElement,
nsIDOMSVGElement,
nsIDOMSVGClipPathElement,
nsIDOMSVGUnitTypes)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGClipPathElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGClipPathElementBase)
NS_INTERFACE_MAP_END_INHERITING(SVGClipPathElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGClipPathElement::nsSVGClipPathElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsSVGClipPathElementBase(aNodeInfo)
SVGClipPathElement::SVGClipPathElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: SVGClipPathElementBase(aNodeInfo)
{
}
/* readonly attribute nsIDOMSVGAnimatedEnumeration clipPathUnits; */
NS_IMETHODIMP nsSVGClipPathElement::GetClipPathUnits(nsIDOMSVGAnimatedEnumeration * *aClipPathUnits)
NS_IMETHODIMP SVGClipPathElement::GetClipPathUnits(nsIDOMSVGAnimatedEnumeration * *aClipPathUnits)
{
return mEnumAttributes[CLIPPATHUNITS].ToDOMAnimatedEnum(aClipPathUnits, this);
}
nsSVGElement::EnumAttributesInfo
nsSVGClipPathElement::GetEnumInfo()
SVGClipPathElement::GetEnumInfo()
{
return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
ArrayLength(sEnumInfo));
@ -60,5 +61,7 @@ nsSVGClipPathElement::GetEnumInfo()
//----------------------------------------------------------------------
// nsIDOMNode methods
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGClipPathElement)
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGClipPathElement)
} // namespace dom
} // namespace mozilla

View File

@ -3,37 +3,45 @@
* 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_SVGCLIPPATHELEMENT_H__
#define __NS_SVGCLIPPATHELEMENT_H__
#ifndef mozilla_dom_SVGClipPathElement_h
#define mozilla_dom_SVGClipPathElement_h
#include "nsIDOMSVGClipPathElement.h"
#include "nsIDOMSVGUnitTypes.h"
#include "nsSVGEnum.h"
#include "mozilla/dom/SVGTransformableElement.h"
typedef mozilla::dom::SVGTransformableElement nsSVGClipPathElementBase;
class nsSVGClipPathFrame;
class nsSVGClipPathElement : public nsSVGClipPathElementBase,
public nsIDOMSVGClipPathElement,
public nsIDOMSVGUnitTypes
nsresult NS_NewSVGClipPathElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo);
namespace mozilla {
namespace dom {
typedef SVGTransformableElement SVGClipPathElementBase;
class SVGClipPathElement MOZ_FINAL : public SVGClipPathElementBase,
public nsIDOMSVGClipPathElement,
public nsIDOMSVGUnitTypes
{
friend class nsSVGClipPathFrame;
friend class ::nsSVGClipPathFrame;
protected:
friend nsresult NS_NewSVGClipPathElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo);
nsSVGClipPathElement(already_AddRefed<nsINodeInfo> aNodeInfo);
friend nsresult (::NS_NewSVGClipPathElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo));
SVGClipPathElement(already_AddRefed<nsINodeInfo> aNodeInfo);
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSVGCLIPPATHELEMENT
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_TO_NSINODE
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGClipPathElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(SVGClipPathElementBase::)
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
@ -50,4 +58,7 @@ protected:
virtual EnumAttributesInfo GetEnumInfo();
};
#endif
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_SVGClipPathElement_h

View File

@ -10,10 +10,12 @@
#include "gfxContext.h"
#include "nsGkAtoms.h"
#include "nsRenderingContext.h"
#include "nsSVGClipPathElement.h"
#include "mozilla/dom/SVGClipPathElement.h"
#include "nsSVGEffects.h"
#include "nsSVGUtils.h"
using namespace mozilla::dom;
//----------------------------------------------------------------------
// Implementation
@ -313,13 +315,13 @@ nsSVGClipPathFrame::GetType() const
gfxMatrix
nsSVGClipPathFrame::GetCanvasTM(uint32_t aFor)
{
nsSVGClipPathElement *content = static_cast<nsSVGClipPathElement*>(mContent);
SVGClipPathElement *content = static_cast<SVGClipPathElement*>(mContent);
gfxMatrix tm =
content->PrependLocalTransformsTo(mClipParentMatrix ?
*mClipParentMatrix : gfxMatrix());
return nsSVGUtils::AdjustMatrixForUnits(tm,
&content->mEnumAttributes[nsSVGClipPathElement::CLIPPATHUNITS],
&content->mEnumAttributes[SVGClipPathElement::CLIPPATHUNITS],
mClipParent);
}