mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 830181: Move SVGSymbolElement to mozilla::dom r=bz
--HG-- rename : content/svg/content/src/nsSVGSymbolElement.cpp => content/svg/content/src/SVGSymbolElement.cpp rename : content/svg/content/src/nsSVGSymbolElement.cpp => content/svg/content/src/SVGSymbolElement.h
This commit is contained in:
parent
e10b65b185
commit
df3ff4c9ff
@ -59,7 +59,6 @@ CPPSRCS = \
|
||||
nsSVGPolyElement.cpp \
|
||||
nsSVGString.cpp \
|
||||
nsSVGRect.cpp \
|
||||
nsSVGSymbolElement.cpp \
|
||||
nsSVGUnknownElement.cpp \
|
||||
nsSVGViewBox.cpp \
|
||||
SVGAElement.cpp \
|
||||
@ -121,6 +120,7 @@ CPPSRCS = \
|
||||
SVGStopElement.cpp \
|
||||
SVGStringList.cpp \
|
||||
SVGStyleElement.cpp \
|
||||
SVGSymbolElement.cpp \
|
||||
SVGSVGElement.cpp \
|
||||
SVGSwitchElement.cpp \
|
||||
SVGTextContentElement.cpp \
|
||||
@ -184,6 +184,7 @@ EXPORTS_mozilla/dom = \
|
||||
SVGSetElement.h \
|
||||
SVGStopElement.h \
|
||||
SVGStyleElement.h \
|
||||
SVGSymbolElement.h \
|
||||
SVGSVGElement.h \
|
||||
SVGSwitchElement.h \
|
||||
SVGTextContentElement.h \
|
||||
|
102
content/svg/content/src/SVGSymbolElement.cpp
Normal file
102
content/svg/content/src/SVGSymbolElement.cpp
Normal file
@ -0,0 +1,102 @@
|
||||
/* -*- 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/SVGSymbolElement.h"
|
||||
|
||||
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Symbol)
|
||||
|
||||
DOMCI_NODE_DATA(SVGSymbolElement, mozilla::dom::SVGSymbolElement)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(SVGSymbolElement,SVGSymbolElementBase)
|
||||
NS_IMPL_RELEASE_INHERITED(SVGSymbolElement,SVGSymbolElementBase)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(SVGSymbolElement)
|
||||
NS_NODE_INTERFACE_TABLE5(SVGSymbolElement, nsIDOMNode, nsIDOMElement,
|
||||
nsIDOMSVGElement, nsIDOMSVGFitToViewBox,
|
||||
nsIDOMSVGSymbolElement)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGSymbolElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(SVGSymbolElementBase)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation
|
||||
|
||||
SVGSymbolElement::SVGSymbolElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: SVGSymbolElementBase(aNodeInfo)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode methods
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGSymbolElement)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGFitToViewBox methods
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedRect viewBox; */
|
||||
NS_IMETHODIMP SVGSymbolElement::GetViewBox(nsIDOMSVGAnimatedRect * *aViewBox)
|
||||
{
|
||||
return mViewBox.ToDOMAnimatedRect(aViewBox, this);
|
||||
}
|
||||
|
||||
/* readonly attribute SVGPreserveAspectRatio preserveAspectRatio; */
|
||||
NS_IMETHODIMP
|
||||
SVGSymbolElement::GetPreserveAspectRatio(nsISupports
|
||||
**aPreserveAspectRatio)
|
||||
{
|
||||
nsRefPtr<DOMSVGAnimatedPreserveAspectRatio> ratio;
|
||||
mPreserveAspectRatio.ToDOMAnimatedPreserveAspectRatio(getter_AddRefs(ratio), this);
|
||||
ratio.forget(aPreserveAspectRatio);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIContent methods
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
SVGSymbolElement::IsAttributeMapped(const nsIAtom* name) const
|
||||
{
|
||||
static const MappedAttributeEntry* const map[] = {
|
||||
sColorMap,
|
||||
sFEFloodMap,
|
||||
sFillStrokeMap,
|
||||
sFiltersMap,
|
||||
sFontSpecificationMap,
|
||||
sGradientStopMap,
|
||||
sGraphicsMap,
|
||||
sLightingEffectsMap,
|
||||
sMarkersMap,
|
||||
sTextContentElementsMap,
|
||||
sViewportsMap
|
||||
};
|
||||
|
||||
return FindAttributeDependence(name, map) ||
|
||||
SVGSymbolElementBase::IsAttributeMapped(name);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
nsSVGViewBox *
|
||||
SVGSymbolElement::GetViewBox()
|
||||
{
|
||||
return &mViewBox;
|
||||
}
|
||||
|
||||
SVGAnimatedPreserveAspectRatio *
|
||||
SVGSymbolElement::GetPreserveAspectRatio()
|
||||
{
|
||||
return &mPreserveAspectRatio;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
66
content/svg/content/src/SVGSymbolElement.h
Normal file
66
content/svg/content/src/SVGSymbolElement.h
Normal file
@ -0,0 +1,66 @@
|
||||
/* -*- 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_SVGSymbolElement_h
|
||||
#define mozilla_dom_SVGSymbolElement_h
|
||||
|
||||
#include "nsIDOMSVGSymbolElement.h"
|
||||
#include "DOMSVGTests.h"
|
||||
#include "nsSVGElement.h"
|
||||
#include "nsSVGViewBox.h"
|
||||
#include "SVGAnimatedPreserveAspectRatio.h"
|
||||
#include "nsIDOMSVGFitToViewBox.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
||||
nsresult NS_NewSVGSymbolElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
typedef nsSVGElement SVGSymbolElementBase;
|
||||
|
||||
class SVGSymbolElement MOZ_FINAL : public SVGSymbolElementBase,
|
||||
public nsIDOMSVGSymbolElement,
|
||||
public DOMSVGTests,
|
||||
public nsIDOMSVGFitToViewBox
|
||||
{
|
||||
protected:
|
||||
friend nsresult (::NS_NewSVGSymbolElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo));
|
||||
SVGSymbolElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
|
||||
public:
|
||||
// interfaces:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDOMSVGSYMBOLELEMENT
|
||||
NS_DECL_NSIDOMSVGFITTOVIEWBOX
|
||||
|
||||
// xxx I wish we could use virtual inheritance
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGElement::)
|
||||
|
||||
// nsIContent interface
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
protected:
|
||||
virtual nsSVGViewBox *GetViewBox();
|
||||
virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio();
|
||||
|
||||
nsSVGViewBox mViewBox;
|
||||
SVGAnimatedPreserveAspectRatio mPreserveAspectRatio;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_SVGSymbolElement_h
|
@ -1,147 +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 "nsIDOMSVGSymbolElement.h"
|
||||
#include "DOMSVGTests.h"
|
||||
#include "nsSVGElement.h"
|
||||
#include "nsSVGViewBox.h"
|
||||
#include "SVGAnimatedPreserveAspectRatio.h"
|
||||
#include "nsIDOMSVGFitToViewBox.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
typedef nsSVGElement nsSVGSymbolElementBase;
|
||||
|
||||
class nsSVGSymbolElement : public nsSVGSymbolElementBase,
|
||||
public nsIDOMSVGSymbolElement,
|
||||
public DOMSVGTests,
|
||||
public nsIDOMSVGFitToViewBox
|
||||
{
|
||||
protected:
|
||||
friend nsresult NS_NewSVGSymbolElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
nsSVGSymbolElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
|
||||
public:
|
||||
// interfaces:
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDOMSVGSYMBOLELEMENT
|
||||
NS_DECL_NSIDOMSVGFITTOVIEWBOX
|
||||
|
||||
// xxx I wish we could use virtual inheritance
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGElement::)
|
||||
|
||||
// nsIContent interface
|
||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const;
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
virtual nsXPCClassInfo* GetClassInfo();
|
||||
|
||||
virtual nsIDOMNode* AsDOMNode() { return this; }
|
||||
protected:
|
||||
virtual nsSVGViewBox *GetViewBox();
|
||||
virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio();
|
||||
|
||||
nsSVGViewBox mViewBox;
|
||||
SVGAnimatedPreserveAspectRatio mPreserveAspectRatio;
|
||||
};
|
||||
|
||||
NS_IMPL_NS_NEW_SVG_ELEMENT(Symbol)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsSVGSymbolElement,nsSVGSymbolElementBase)
|
||||
NS_IMPL_RELEASE_INHERITED(nsSVGSymbolElement,nsSVGSymbolElementBase)
|
||||
|
||||
DOMCI_NODE_DATA(SVGSymbolElement, nsSVGSymbolElement)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(nsSVGSymbolElement)
|
||||
NS_NODE_INTERFACE_TABLE5(nsSVGSymbolElement, nsIDOMNode, nsIDOMElement,
|
||||
nsIDOMSVGElement, nsIDOMSVGFitToViewBox,
|
||||
nsIDOMSVGSymbolElement)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGSymbolElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsSVGSymbolElementBase)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation
|
||||
|
||||
nsSVGSymbolElement::nsSVGSymbolElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsSVGSymbolElementBase(aNodeInfo)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode methods
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGSymbolElement)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGFitToViewBox methods
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedRect viewBox; */
|
||||
NS_IMETHODIMP nsSVGSymbolElement::GetViewBox(nsIDOMSVGAnimatedRect * *aViewBox)
|
||||
{
|
||||
return mViewBox.ToDOMAnimatedRect(aViewBox, this);
|
||||
}
|
||||
|
||||
/* readonly attribute SVGPreserveAspectRatio preserveAspectRatio; */
|
||||
NS_IMETHODIMP
|
||||
nsSVGSymbolElement::GetPreserveAspectRatio(nsISupports
|
||||
**aPreserveAspectRatio)
|
||||
{
|
||||
nsRefPtr<DOMSVGAnimatedPreserveAspectRatio> ratio;
|
||||
mPreserveAspectRatio.ToDOMAnimatedPreserveAspectRatio(getter_AddRefs(ratio), this);
|
||||
ratio.forget(aPreserveAspectRatio);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIContent methods
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
nsSVGSymbolElement::IsAttributeMapped(const nsIAtom* name) const
|
||||
{
|
||||
static const MappedAttributeEntry* const map[] = {
|
||||
sColorMap,
|
||||
sFEFloodMap,
|
||||
sFillStrokeMap,
|
||||
sFiltersMap,
|
||||
sFontSpecificationMap,
|
||||
sGradientStopMap,
|
||||
sGraphicsMap,
|
||||
sLightingEffectsMap,
|
||||
sMarkersMap,
|
||||
sTextContentElementsMap,
|
||||
sViewportsMap
|
||||
};
|
||||
|
||||
return FindAttributeDependence(name, map) ||
|
||||
nsSVGSymbolElementBase::IsAttributeMapped(name);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsSVGElement methods
|
||||
|
||||
nsSVGViewBox *
|
||||
nsSVGSymbolElement::GetViewBox()
|
||||
{
|
||||
return &mViewBox;
|
||||
}
|
||||
|
||||
SVGAnimatedPreserveAspectRatio *
|
||||
nsSVGSymbolElement::GetPreserveAspectRatio()
|
||||
{
|
||||
return &mPreserveAspectRatio;
|
||||
}
|
Loading…
Reference in New Issue
Block a user