mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 14:52:16 +00:00
Bug 825834 - Move SVGViewElement to mozilla:::dom r=bz
--HG-- rename : content/svg/content/src/nsSVGViewElement.cpp => content/svg/content/src/SVGViewElement.cpp rename : content/svg/content/src/nsSVGViewElement.h => content/svg/content/src/SVGViewElement.h
This commit is contained in:
parent
26b82f4427
commit
a3aaae810c
@ -68,7 +68,6 @@ CPPSRCS = \
|
||||
nsSVGUnknownElement.cpp \
|
||||
nsSVGUseElement.cpp \
|
||||
nsSVGViewBox.cpp \
|
||||
nsSVGViewElement.cpp \
|
||||
SVGAltGlyphElement.cpp \
|
||||
SVGAngle.cpp \
|
||||
SVGAnimatedAngle.cpp \
|
||||
@ -137,6 +136,7 @@ CPPSRCS = \
|
||||
SVGTransformListSMILType.cpp \
|
||||
SVGTSpanElement.cpp \
|
||||
SVGViewBoxSMILType.cpp \
|
||||
SVGViewElement.cpp \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
@ -188,6 +188,7 @@ EXPORTS_mozilla/dom = \
|
||||
SVGTitleElement.h \
|
||||
SVGTransformableElement.h \
|
||||
SVGTSpanElement.h \
|
||||
SVGViewElement.h \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include "SVGFragmentIdentifier.h"
|
||||
#include "nsIDOMSVGDocument.h"
|
||||
#include "nsSVGSVGElement.h"
|
||||
#include "nsSVGViewElement.h"
|
||||
#include "mozilla/dom/SVGViewElement.h"
|
||||
#include "SVGAnimatedTransformList.h"
|
||||
|
||||
using namespace mozilla;
|
||||
@ -27,12 +27,12 @@ IgnoreWhitespace(PRUnichar aChar)
|
||||
return false;
|
||||
}
|
||||
|
||||
static nsSVGViewElement*
|
||||
static dom::SVGViewElement*
|
||||
GetViewElement(nsIDocument *aDocument, const nsAString &aId)
|
||||
{
|
||||
dom::Element* element = aDocument->GetElementById(aId);
|
||||
return (element && element->IsSVG(nsGkAtoms::view)) ?
|
||||
static_cast<nsSVGViewElement*>(element) : nullptr;
|
||||
static_cast<dom::SVGViewElement*>(element) : nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
@ -236,7 +236,7 @@ SVGFragmentIdentifier::ProcessFragmentIdentifier(nsIDocument *aDocument,
|
||||
SaveOldZoomAndPan(rootElement);
|
||||
}
|
||||
|
||||
const nsSVGViewElement *viewElement = GetViewElement(aDocument, aAnchorName);
|
||||
const dom::SVGViewElement *viewElement = GetViewElement(aDocument, aAnchorName);
|
||||
|
||||
if (viewElement) {
|
||||
if (!rootElement->mCurrentViewID) {
|
||||
|
@ -3,24 +3,28 @@
|
||||
* 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 "nsSVGViewElement.h"
|
||||
#include "mozilla/dom/SVGViewElement.h"
|
||||
#include "DOMSVGStringList.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
DOMCI_NODE_DATA(SVGViewElement, mozilla::dom::SVGViewElement)
|
||||
|
||||
nsSVGElement::StringListInfo nsSVGViewElement::sStringListInfo[1] =
|
||||
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(View)
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
nsSVGElement::StringListInfo SVGViewElement::sStringListInfo[1] =
|
||||
{
|
||||
{ &nsGkAtoms::viewTarget }
|
||||
};
|
||||
|
||||
nsSVGEnumMapping nsSVGViewElement::sZoomAndPanMap[] = {
|
||||
nsSVGEnumMapping SVGViewElement::sZoomAndPanMap[] = {
|
||||
{&nsGkAtoms::disable, nsIDOMSVGZoomAndPan::SVG_ZOOMANDPAN_DISABLE},
|
||||
{&nsGkAtoms::magnify, nsIDOMSVGZoomAndPan::SVG_ZOOMANDPAN_MAGNIFY},
|
||||
{nullptr, 0}
|
||||
};
|
||||
|
||||
nsSVGElement::EnumInfo nsSVGViewElement::sEnumInfo[1] =
|
||||
nsSVGElement::EnumInfo SVGViewElement::sEnumInfo[1] =
|
||||
{
|
||||
{ &nsGkAtoms::zoomAndPan,
|
||||
sZoomAndPanMap,
|
||||
@ -28,50 +32,46 @@ nsSVGElement::EnumInfo nsSVGViewElement::sEnumInfo[1] =
|
||||
}
|
||||
};
|
||||
|
||||
NS_IMPL_NS_NEW_SVG_ELEMENT(View)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsISupports methods
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsSVGViewElement,nsSVGViewElementBase)
|
||||
NS_IMPL_RELEASE_INHERITED(nsSVGViewElement,nsSVGViewElementBase)
|
||||
NS_IMPL_ADDREF_INHERITED(SVGViewElement,SVGViewElementBase)
|
||||
NS_IMPL_RELEASE_INHERITED(SVGViewElement,SVGViewElementBase)
|
||||
|
||||
DOMCI_NODE_DATA(SVGViewElement, nsSVGViewElement)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(nsSVGViewElement)
|
||||
NS_NODE_INTERFACE_TABLE6(nsSVGViewElement, nsIDOMNode, nsIDOMElement,
|
||||
NS_INTERFACE_TABLE_HEAD(SVGViewElement)
|
||||
NS_NODE_INTERFACE_TABLE6(SVGViewElement, nsIDOMNode, nsIDOMElement,
|
||||
nsIDOMSVGElement, nsIDOMSVGViewElement,
|
||||
nsIDOMSVGFitToViewBox,
|
||||
nsIDOMSVGZoomAndPan)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGViewElement)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsSVGViewElementBase)
|
||||
NS_INTERFACE_MAP_END_INHERITING(SVGViewElementBase)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Implementation
|
||||
|
||||
nsSVGViewElement::nsSVGViewElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: nsSVGViewElementBase(aNodeInfo)
|
||||
SVGViewElement::SVGViewElement(already_AddRefed<nsINodeInfo> aNodeInfo)
|
||||
: SVGViewElementBase(aNodeInfo)
|
||||
{
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMNode methods
|
||||
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGViewElement)
|
||||
NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGViewElement)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsIDOMSVGZoomAndPan methods
|
||||
|
||||
/* attribute unsigned short zoomAndPan; */
|
||||
NS_IMETHODIMP
|
||||
nsSVGViewElement::GetZoomAndPan(uint16_t *aZoomAndPan)
|
||||
SVGViewElement::GetZoomAndPan(uint16_t *aZoomAndPan)
|
||||
{
|
||||
*aZoomAndPan = mEnumAttributes[ZOOMANDPAN].GetAnimValue();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsSVGViewElement::SetZoomAndPan(uint16_t aZoomAndPan)
|
||||
SVGViewElement::SetZoomAndPan(uint16_t aZoomAndPan)
|
||||
{
|
||||
if (aZoomAndPan == nsIDOMSVGZoomAndPan::SVG_ZOOMANDPAN_DISABLE ||
|
||||
aZoomAndPan == nsIDOMSVGZoomAndPan::SVG_ZOOMANDPAN_MAGNIFY) {
|
||||
@ -87,15 +87,15 @@ nsSVGViewElement::SetZoomAndPan(uint16_t aZoomAndPan)
|
||||
|
||||
/* readonly attribute nsIDOMSVGAnimatedRect viewBox; */
|
||||
NS_IMETHODIMP
|
||||
nsSVGViewElement::GetViewBox(nsIDOMSVGAnimatedRect * *aViewBox)
|
||||
SVGViewElement::GetViewBox(nsIDOMSVGAnimatedRect * *aViewBox)
|
||||
{
|
||||
return mViewBox.ToDOMAnimatedRect(aViewBox, this);
|
||||
}
|
||||
|
||||
/* readonly attribute SVGPreserveAspectRatio preserveAspectRatio; */
|
||||
NS_IMETHODIMP
|
||||
nsSVGViewElement::GetPreserveAspectRatio(nsISupports
|
||||
**aPreserveAspectRatio)
|
||||
SVGViewElement::GetPreserveAspectRatio(nsISupports
|
||||
**aPreserveAspectRatio)
|
||||
{
|
||||
nsRefPtr<DOMSVGAnimatedPreserveAspectRatio> ratio;
|
||||
mPreserveAspectRatio.ToDOMAnimatedPreserveAspectRatio(getter_AddRefs(ratio), this);
|
||||
@ -107,7 +107,7 @@ nsSVGViewElement::GetPreserveAspectRatio(nsISupports
|
||||
// nsIDOMSVGViewElement methods
|
||||
|
||||
/* readonly attribute nsIDOMSVGStringList viewTarget; */
|
||||
NS_IMETHODIMP nsSVGViewElement::GetViewTarget(nsIDOMSVGStringList * *aViewTarget)
|
||||
NS_IMETHODIMP SVGViewElement::GetViewTarget(nsIDOMSVGStringList * *aViewTarget)
|
||||
{
|
||||
*aViewTarget = DOMSVGStringList::GetDOMWrapper(
|
||||
&mStringListAttributes[VIEW_TARGET], this, false, VIEW_TARGET).get();
|
||||
@ -118,27 +118,30 @@ NS_IMETHODIMP nsSVGViewElement::GetViewTarget(nsIDOMSVGStringList * *aViewTarget
|
||||
// nsSVGElement methods
|
||||
|
||||
nsSVGElement::EnumAttributesInfo
|
||||
nsSVGViewElement::GetEnumInfo()
|
||||
SVGViewElement::GetEnumInfo()
|
||||
{
|
||||
return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
|
||||
ArrayLength(sEnumInfo));
|
||||
}
|
||||
|
||||
nsSVGViewBox *
|
||||
nsSVGViewElement::GetViewBox()
|
||||
SVGViewElement::GetViewBox()
|
||||
{
|
||||
return &mViewBox;
|
||||
}
|
||||
|
||||
SVGAnimatedPreserveAspectRatio *
|
||||
nsSVGViewElement::GetPreserveAspectRatio()
|
||||
SVGViewElement::GetPreserveAspectRatio()
|
||||
{
|
||||
return &mPreserveAspectRatio;
|
||||
}
|
||||
|
||||
nsSVGElement::StringListAttributesInfo
|
||||
nsSVGViewElement::GetStringListInfo()
|
||||
SVGViewElement::GetStringListInfo()
|
||||
{
|
||||
return StringListAttributesInfo(mStringListAttributes, sStringListInfo,
|
||||
ArrayLength(sStringListInfo));
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
@ -3,8 +3,8 @@
|
||||
* 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_SVGVIEWELEMENT_H__
|
||||
#define __NS_SVGVIEWELEMENT_H__
|
||||
#ifndef mozilla_dom_SVGViewElement_h
|
||||
#define mozilla_dom_SVGViewElement_h
|
||||
|
||||
#include "nsIDOMSVGViewElement.h"
|
||||
#include "nsIDOMSVGFitToViewBox.h"
|
||||
@ -15,27 +15,34 @@
|
||||
#include "SVGAnimatedPreserveAspectRatio.h"
|
||||
#include "SVGStringList.h"
|
||||
|
||||
typedef nsSVGElement SVGViewElementBase;
|
||||
|
||||
class nsSVGSVGElement;
|
||||
class nsSVGOuterSVGFrame;
|
||||
|
||||
nsresult NS_NewSVGViewElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
|
||||
namespace mozilla {
|
||||
class SVGFragmentIdentifier;
|
||||
}
|
||||
class SVGFragmentIdentifier;
|
||||
|
||||
typedef nsSVGElement nsSVGViewElementBase;
|
||||
namespace dom {
|
||||
|
||||
class nsSVGViewElement : public nsSVGViewElementBase,
|
||||
public nsIDOMSVGViewElement,
|
||||
public nsIDOMSVGFitToViewBox,
|
||||
public nsIDOMSVGZoomAndPan
|
||||
class SVGViewElement : public SVGViewElementBase,
|
||||
public nsIDOMSVGViewElement,
|
||||
public nsIDOMSVGFitToViewBox,
|
||||
public nsIDOMSVGZoomAndPan
|
||||
{
|
||||
friend class mozilla::SVGFragmentIdentifier;
|
||||
friend class nsSVGSVGElement;
|
||||
friend class nsSVGOuterSVGFrame;
|
||||
friend nsresult NS_NewSVGViewElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
nsSVGViewElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
|
||||
friend class ::nsSVGSVGElement;
|
||||
friend class ::nsSVGOuterSVGFrame;
|
||||
SVGViewElement(already_AddRefed<nsINodeInfo> aNodeInfo);
|
||||
friend nsresult (::NS_NewSVGViewElement(nsIContent **aResult,
|
||||
already_AddRefed<nsINodeInfo> aNodeInfo));
|
||||
|
||||
public:
|
||||
// interfaces:
|
||||
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIDOMSVGVIEWELEMENT
|
||||
NS_DECL_NSIDOMSVGFITTOVIEWBOX
|
||||
@ -45,7 +52,7 @@ public:
|
||||
// forward here :-(
|
||||
NS_FORWARD_NSIDOMNODE_TO_NSINODE
|
||||
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGViewElementBase::)
|
||||
NS_FORWARD_NSIDOMSVGELEMENT(SVGViewElementBase::)
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
||||
@ -76,4 +83,7 @@ private:
|
||||
static StringListInfo sStringListInfo[1];
|
||||
};
|
||||
|
||||
#endif
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_SVGViewElement_h
|
@ -28,7 +28,7 @@
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsSVGSVGElement.h"
|
||||
#include "nsSVGUtils.h"
|
||||
#include "nsSVGViewElement.h"
|
||||
#include "mozilla/dom/SVGViewElement.h"
|
||||
#include "nsStyleUtil.h"
|
||||
#include "SVGContentUtils.h"
|
||||
|
||||
@ -608,11 +608,11 @@ nsSVGSVGElement::GetPreserveAspectRatio(nsISupports
|
||||
NS_IMETHODIMP
|
||||
nsSVGSVGElement::GetZoomAndPan(uint16_t *aZoomAndPan)
|
||||
{
|
||||
nsSVGViewElement* viewElement = GetCurrentViewElement();
|
||||
SVGViewElement* viewElement = GetCurrentViewElement();
|
||||
if (viewElement && viewElement->mEnumAttributes[
|
||||
nsSVGViewElement::ZOOMANDPAN].IsExplicitlySet()) {
|
||||
SVGViewElement::ZOOMANDPAN].IsExplicitlySet()) {
|
||||
*aZoomAndPan = viewElement->mEnumAttributes[
|
||||
nsSVGViewElement::ZOOMANDPAN].GetAnimValue();
|
||||
SVGViewElement::ZOOMANDPAN].GetAnimValue();
|
||||
} else {
|
||||
*aZoomAndPan = mEnumAttributes[ZOOMANDPAN].GetAnimValue();
|
||||
}
|
||||
@ -974,7 +974,7 @@ nsSVGSVGElement::HasPreserveAspectRatio()
|
||||
mPreserveAspectRatio.IsAnimated();
|
||||
}
|
||||
|
||||
nsSVGViewElement*
|
||||
SVGViewElement*
|
||||
nsSVGSVGElement::GetCurrentViewElement() const
|
||||
{
|
||||
if (mCurrentViewID) {
|
||||
@ -982,7 +982,7 @@ nsSVGSVGElement::GetCurrentViewElement() const
|
||||
if (doc) {
|
||||
Element *element = doc->GetElementById(*mCurrentViewID);
|
||||
if (element && element->IsSVG(nsGkAtoms::view)) {
|
||||
return static_cast<nsSVGViewElement*>(element);
|
||||
return static_cast<SVGViewElement*>(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -994,7 +994,7 @@ nsSVGSVGElement::GetViewBoxWithSynthesis(
|
||||
float aViewportWidth, float aViewportHeight) const
|
||||
{
|
||||
// The logic here should match HasViewBox().
|
||||
nsSVGViewElement* viewElement = GetCurrentViewElement();
|
||||
SVGViewElement* viewElement = GetCurrentViewElement();
|
||||
if (viewElement && viewElement->mViewBox.IsExplicitlySet()) {
|
||||
return viewElement->mViewBox.GetAnimValue();
|
||||
}
|
||||
@ -1029,7 +1029,7 @@ nsSVGSVGElement::GetPreserveAspectRatioWithOverride() const
|
||||
}
|
||||
}
|
||||
|
||||
nsSVGViewElement* viewElement = GetCurrentViewElement();
|
||||
SVGViewElement* viewElement = GetCurrentViewElement();
|
||||
|
||||
// This check is equivalent to "!HasViewBox() && ShouldSynthesizeViewBox()".
|
||||
// We're just holding onto the viewElement that HasViewBox() would look up,
|
||||
@ -1055,7 +1055,7 @@ nsSVGSVGElement::GetLength(uint8_t aCtxType)
|
||||
{
|
||||
float h, w;
|
||||
|
||||
nsSVGViewElement* viewElement = GetCurrentViewElement();
|
||||
SVGViewElement* viewElement = GetCurrentViewElement();
|
||||
const nsSVGViewBoxRect* viewbox = nullptr;
|
||||
|
||||
// The logic here should match HasViewBox().
|
||||
@ -1177,7 +1177,7 @@ nsSVGSVGElement::GetPreserveAspectRatio()
|
||||
bool
|
||||
nsSVGSVGElement::HasViewBox() const
|
||||
{
|
||||
nsSVGViewElement* viewElement = GetCurrentViewElement();
|
||||
SVGViewElement* viewElement = GetCurrentViewElement();
|
||||
if (viewElement && viewElement->mViewBox.IsExplicitlySet()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -21,10 +21,13 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
class nsSMILTimeContainer;
|
||||
class nsSVGViewElement;
|
||||
namespace mozilla {
|
||||
class DOMSVGMatrix;
|
||||
class SVGFragmentIdentifier;
|
||||
|
||||
namespace dom {
|
||||
class SVGViewElement;
|
||||
}
|
||||
}
|
||||
|
||||
typedef mozilla::dom::SVGGraphicsElement nsSVGSVGElementBase;
|
||||
@ -261,7 +264,7 @@ private:
|
||||
|
||||
// implementation helpers:
|
||||
|
||||
nsSVGViewElement* GetCurrentViewElement() const;
|
||||
mozilla::dom::SVGViewElement* GetCurrentViewElement() const;
|
||||
|
||||
// Methods for <image> elements to override my "PreserveAspectRatio" value.
|
||||
// These are private so that only our friends (nsSVGImageFrame in
|
||||
|
@ -8,7 +8,7 @@
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsSVGOuterSVGFrame.h"
|
||||
#include "nsSVGSVGElement.h"
|
||||
#include "nsSVGViewElement.h"
|
||||
#include "mozilla/dom/SVGViewElement.h"
|
||||
|
||||
typedef nsFrame SVGViewFrameBase;
|
||||
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "nsSVGForeignObjectFrame.h"
|
||||
#include "nsSVGSVGElement.h"
|
||||
#include "nsSVGTextFrame.h"
|
||||
#include "nsSVGViewElement.h"
|
||||
#include "mozilla/dom/SVGViewElement.h"
|
||||
#include "nsSubDocumentFrame.h"
|
||||
|
||||
namespace dom = mozilla::dom;
|
||||
@ -286,7 +286,7 @@ nsSVGOuterSVGFrame::GetIntrinsicRatio()
|
||||
return ratio;
|
||||
}
|
||||
|
||||
nsSVGViewElement* viewElement = content->GetCurrentViewElement();
|
||||
dom::SVGViewElement* viewElement = content->GetCurrentViewElement();
|
||||
const nsSVGViewBoxRect* viewbox = nullptr;
|
||||
|
||||
// The logic here should match HasViewBox().
|
||||
|
Loading…
Reference in New Issue
Block a user