Bug 827119: Move SVGSVGElement to mozilla::dom r=bz

--HG--
rename : content/svg/content/src/nsSVGSVGElement.cpp => content/svg/content/src/SVGSVGElement.cpp
rename : content/svg/content/src/nsSVGSVGElement.h => content/svg/content/src/SVGSVGElement.h
This commit is contained in:
David Zbarsky 2013-01-09 18:02:45 -05:00
parent a90d14ab62
commit f95b0f0bde
35 changed files with 362 additions and 348 deletions

View File

@ -63,7 +63,6 @@ CPPSRCS = \
nsSVGPolyElement.cpp \
nsSVGString.cpp \
nsSVGRect.cpp \
nsSVGSVGElement.cpp \
nsSVGSymbolElement.cpp \
nsSVGUnknownElement.cpp \
nsSVGUseElement.cpp \
@ -123,6 +122,7 @@ CPPSRCS = \
SVGStopElement.cpp \
SVGStringList.cpp \
SVGStyleElement.cpp \
SVGSVGElement.cpp \
SVGSwitchElement.cpp \
SVGTextContentElement.cpp \
SVGTextElement.cpp \
@ -180,6 +180,7 @@ EXPORTS_mozilla/dom = \
SVGSetElement.h \
SVGStopElement.h \
SVGStyleElement.h \
SVGSVGElement.h \
SVGSwitchElement.h \
SVGTextContentElement.h \
SVGTextElement.h \

View File

@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/SVGAnimationElement.h"
#include "nsSVGSVGElement.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "nsSMILTimeContainer.h"
#include "nsSMILAnimationController.h"
#include "nsSMILAnimationFunction.h"
@ -436,7 +436,7 @@ SVGAnimationElement::ActivateByHyperlink()
if (timeContainer) {
timeContainer->SetCurrentTime(seekTime.GetMillis());
AnimationNeedsResample();
// As with nsSVGSVGElement::SetCurrentTime, we need to trigger
// As with SVGSVGElement::SetCurrentTime, we need to trigger
// a synchronous sample now.
FlushAnimations();
}
@ -453,7 +453,7 @@ SVGAnimationElement::ActivateByHyperlink()
nsSMILTimeContainer*
SVGAnimationElement::GetTimeContainer()
{
nsSVGSVGElement *element = SVGContentUtils::GetOuterSVGElement(this);
SVGSVGElement *element = SVGContentUtils::GetOuterSVGElement(this);
if (element) {
return element->GetTimedDocumentRoot();

View File

@ -16,13 +16,13 @@
#include "nsIScriptError.h"
#include "nsLayoutUtils.h"
#include "SVGAnimationElement.h"
#include "nsSVGSVGElement.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "SVGAnimatedPreserveAspectRatio.h"
using namespace mozilla;
using namespace mozilla::dom;
nsSVGSVGElement*
SVGSVGElement*
SVGContentUtils::GetOuterSVGElement(nsSVGElement *aSVGElement)
{
nsIContent *element = nullptr;
@ -35,7 +35,7 @@ SVGContentUtils::GetOuterSVGElement(nsSVGElement *aSVGElement)
}
if (element && element->Tag() == nsGkAtoms::svg) {
return static_cast<nsSVGSVGElement*>(element);
return static_cast<SVGSVGElement*>(element);
}
return nullptr;
}

View File

@ -19,13 +19,13 @@ class nsIFrame;
class nsStyleContext;
class nsSVGElement;
class nsSVGLength2;
class nsSVGSVGElement;
namespace mozilla {
class SVGAnimatedPreserveAspectRatio;
class SVGPreserveAspectRatio;
namespace dom {
class Element;
class SVGSVGElement;
} // namespace dom
} // namespace mozilla
@ -56,7 +56,7 @@ public:
/*
* Get the outer SVG element of an nsIContent
*/
static nsSVGSVGElement *GetOuterSVGElement(nsSVGElement *aSVGElement);
static mozilla::dom::SVGSVGElement *GetOuterSVGElement(nsSVGElement *aSVGElement);
/**
* Activates the animation element aContent as a result of navigation to the

View File

@ -5,7 +5,7 @@
#include "SVGFragmentIdentifier.h"
#include "nsIDOMSVGDocument.h"
#include "nsSVGSVGElement.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "mozilla/dom/SVGViewElement.h"
#include "SVGAnimatedTransformList.h"
@ -35,8 +35,8 @@ GetViewElement(nsIDocument *aDocument, const nsAString &aId)
static_cast<dom::SVGViewElement*>(element) : nullptr;
}
void
SVGFragmentIdentifier::SaveOldPreserveAspectRatio(nsSVGSVGElement *root)
void
SVGFragmentIdentifier::SaveOldPreserveAspectRatio(dom::SVGSVGElement *root)
{
if (root->mPreserveAspectRatio.IsExplicitlySet()) {
root->SetPreserveAspectRatioProperty(root->mPreserveAspectRatio.GetBaseValue());
@ -44,7 +44,7 @@ SVGFragmentIdentifier::SaveOldPreserveAspectRatio(nsSVGSVGElement *root)
}
void
SVGFragmentIdentifier::RestoreOldPreserveAspectRatio(nsSVGSVGElement *root)
SVGFragmentIdentifier::RestoreOldPreserveAspectRatio(dom::SVGSVGElement *root)
{
const SVGPreserveAspectRatio *oldPARPtr = root->GetPreserveAspectRatioProperty();
if (oldPARPtr) {
@ -56,7 +56,7 @@ SVGFragmentIdentifier::RestoreOldPreserveAspectRatio(nsSVGSVGElement *root)
}
void
SVGFragmentIdentifier::SaveOldViewBox(nsSVGSVGElement *root)
SVGFragmentIdentifier::SaveOldViewBox(dom::SVGSVGElement *root)
{
if (root->mViewBox.IsExplicitlySet()) {
root->SetViewBoxProperty(root->mViewBox.GetBaseValue());
@ -64,7 +64,7 @@ SVGFragmentIdentifier::SaveOldViewBox(nsSVGSVGElement *root)
}
void
SVGFragmentIdentifier::RestoreOldViewBox(nsSVGSVGElement *root)
SVGFragmentIdentifier::RestoreOldViewBox(dom::SVGSVGElement *root)
{
const nsSVGViewBoxRect *oldViewBoxPtr = root->GetViewBoxProperty();
if (oldViewBoxPtr) {
@ -76,27 +76,27 @@ SVGFragmentIdentifier::RestoreOldViewBox(nsSVGSVGElement *root)
}
void
SVGFragmentIdentifier::SaveOldZoomAndPan(nsSVGSVGElement *root)
SVGFragmentIdentifier::SaveOldZoomAndPan(dom::SVGSVGElement *root)
{
if (root->mEnumAttributes[nsSVGSVGElement::ZOOMANDPAN].IsExplicitlySet()) {
root->SetZoomAndPanProperty(root->mEnumAttributes[nsSVGSVGElement::ZOOMANDPAN].GetBaseValue());
if (root->mEnumAttributes[dom::SVGSVGElement::ZOOMANDPAN].IsExplicitlySet()) {
root->SetZoomAndPanProperty(root->mEnumAttributes[dom::SVGSVGElement::ZOOMANDPAN].GetBaseValue());
}
}
void
SVGFragmentIdentifier::RestoreOldZoomAndPan(nsSVGSVGElement *root)
SVGFragmentIdentifier::RestoreOldZoomAndPan(dom::SVGSVGElement *root)
{
uint16_t oldZoomAndPan = root->GetZoomAndPanProperty();
if (oldZoomAndPan != nsIDOMSVGZoomAndPan::SVG_ZOOMANDPAN_UNKNOWN) {
root->mEnumAttributes[nsSVGSVGElement::ZOOMANDPAN].SetBaseValue(oldZoomAndPan, root);
} else if (root->mEnumAttributes[nsSVGSVGElement::ZOOMANDPAN].IsExplicitlySet()) {
root->mEnumAttributes[dom::SVGSVGElement::ZOOMANDPAN].SetBaseValue(oldZoomAndPan, root);
} else if (root->mEnumAttributes[dom::SVGSVGElement::ZOOMANDPAN].IsExplicitlySet()) {
mozilla::ErrorResult error;
root->RemoveAttribute(NS_LITERAL_STRING("zoomAndPan"), error);
}
}
void
SVGFragmentIdentifier::ClearTransform(nsSVGSVGElement *root)
SVGFragmentIdentifier::ClearTransform(dom::SVGSVGElement *root)
{
root->mFragmentIdentifierTransform = nullptr;
root->InvalidateTransformNotifyFrame();
@ -104,7 +104,7 @@ SVGFragmentIdentifier::ClearTransform(nsSVGSVGElement *root)
bool
SVGFragmentIdentifier::ProcessSVGViewSpec(const nsAString &aViewSpec,
nsSVGSVGElement *root)
dom::SVGSVGElement *root)
{
if (!IsMatchingParameter(aViewSpec, NS_LITERAL_STRING("svgView"))) {
return false;
@ -177,11 +177,11 @@ SVGFragmentIdentifier::ProcessSVGViewSpec(const nsAString &aViewSpec,
if (!valAtom) {
return false;
}
const nsSVGEnumMapping *mapping = nsSVGSVGElement::sZoomAndPanMap;
const nsSVGEnumMapping *mapping = dom::SVGSVGElement::sZoomAndPanMap;
while (mapping->mKey) {
if (valAtom == *(mapping->mKey)) {
// If we've got a valid zoomAndPan value, then set it on our root element.
if (NS_FAILED(root->mEnumAttributes[nsSVGSVGElement::ZOOMANDPAN].SetBaseValue(
if (NS_FAILED(root->mEnumAttributes[dom::SVGSVGElement::ZOOMANDPAN].SetBaseValue(
mapping->mVal, root))) {
return false;
}
@ -227,8 +227,8 @@ SVGFragmentIdentifier::ProcessFragmentIdentifier(nsIDocument *aDocument,
NS_ABORT_IF_FALSE(aDocument->GetRootElement()->IsSVG(nsGkAtoms::svg),
"expecting an SVG root element");
nsSVGSVGElement *rootElement =
static_cast<nsSVGSVGElement*>(aDocument->GetRootElement());
dom::SVGSVGElement *rootElement =
static_cast<dom::SVGSVGElement*>(aDocument->GetRootElement());
if (!rootElement->mUseCurrentView) {
SaveOldViewBox(rootElement);

View File

@ -9,11 +9,14 @@
#include "nsString.h"
class nsIDocument;
class nsSVGSVGElement;
class nsSVGViewElement;
namespace mozilla {
namespace dom {
class SVGSVGElement;
}
/**
* Implements support for parsing SVG fragment identifiers
* http://www.w3.org/TR/SVG/linking.html#SVGFragmentIdentifiers
@ -36,17 +39,17 @@ private:
* Parse an SVG ViewSpec and set applicable attributes on the root element.
* @return true if there is a valid ViewSpec
*/
static bool ProcessSVGViewSpec(const nsAString &aViewSpec, nsSVGSVGElement *root);
static bool ProcessSVGViewSpec(const nsAString &aViewSpec, dom::SVGSVGElement *root);
// Save and restore things we override in case we want to go back e.g. the
// user presses the back button
static void SaveOldPreserveAspectRatio(nsSVGSVGElement *root);
static void RestoreOldPreserveAspectRatio(nsSVGSVGElement *root);
static void SaveOldViewBox(nsSVGSVGElement *root);
static void RestoreOldViewBox(nsSVGSVGElement *root);
static void SaveOldZoomAndPan(nsSVGSVGElement *root);
static void RestoreOldZoomAndPan(nsSVGSVGElement *root);
static void ClearTransform(nsSVGSVGElement *root);
static void SaveOldPreserveAspectRatio(dom::SVGSVGElement *root);
static void RestoreOldPreserveAspectRatio(dom::SVGSVGElement *root);
static void SaveOldViewBox(dom::SVGSVGElement *root);
static void RestoreOldViewBox(dom::SVGSVGElement *root);
static void SaveOldZoomAndPan(dom::SVGSVGElement *root);
static void RestoreOldZoomAndPan(dom::SVGSVGElement *root);
static void ClearTransform(dom::SVGSVGElement *root);
};
} // namespace mozilla

View File

@ -7,7 +7,7 @@
#include "SVGLength.h"
#include "nsSVGElement.h"
#include "nsSVGSVGElement.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "nsString.h"
#include "nsTextFormatter.h"
#include "prdtoa.h"
@ -191,7 +191,7 @@ SVGLength::GetUserUnitsPerUnit(const nsSVGElement *aElement, uint8_t aAxis) cons
SVGLength::GetUserUnitsPerPercent(const nsSVGElement *aElement, uint8_t aAxis)
{
if (aElement) {
nsSVGSVGElement *viewportElement = const_cast<nsSVGElement*>(aElement)->GetCtx();
dom::SVGSVGElement *viewportElement = const_cast<nsSVGElement*>(aElement)->GetCtx();
if (viewportElement) {
return NS_MAX(viewportElement->GetLength(aAxis) / 100.0f, 0.0f);
}

View File

@ -7,9 +7,9 @@
#include "nsIFrame.h"
#include "nsISVGChildFrame.h"
#include "nsSVGRect.h"
#include "nsSVGSVGElement.h"
#include "nsSVGUtils.h"
#include "SVGContentUtils.h"
#include "mozilla/dom/SVGSVGElement.h"
namespace mozilla {
namespace dom {

View File

@ -26,7 +26,7 @@
#include "nsError.h"
#include "nsISVGChildFrame.h"
#include "nsGUIEvent.h"
#include "nsSVGSVGElement.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "nsSVGUtils.h"
#include "mozilla/dom/SVGViewElement.h"
#include "nsStyleUtil.h"
@ -39,8 +39,12 @@
#include "nsIContentIterator.h"
#include "SVGAngle.h"
using namespace mozilla;
using namespace mozilla::dom;
DOMCI_NODE_DATA(SVGSVGElement, mozilla::dom::SVGSVGElement)
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT_CHECK_PARSER(SVG)
namespace mozilla {
namespace dom {
NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(nsSVGTranslatePoint::DOMVal, mElement)
@ -49,12 +53,12 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGTranslatePoint::DOMVal)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGTranslatePoint::DOMVal)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISVGPoint)
NS_INTERFACE_MAP_ENTRY(mozilla::nsISVGPoint)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
nsresult
nsSVGTranslatePoint::ToDOMVal(nsSVGSVGElement *aElement,
nsSVGTranslatePoint::ToDOMVal(SVGSVGElement *aElement,
nsISupports **aResult)
{
NS_ADDREF(*aResult = new DOMVal(this, aElement));
@ -91,7 +95,7 @@ nsSVGTranslatePoint::DOMVal::MatrixTransform(DOMSVGMatrix& matrix)
return point.forget();
}
nsSVGElement::LengthInfo nsSVGSVGElement::sLengthInfo[4] =
nsSVGElement::LengthInfo SVGSVGElement::sLengthInfo[4] =
{
{ &nsGkAtoms::x, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X },
{ &nsGkAtoms::y, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y },
@ -99,13 +103,13 @@ nsSVGElement::LengthInfo nsSVGSVGElement::sLengthInfo[4] =
{ &nsGkAtoms::height, 100, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
};
nsSVGEnumMapping nsSVGSVGElement::sZoomAndPanMap[] = {
nsSVGEnumMapping SVGSVGElement::sZoomAndPanMap[] = {
{&nsGkAtoms::disable, nsIDOMSVGZoomAndPan::SVG_ZOOMANDPAN_DISABLE},
{&nsGkAtoms::magnify, nsIDOMSVGZoomAndPan::SVG_ZOOMANDPAN_MAGNIFY},
{nullptr, 0}
};
nsSVGElement::EnumInfo nsSVGSVGElement::sEnumInfo[1] =
nsSVGElement::EnumInfo SVGSVGElement::sEnumInfo[1] =
{
{ &nsGkAtoms::zoomAndPan,
sZoomAndPanMap,
@ -113,45 +117,41 @@ nsSVGElement::EnumInfo nsSVGSVGElement::sEnumInfo[1] =
}
};
NS_IMPL_NS_NEW_SVG_ELEMENT_CHECK_PARSER(SVG)
//----------------------------------------------------------------------
// nsISupports methods
NS_IMPL_CYCLE_COLLECTION_CLASS(nsSVGSVGElement)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsSVGSVGElement,
nsSVGSVGElementBase)
NS_IMPL_CYCLE_COLLECTION_CLASS(SVGSVGElement)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(SVGSVGElement,
SVGSVGElementBase)
if (tmp->mTimedDocumentRoot) {
tmp->mTimedDocumentRoot->Unlink();
}
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsSVGSVGElement,
nsSVGSVGElementBase)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(SVGSVGElement,
SVGSVGElementBase)
if (tmp->mTimedDocumentRoot) {
tmp->mTimedDocumentRoot->Traverse(&cb);
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_ADDREF_INHERITED(nsSVGSVGElement,nsSVGSVGElementBase)
NS_IMPL_RELEASE_INHERITED(nsSVGSVGElement,nsSVGSVGElementBase)
NS_IMPL_ADDREF_INHERITED(SVGSVGElement,SVGSVGElementBase)
NS_IMPL_RELEASE_INHERITED(SVGSVGElement,SVGSVGElementBase)
DOMCI_NODE_DATA(SVGSVGElement, nsSVGSVGElement)
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsSVGSVGElement)
NS_NODE_INTERFACE_TABLE6(nsSVGSVGElement, nsIDOMNode, nsIDOMElement,
NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(SVGSVGElement)
NS_NODE_INTERFACE_TABLE6(SVGSVGElement, nsIDOMNode, nsIDOMElement,
nsIDOMSVGElement,
nsIDOMSVGSVGElement,
nsIDOMSVGFitToViewBox,
nsIDOMSVGZoomAndPan)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGSVGElement)
NS_INTERFACE_MAP_END_INHERITING(nsSVGSVGElementBase)
NS_INTERFACE_MAP_END_INHERITING(SVGSVGElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGSVGElement::nsSVGSVGElement(already_AddRefed<nsINodeInfo> aNodeInfo,
SVGSVGElement::SVGSVGElement(already_AddRefed<nsINodeInfo> aNodeInfo,
FromParser aFromParser)
: nsSVGSVGElementBase(aNodeInfo),
: SVGSVGElementBase(aNodeInfo),
mViewportWidth(0),
mViewportHeight(0),
mCurrentTranslate(0.0f, 0.0f),
@ -171,17 +171,17 @@ nsSVGSVGElement::nsSVGSVGElement(already_AddRefed<nsINodeInfo> aNodeInfo,
//----------------------------------------------------------------------
// nsIDOMNode methods
// From NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGSVGElement)
// From NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGSVGElement)
nsresult
nsSVGSVGElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
SVGSVGElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
{
*aResult = nullptr;
nsCOMPtr<nsINodeInfo> ni = aNodeInfo;
nsSVGSVGElement *it = new nsSVGSVGElement(ni.forget(), NOT_FROM_PARSER);
SVGSVGElement *it = new SVGSVGElement(ni.forget(), NOT_FROM_PARSER);
nsCOMPtr<nsINode> kungFuDeathGrip = it;
nsresult rv1 = it->Init();
nsresult rv2 = const_cast<nsSVGSVGElement*>(this)->CopyInnerTo(it);
nsresult rv2 = const_cast<SVGSVGElement*>(this)->CopyInnerTo(it);
if (NS_SUCCEEDED(rv1) && NS_SUCCEEDED(rv2)) {
kungFuDeathGrip.swap(*aResult);
}
@ -195,35 +195,35 @@ nsSVGSVGElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
/* readonly attribute nsIDOMSVGAnimatedLength x; */
NS_IMETHODIMP
nsSVGSVGElement::GetX(nsIDOMSVGAnimatedLength * *aX)
SVGSVGElement::GetX(nsIDOMSVGAnimatedLength * *aX)
{
return mLengthAttributes[X].ToDOMAnimatedLength(aX, this);
}
/* readonly attribute nsIDOMSVGAnimatedLength y; */
NS_IMETHODIMP
nsSVGSVGElement::GetY(nsIDOMSVGAnimatedLength * *aY)
SVGSVGElement::GetY(nsIDOMSVGAnimatedLength * *aY)
{
return mLengthAttributes[Y].ToDOMAnimatedLength(aY, this);
}
/* readonly attribute nsIDOMSVGAnimatedLength width; */
NS_IMETHODIMP
nsSVGSVGElement::GetWidth(nsIDOMSVGAnimatedLength * *aWidth)
SVGSVGElement::GetWidth(nsIDOMSVGAnimatedLength * *aWidth)
{
return mLengthAttributes[WIDTH].ToDOMAnimatedLength(aWidth, this);
}
/* readonly attribute nsIDOMSVGAnimatedLength height; */
NS_IMETHODIMP
nsSVGSVGElement::GetHeight(nsIDOMSVGAnimatedLength * *aHeight)
SVGSVGElement::GetHeight(nsIDOMSVGAnimatedLength * *aHeight)
{
return mLengthAttributes[HEIGHT].ToDOMAnimatedLength(aHeight, this);
}
/* readonly attribute nsIDOMSVGRect viewport; */
NS_IMETHODIMP
nsSVGSVGElement::GetViewport(nsIDOMSVGRect * *aViewport)
SVGSVGElement::GetViewport(nsIDOMSVGRect * *aViewport)
{
// XXX
return NS_ERROR_NOT_IMPLEMENTED;
@ -231,7 +231,7 @@ nsSVGSVGElement::GetViewport(nsIDOMSVGRect * *aViewport)
/* readonly attribute float pixelUnitToMillimeterX; */
NS_IMETHODIMP
nsSVGSVGElement::GetPixelUnitToMillimeterX(float *aPixelUnitToMillimeterX)
SVGSVGElement::GetPixelUnitToMillimeterX(float *aPixelUnitToMillimeterX)
{
*aPixelUnitToMillimeterX = MM_PER_INCH_FLOAT / 96;
return NS_OK;
@ -239,14 +239,14 @@ nsSVGSVGElement::GetPixelUnitToMillimeterX(float *aPixelUnitToMillimeterX)
/* readonly attribute float pixelUnitToMillimeterY; */
NS_IMETHODIMP
nsSVGSVGElement::GetPixelUnitToMillimeterY(float *aPixelUnitToMillimeterY)
SVGSVGElement::GetPixelUnitToMillimeterY(float *aPixelUnitToMillimeterY)
{
return GetPixelUnitToMillimeterX(aPixelUnitToMillimeterY);
}
/* readonly attribute float screenPixelToMillimeterX; */
NS_IMETHODIMP
nsSVGSVGElement::GetScreenPixelToMillimeterX(float *aScreenPixelToMillimeterX)
SVGSVGElement::GetScreenPixelToMillimeterX(float *aScreenPixelToMillimeterX)
{
*aScreenPixelToMillimeterX = MM_PER_INCH_FLOAT / 96;
return NS_OK;
@ -254,14 +254,14 @@ nsSVGSVGElement::GetScreenPixelToMillimeterX(float *aScreenPixelToMillimeterX)
/* readonly attribute float screenPixelToMillimeterY; */
NS_IMETHODIMP
nsSVGSVGElement::GetScreenPixelToMillimeterY(float *aScreenPixelToMillimeterY)
SVGSVGElement::GetScreenPixelToMillimeterY(float *aScreenPixelToMillimeterY)
{
return GetScreenPixelToMillimeterX(aScreenPixelToMillimeterY);
}
/* attribute boolean useCurrentView; */
NS_IMETHODIMP
nsSVGSVGElement::GetUseCurrentView(bool *aUseCurrentView)
SVGSVGElement::GetUseCurrentView(bool *aUseCurrentView)
{
*aUseCurrentView = mUseCurrentView;
return NS_OK;
@ -269,15 +269,15 @@ nsSVGSVGElement::GetUseCurrentView(bool *aUseCurrentView)
/* readonly attribute nsIDOMSVGViewSpec currentView; */
NS_IMETHODIMP
nsSVGSVGElement::GetCurrentView(nsIDOMSVGViewSpec * *aCurrentView)
SVGSVGElement::GetCurrentView(nsIDOMSVGViewSpec * *aCurrentView)
{
NS_NOTYETIMPLEMENTED("nsSVGSVGElement::GetCurrentView");
NS_NOTYETIMPLEMENTED("SVGSVGElement::GetCurrentView");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* attribute float currentScale; */
NS_IMETHODIMP
nsSVGSVGElement::GetCurrentScale(float *aCurrentScale)
SVGSVGElement::GetCurrentScale(float *aCurrentScale)
{
*aCurrentScale = mCurrentScale;
return NS_OK;
@ -287,7 +287,7 @@ nsSVGSVGElement::GetCurrentScale(float *aCurrentScale)
#define CURRENT_SCALE_MIN 0.0625f
NS_IMETHODIMP
nsSVGSVGElement::SetCurrentScale(float aCurrentScale)
SVGSVGElement::SetCurrentScale(float aCurrentScale)
{
return SetCurrentScaleTranslate(aCurrentScale,
mCurrentTranslate.GetX(), mCurrentTranslate.GetY());
@ -295,14 +295,14 @@ nsSVGSVGElement::SetCurrentScale(float aCurrentScale)
/* readonly attribute DOMSVGPoint currentTranslate; */
NS_IMETHODIMP
nsSVGSVGElement::GetCurrentTranslate(nsISupports * *aCurrentTranslate)
SVGSVGElement::GetCurrentTranslate(nsISupports * *aCurrentTranslate)
{
return mCurrentTranslate.ToDOMVal(this, aCurrentTranslate);
}
/* unsigned long suspendRedraw (in unsigned long max_wait_milliseconds); */
NS_IMETHODIMP
nsSVGSVGElement::SuspendRedraw(uint32_t max_wait_milliseconds, uint32_t *_retval)
SVGSVGElement::SuspendRedraw(uint32_t max_wait_milliseconds, uint32_t *_retval)
{
// suspendRedraw is a no-op in Mozilla, so it doesn't matter what
// we set the ID out-param to:
@ -312,7 +312,7 @@ nsSVGSVGElement::SuspendRedraw(uint32_t max_wait_milliseconds, uint32_t *_retval
/* void unsuspendRedraw (in unsigned long suspend_handle_id); */
NS_IMETHODIMP
nsSVGSVGElement::UnsuspendRedraw(uint32_t suspend_handle_id)
SVGSVGElement::UnsuspendRedraw(uint32_t suspend_handle_id)
{
// no-op
return NS_OK;
@ -320,7 +320,7 @@ nsSVGSVGElement::UnsuspendRedraw(uint32_t suspend_handle_id)
/* void unsuspendRedrawAll (); */
NS_IMETHODIMP
nsSVGSVGElement::UnsuspendRedrawAll()
SVGSVGElement::UnsuspendRedrawAll()
{
// no-op
return NS_OK;
@ -328,7 +328,7 @@ nsSVGSVGElement::UnsuspendRedrawAll()
/* void forceRedraw (); */
NS_IMETHODIMP
nsSVGSVGElement::ForceRedraw()
SVGSVGElement::ForceRedraw()
{
nsIDocument* doc = GetCurrentDoc();
if (!doc) return NS_ERROR_FAILURE;
@ -340,7 +340,7 @@ nsSVGSVGElement::ForceRedraw()
/* void pauseAnimations (); */
NS_IMETHODIMP
nsSVGSVGElement::PauseAnimations()
SVGSVGElement::PauseAnimations()
{
if (NS_SMILEnabled()) {
if (mTimedDocumentRoot) {
@ -349,13 +349,13 @@ nsSVGSVGElement::PauseAnimations()
// else we're not the outermost <svg> or not bound to a tree, so silently fail
return NS_OK;
}
NS_NOTYETIMPLEMENTED("nsSVGSVGElement::PauseAnimations");
NS_NOTYETIMPLEMENTED("SVGSVGElement::PauseAnimations");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void unpauseAnimations (); */
NS_IMETHODIMP
nsSVGSVGElement::UnpauseAnimations()
SVGSVGElement::UnpauseAnimations()
{
if (NS_SMILEnabled()) {
if (mTimedDocumentRoot) {
@ -364,26 +364,26 @@ nsSVGSVGElement::UnpauseAnimations()
// else we're not the outermost <svg> or not bound to a tree, so silently fail
return NS_OK;
}
NS_NOTYETIMPLEMENTED("nsSVGSVGElement::UnpauseAnimations");
NS_NOTYETIMPLEMENTED("SVGSVGElement::UnpauseAnimations");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean animationsPaused (); */
NS_IMETHODIMP
nsSVGSVGElement::AnimationsPaused(bool *_retval)
SVGSVGElement::AnimationsPaused(bool *_retval)
{
if (NS_SMILEnabled()) {
nsSMILTimeContainer* root = GetTimedDocumentRoot();
*_retval = root && root->IsPausedByType(nsSMILTimeContainer::PAUSE_SCRIPT);
return NS_OK;
}
NS_NOTYETIMPLEMENTED("nsSVGSVGElement::AnimationsPaused");
NS_NOTYETIMPLEMENTED("SVGSVGElement::AnimationsPaused");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* float getCurrentTime (); */
NS_IMETHODIMP
nsSVGSVGElement::GetCurrentTime(float *_retval)
SVGSVGElement::GetCurrentTime(float *_retval)
{
if (NS_SMILEnabled()) {
nsSMILTimeContainer* root = GetTimedDocumentRoot();
@ -395,13 +395,13 @@ nsSVGSVGElement::GetCurrentTime(float *_retval)
}
return NS_OK;
}
NS_NOTYETIMPLEMENTED("nsSVGSVGElement::GetCurrentTime");
NS_NOTYETIMPLEMENTED("SVGSVGElement::GetCurrentTime");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void setCurrentTime (in float seconds); */
NS_IMETHODIMP
nsSVGSVGElement::SetCurrentTime(float seconds)
SVGSVGElement::SetCurrentTime(float seconds)
{
NS_ENSURE_FINITE(seconds, NS_ERROR_ILLEGAL_VALUE);
if (NS_SMILEnabled()) {
@ -424,77 +424,77 @@ nsSVGSVGElement::SetCurrentTime(float seconds)
// fail
return NS_OK;
}
NS_NOTYETIMPLEMENTED("nsSVGSVGElement::SetCurrentTime");
NS_NOTYETIMPLEMENTED("SVGSVGElement::SetCurrentTime");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMNodeList getIntersectionList (in nsIDOMSVGRect rect, in nsIDOMSVGElement referenceElement); */
NS_IMETHODIMP
nsSVGSVGElement::GetIntersectionList(nsIDOMSVGRect *rect,
nsIDOMSVGElement *referenceElement,
nsIDOMNodeList **_retval)
SVGSVGElement::GetIntersectionList(nsIDOMSVGRect *rect,
nsIDOMSVGElement *referenceElement,
nsIDOMNodeList **_retval)
{
// null check when implementing - this method can be used by scripts!
// if (!rect || !referenceElement)
// return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
NS_NOTYETIMPLEMENTED("nsSVGSVGElement::GetIntersectionList");
NS_NOTYETIMPLEMENTED("SVGSVGElement::GetIntersectionList");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMNodeList getEnclosureList (in nsIDOMSVGRect rect, in nsIDOMSVGElement referenceElement); */
NS_IMETHODIMP
nsSVGSVGElement::GetEnclosureList(nsIDOMSVGRect *rect,
nsIDOMSVGElement *referenceElement,
nsIDOMNodeList **_retval)
SVGSVGElement::GetEnclosureList(nsIDOMSVGRect *rect,
nsIDOMSVGElement *referenceElement,
nsIDOMNodeList **_retval)
{
// null check when implementing - this method can be used by scripts!
// if (!rect || !referenceElement)
// return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
NS_NOTYETIMPLEMENTED("nsSVGSVGElement::GetEnclosureList");
NS_NOTYETIMPLEMENTED("SVGSVGElement::GetEnclosureList");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean checkIntersection (in nsIDOMSVGElement element, in nsIDOMSVGRect rect); */
NS_IMETHODIMP
nsSVGSVGElement::CheckIntersection(nsIDOMSVGElement *element,
nsIDOMSVGRect *rect,
bool *_retval)
SVGSVGElement::CheckIntersection(nsIDOMSVGElement *element,
nsIDOMSVGRect *rect,
bool *_retval)
{
// null check when implementing - this method can be used by scripts!
// if (!element || !rect)
// return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
NS_NOTYETIMPLEMENTED("nsSVGSVGElement::CheckIntersection");
NS_NOTYETIMPLEMENTED("SVGSVGElement::CheckIntersection");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* boolean checkEnclosure (in nsIDOMSVGElement element, in nsIDOMSVGRect rect); */
NS_IMETHODIMP
nsSVGSVGElement::CheckEnclosure(nsIDOMSVGElement *element,
nsIDOMSVGRect *rect,
bool *_retval)
SVGSVGElement::CheckEnclosure(nsIDOMSVGElement *element,
nsIDOMSVGRect *rect,
bool *_retval)
{
// null check when implementing - this method can be used by scripts!
// if (!element || !rect)
// return NS_ERROR_DOM_SVG_WRONG_TYPE_ERR;
NS_NOTYETIMPLEMENTED("nsSVGSVGElement::CheckEnclosure");
NS_NOTYETIMPLEMENTED("SVGSVGElement::CheckEnclosure");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* void deSelectAll (); */
NS_IMETHODIMP
nsSVGSVGElement::DeSelectAll()
SVGSVGElement::DeSelectAll()
{
NS_NOTYETIMPLEMENTED("nsSVGSVGElement::DeSelectAll");
NS_NOTYETIMPLEMENTED("SVGSVGElement::DeSelectAll");
return NS_ERROR_NOT_IMPLEMENTED;
}
/* nsIDOMSVGNumber createSVGNumber (); */
NS_IMETHODIMP
nsSVGSVGElement::CreateSVGNumber(nsIDOMSVGNumber **_retval)
SVGSVGElement::CreateSVGNumber(nsIDOMSVGNumber **_retval)
{
NS_ADDREF(*_retval = new DOMSVGNumber());
return NS_OK;
@ -502,7 +502,7 @@ nsSVGSVGElement::CreateSVGNumber(nsIDOMSVGNumber **_retval)
/* nsIDOMSVGLength createSVGLength (); */
NS_IMETHODIMP
nsSVGSVGElement::CreateSVGLength(nsIDOMSVGLength **_retval)
SVGSVGElement::CreateSVGLength(nsIDOMSVGLength **_retval)
{
NS_ADDREF(*_retval = new DOMSVGLength());
return NS_OK;
@ -510,7 +510,7 @@ nsSVGSVGElement::CreateSVGLength(nsIDOMSVGLength **_retval)
/* SVGAngle createSVGAngle (); */
NS_IMETHODIMP
nsSVGSVGElement::CreateSVGAngle(nsISupports **_retval)
SVGSVGElement::CreateSVGAngle(nsISupports **_retval)
{
nsSVGAngle* angle = new nsSVGAngle();
angle->Init();
@ -520,7 +520,7 @@ nsSVGSVGElement::CreateSVGAngle(nsISupports **_retval)
/* DOMSVGPoint createSVGPoint (); */
NS_IMETHODIMP
nsSVGSVGElement::CreateSVGPoint(nsISupports **_retval)
SVGSVGElement::CreateSVGPoint(nsISupports **_retval)
{
NS_ADDREF(*_retval = new DOMSVGPoint(0, 0));
return NS_OK;
@ -528,7 +528,7 @@ nsSVGSVGElement::CreateSVGPoint(nsISupports **_retval)
/* DOMSVGMatrix createSVGMatrix (); */
NS_IMETHODIMP
nsSVGSVGElement::CreateSVGMatrix(nsISupports **_retval)
SVGSVGElement::CreateSVGMatrix(nsISupports **_retval)
{
NS_ADDREF(*_retval = new DOMSVGMatrix());
return NS_OK;
@ -536,14 +536,14 @@ nsSVGSVGElement::CreateSVGMatrix(nsISupports **_retval)
/* nsIDOMSVGRect createSVGRect (); */
NS_IMETHODIMP
nsSVGSVGElement::CreateSVGRect(nsIDOMSVGRect **_retval)
SVGSVGElement::CreateSVGRect(nsIDOMSVGRect **_retval)
{
return NS_NewSVGRect(_retval);
}
/* DOMSVGTransform createSVGTransform (); */
NS_IMETHODIMP
nsSVGSVGElement::CreateSVGTransform(nsISupports **_retval)
SVGSVGElement::CreateSVGTransform(nsISupports **_retval)
{
NS_ADDREF(*_retval = new DOMSVGTransform());
return NS_OK;
@ -551,8 +551,8 @@ nsSVGSVGElement::CreateSVGTransform(nsISupports **_retval)
/* DOMSVGTransform createSVGTransformFromMatrix (in DOMSVGMatrix matrix); */
NS_IMETHODIMP
nsSVGSVGElement::CreateSVGTransformFromMatrix(nsISupports *matrix,
nsISupports **_retval)
SVGSVGElement::CreateSVGTransformFromMatrix(nsISupports *matrix,
nsISupports **_retval)
{
nsCOMPtr<DOMSVGMatrix> domItem = do_QueryInterface(matrix);
if (!domItem) {
@ -565,7 +565,7 @@ nsSVGSVGElement::CreateSVGTransformFromMatrix(nsISupports *matrix,
/* nsIDOMElement getElementById (in DOMString elementId); */
NS_IMETHODIMP
nsSVGSVGElement::GetElementById(const nsAString & elementId, nsIDOMElement **_retval)
SVGSVGElement::GetElementById(const nsAString & elementId, nsIDOMElement **_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
*_retval = nullptr;
@ -585,15 +585,15 @@ nsSVGSVGElement::GetElementById(const nsAString & elementId, nsIDOMElement **_re
/* readonly attribute nsIDOMSVGAnimatedRect viewBox; */
NS_IMETHODIMP
nsSVGSVGElement::GetViewBox(nsIDOMSVGAnimatedRect * *aViewBox)
SVGSVGElement::GetViewBox(nsIDOMSVGAnimatedRect * *aViewBox)
{
return mViewBox.ToDOMAnimatedRect(aViewBox, this);
}
/* readonly attribute SVGPreserveAspectRatio preserveAspectRatio; */
NS_IMETHODIMP
nsSVGSVGElement::GetPreserveAspectRatio(nsISupports
**aPreserveAspectRatio)
SVGSVGElement::GetPreserveAspectRatio(nsISupports
**aPreserveAspectRatio)
{
nsRefPtr<DOMSVGAnimatedPreserveAspectRatio> ratio;
mPreserveAspectRatio.ToDOMAnimatedPreserveAspectRatio(getter_AddRefs(ratio), this);
@ -606,7 +606,7 @@ nsSVGSVGElement::GetPreserveAspectRatio(nsISupports
/* attribute unsigned short zoomAndPan; */
NS_IMETHODIMP
nsSVGSVGElement::GetZoomAndPan(uint16_t *aZoomAndPan)
SVGSVGElement::GetZoomAndPan(uint16_t *aZoomAndPan)
{
SVGViewElement* viewElement = GetCurrentViewElement();
if (viewElement && viewElement->mEnumAttributes[
@ -620,7 +620,7 @@ nsSVGSVGElement::GetZoomAndPan(uint16_t *aZoomAndPan)
}
NS_IMETHODIMP
nsSVGSVGElement::SetZoomAndPan(uint16_t aZoomAndPan)
SVGSVGElement::SetZoomAndPan(uint16_t aZoomAndPan)
{
if (aZoomAndPan == nsIDOMSVGZoomAndPan::SVG_ZOOMANDPAN_DISABLE ||
aZoomAndPan == nsIDOMSVGZoomAndPan::SVG_ZOOMANDPAN_MAGNIFY) {
@ -635,7 +635,7 @@ nsSVGSVGElement::SetZoomAndPan(uint16_t aZoomAndPan)
// helper methods for implementing SVGZoomEvent:
NS_IMETHODIMP
nsSVGSVGElement::SetCurrentScaleTranslate(float s, float x, float y)
SVGSVGElement::SetCurrentScaleTranslate(float s, float x, float y)
{
NS_ENSURE_FINITE3(s, x, y, NS_ERROR_ILLEGAL_VALUE);
@ -681,20 +681,20 @@ nsSVGSVGElement::SetCurrentScaleTranslate(float s, float x, float y)
}
NS_IMETHODIMP
nsSVGSVGElement::SetCurrentTranslate(float x, float y)
SVGSVGElement::SetCurrentTranslate(float x, float y)
{
return SetCurrentScaleTranslate(mCurrentScale, x, y);
}
nsSMILTimeContainer*
nsSVGSVGElement::GetTimedDocumentRoot()
SVGSVGElement::GetTimedDocumentRoot()
{
if (mTimedDocumentRoot) {
return mTimedDocumentRoot;
}
// We must not be the outermost <svg> element, try to find it
nsSVGSVGElement *outerSVGElement =
SVGSVGElement *outerSVGElement =
SVGContentUtils::GetOuterSVGElement(this);
if (outerSVGElement) {
@ -708,7 +708,7 @@ nsSVGSVGElement::GetTimedDocumentRoot()
// nsIContent methods
NS_IMETHODIMP_(bool)
nsSVGSVGElement::IsAttributeMapped(const nsIAtom* name) const
SVGSVGElement::IsAttributeMapped(const nsIAtom* name) const
{
// We want to map the 'width' and 'height' attributes into style for
// outer-<svg>, except when the attributes aren't set (since their default
@ -739,14 +739,14 @@ nsSVGSVGElement::IsAttributeMapped(const nsIAtom* name) const
};
return FindAttributeDependence(name, map) ||
nsSVGSVGElementBase::IsAttributeMapped(name);
SVGSVGElementBase::IsAttributeMapped(name);
}
//----------------------------------------------------------------------
// nsIContent methods:
nsresult
nsSVGSVGElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
SVGSVGElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
{
if (aVisitor.mEvent->message == NS_SVG_LOAD) {
if (mTimedDocumentRoot) {
@ -757,11 +757,11 @@ nsSVGSVGElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
AnimationNeedsResample();
}
}
return nsSVGSVGElementBase::PreHandleEvent(aVisitor);
return SVGSVGElementBase::PreHandleEvent(aVisitor);
}
bool
nsSVGSVGElement::IsEventAttributeName(nsIAtom* aName)
SVGSVGElement::IsEventAttributeName(nsIAtom* aName)
{
/* The events in EventNameType_SVGSVG are for events that are only
applicable to outermost 'svg' elements. We don't check if we're an outer
@ -786,24 +786,24 @@ nsSVGSVGElement::IsEventAttributeName(nsIAtom* aName)
inline float
ComputeSynthesizedViewBoxDimension(const nsSVGLength2& aLength,
float aViewportLength,
const nsSVGSVGElement* aSelf)
const SVGSVGElement* aSelf)
{
if (aLength.IsPercentage()) {
return aViewportLength * aLength.GetAnimValInSpecifiedUnits() / 100.0f;
}
return aLength.GetAnimValue(const_cast<nsSVGSVGElement*>(aSelf));
return aLength.GetAnimValue(const_cast<SVGSVGElement*>(aSelf));
}
//----------------------------------------------------------------------
// public helpers:
gfxMatrix
nsSVGSVGElement::GetViewBoxTransform() const
SVGSVGElement::GetViewBoxTransform() const
{
float viewportWidth, viewportHeight;
if (IsInner()) {
nsSVGSVGElement *ctx = GetCtx();
SVGSVGElement *ctx = GetCtx();
viewportWidth = mLengthAttributes[WIDTH].GetAnimValue(ctx);
viewportHeight = mLengthAttributes[HEIGHT].GetAnimValue(ctx);
} else {
@ -830,7 +830,7 @@ nsSVGSVGElement::GetViewBoxTransform() const
}
void
nsSVGSVGElement::UpdateHasChildrenOnlyTransform()
SVGSVGElement::UpdateHasChildrenOnlyTransform()
{
bool hasChildrenOnlyTransform =
HasViewBoxOrSyntheticViewBox() ||
@ -840,7 +840,7 @@ nsSVGSVGElement::UpdateHasChildrenOnlyTransform()
}
void
nsSVGSVGElement::ChildrenOnlyTransformChanged(uint32_t aFlags)
SVGSVGElement::ChildrenOnlyTransformChanged(uint32_t aFlags)
{
// Avoid wasteful calls:
NS_ABORT_IF_FALSE(!(GetPrimaryFrame()->GetStateBits() &
@ -876,10 +876,10 @@ nsSVGSVGElement::ChildrenOnlyTransformChanged(uint32_t aFlags)
}
nsresult
nsSVGSVGElement::BindToTree(nsIDocument* aDocument,
nsIContent* aParent,
nsIContent* aBindingParent,
bool aCompileEventHandlers)
SVGSVGElement::BindToTree(nsIDocument* aDocument,
nsIContent* aParent,
nsIContent* aBindingParent,
bool aCompileEventHandlers)
{
nsSMILAnimationController* smilController = nullptr;
@ -903,9 +903,9 @@ nsSVGSVGElement::BindToTree(nsIDocument* aDocument,
}
}
nsresult rv = nsSVGSVGElementBase::BindToTree(aDocument, aParent,
aBindingParent,
aCompileEventHandlers);
nsresult rv = SVGSVGElementBase::BindToTree(aDocument, aParent,
aBindingParent,
aCompileEventHandlers);
NS_ENSURE_SUCCESS(rv,rv);
if (mTimedDocumentRoot && smilController) {
@ -920,21 +920,21 @@ nsSVGSVGElement::BindToTree(nsIDocument* aDocument,
}
void
nsSVGSVGElement::UnbindFromTree(bool aDeep, bool aNullParent)
SVGSVGElement::UnbindFromTree(bool aDeep, bool aNullParent)
{
if (mTimedDocumentRoot) {
mTimedDocumentRoot->SetParent(nullptr);
}
nsSVGSVGElementBase::UnbindFromTree(aDeep, aNullParent);
SVGSVGElementBase::UnbindFromTree(aDeep, aNullParent);
}
//----------------------------------------------------------------------
// implementation helpers
bool
nsSVGSVGElement::WillBeOutermostSVG(nsIContent* aParent,
nsIContent* aBindingParent) const
SVGSVGElement::WillBeOutermostSVG(nsIContent* aParent,
nsIContent* aBindingParent) const
{
nsIContent* parent = aBindingParent ? aBindingParent : aParent;
@ -954,7 +954,7 @@ nsSVGSVGElement::WillBeOutermostSVG(nsIContent* aParent,
}
void
nsSVGSVGElement::InvalidateTransformNotifyFrame()
SVGSVGElement::InvalidateTransformNotifyFrame()
{
nsIFrame* frame = GetPrimaryFrame();
if (frame) {
@ -968,14 +968,14 @@ nsSVGSVGElement::InvalidateTransformNotifyFrame()
}
bool
nsSVGSVGElement::HasPreserveAspectRatio()
SVGSVGElement::HasPreserveAspectRatio()
{
return HasAttr(kNameSpaceID_None, nsGkAtoms::preserveAspectRatio) ||
mPreserveAspectRatio.IsAnimated();
}
SVGViewElement*
nsSVGSVGElement::GetCurrentViewElement() const
SVGSVGElement::GetCurrentViewElement() const
{
if (mCurrentViewID) {
nsIDocument* doc = GetCurrentDoc();
@ -990,7 +990,7 @@ nsSVGSVGElement::GetCurrentViewElement() const
}
nsSVGViewBoxRect
nsSVGSVGElement::GetViewBoxWithSynthesis(
SVGSVGElement::GetViewBoxWithSynthesis(
float aViewportWidth, float aViewportHeight) const
{
// The logic here should match HasViewBox().
@ -1019,7 +1019,7 @@ nsSVGSVGElement::GetViewBoxWithSynthesis(
}
SVGPreserveAspectRatio
nsSVGSVGElement::GetPreserveAspectRatioWithOverride() const
SVGSVGElement::GetPreserveAspectRatioWithOverride() const
{
nsIDocument* doc = GetCurrentDoc();
if (doc && doc->IsBeingUsedAsImage()) {
@ -1048,10 +1048,10 @@ nsSVGSVGElement::GetPreserveAspectRatioWithOverride() const
}
//----------------------------------------------------------------------
// nsSVGSVGElement
// SVGSVGElement
float
nsSVGSVGElement::GetLength(uint8_t aCtxType)
SVGSVGElement::GetLength(uint8_t aCtxType)
{
float h, w;
@ -1069,7 +1069,7 @@ nsSVGSVGElement::GetLength(uint8_t aCtxType)
w = viewbox->width;
h = viewbox->height;
} else if (IsInner()) {
nsSVGSVGElement *ctx = GetCtx();
SVGSVGElement *ctx = GetCtx();
w = mLengthAttributes[WIDTH].GetAnimValue(ctx);
h = mLengthAttributes[HEIGHT].GetAnimValue(ctx);
} else if (ShouldSynthesizeViewBox()) {
@ -1100,15 +1100,15 @@ nsSVGSVGElement::GetLength(uint8_t aCtxType)
// nsSVGElement methods
/* virtual */ gfxMatrix
nsSVGSVGElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich) const
SVGSVGElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich) const
{
NS_ABORT_IF_FALSE(aWhich != eChildToUserSpace || aMatrix.IsIdentity(),
"Skipping eUserSpaceToParent transforms makes no sense");
if (IsInner()) {
float x, y;
const_cast<nsSVGSVGElement*>(this)->GetAnimatedLengthValues(&x, &y, nullptr);
const_cast<SVGSVGElement*>(this)->GetAnimatedLengthValues(&x, &y, nullptr);
if (aWhich == eAllTransforms) {
// the common case
return GetViewBoxTransform() * gfxMatrix().Translate(gfxPoint(x, y)) * aMatrix;
@ -1139,7 +1139,7 @@ nsSVGSVGElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
}
/* virtual */ bool
nsSVGSVGElement::HasValidDimensions() const
SVGSVGElement::HasValidDimensions() const
{
return !IsInner() ||
((!mLengthAttributes[WIDTH].IsExplicitlySet() ||
@ -1149,33 +1149,33 @@ nsSVGSVGElement::HasValidDimensions() const
}
nsSVGElement::LengthAttributesInfo
nsSVGSVGElement::GetLengthInfo()
SVGSVGElement::GetLengthInfo()
{
return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
ArrayLength(sLengthInfo));
}
nsSVGElement::EnumAttributesInfo
nsSVGSVGElement::GetEnumInfo()
SVGSVGElement::GetEnumInfo()
{
return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
ArrayLength(sEnumInfo));
}
nsSVGViewBox *
nsSVGSVGElement::GetViewBox()
SVGSVGElement::GetViewBox()
{
return &mViewBox;
}
SVGAnimatedPreserveAspectRatio *
nsSVGSVGElement::GetPreserveAspectRatio()
SVGSVGElement::GetPreserveAspectRatio()
{
return &mPreserveAspectRatio;
}
bool
nsSVGSVGElement::HasViewBox() const
SVGSVGElement::HasViewBox() const
{
SVGViewElement* viewElement = GetCurrentViewElement();
if (viewElement && viewElement->mViewBox.IsExplicitlySet()) {
@ -1185,7 +1185,7 @@ nsSVGSVGElement::HasViewBox() const
}
bool
nsSVGSVGElement::ShouldSynthesizeViewBox() const
SVGSVGElement::ShouldSynthesizeViewBox() const
{
NS_ABORT_IF_FALSE(!HasViewBox(),
"Should only be called if we lack a viewBox");
@ -1211,8 +1211,7 @@ ReleasePreserveAspectRatioPropertyValue(void* aObject, /* unused */
}
bool
nsSVGSVGElement::
SetPreserveAspectRatioProperty(const SVGPreserveAspectRatio& aPAR)
SVGSVGElement::SetPreserveAspectRatioProperty(const SVGPreserveAspectRatio& aPAR)
{
SVGPreserveAspectRatio* pAROverridePtr = new SVGPreserveAspectRatio(aPAR);
nsresult rv = SetProperty(nsGkAtoms::overridePreserveAspectRatio,
@ -1231,7 +1230,7 @@ nsSVGSVGElement::
}
const SVGPreserveAspectRatio*
nsSVGSVGElement::GetPreserveAspectRatioProperty() const
SVGSVGElement::GetPreserveAspectRatioProperty() const
{
void* valPtr = GetProperty(nsGkAtoms::overridePreserveAspectRatio);
if (valPtr) {
@ -1241,7 +1240,7 @@ nsSVGSVGElement::GetPreserveAspectRatioProperty() const
}
bool
nsSVGSVGElement::ClearPreserveAspectRatioProperty()
SVGSVGElement::ClearPreserveAspectRatioProperty()
{
void* valPtr = UnsetProperty(nsGkAtoms::overridePreserveAspectRatio);
delete static_cast<SVGPreserveAspectRatio*>(valPtr);
@ -1249,7 +1248,7 @@ nsSVGSVGElement::ClearPreserveAspectRatioProperty()
}
void
nsSVGSVGElement::
SVGSVGElement::
SetImageOverridePreserveAspectRatio(const SVGPreserveAspectRatio& aPAR)
{
#ifdef DEBUG
@ -1280,7 +1279,7 @@ nsSVGSVGElement::
}
void
nsSVGSVGElement::ClearImageOverridePreserveAspectRatio()
SVGSVGElement::ClearImageOverridePreserveAspectRatio()
{
#ifdef DEBUG
NS_ABORT_IF_FALSE(GetCurrentDoc()->IsBeingUsedAsImage(),
@ -1301,7 +1300,7 @@ nsSVGSVGElement::ClearImageOverridePreserveAspectRatio()
}
void
nsSVGSVGElement::FlushImageTransformInvalidation()
SVGSVGElement::FlushImageTransformInvalidation()
{
NS_ABORT_IF_FALSE(!GetParent(), "Should only be called on root node");
NS_ABORT_IF_FALSE(GetCurrentDoc()->IsBeingUsedAsImage(),
@ -1326,7 +1325,7 @@ ReleaseViewBoxPropertyValue(void* aObject, /* unused */
}
bool
nsSVGSVGElement::SetViewBoxProperty(const nsSVGViewBoxRect& aViewBox)
SVGSVGElement::SetViewBoxProperty(const nsSVGViewBoxRect& aViewBox)
{
nsSVGViewBoxRect* pViewBoxOverridePtr = new nsSVGViewBoxRect(aViewBox);
nsresult rv = SetProperty(nsGkAtoms::viewBox,
@ -1345,7 +1344,7 @@ nsSVGSVGElement::SetViewBoxProperty(const nsSVGViewBoxRect& aViewBox)
}
const nsSVGViewBoxRect*
nsSVGSVGElement::GetViewBoxProperty() const
SVGSVGElement::GetViewBoxProperty() const
{
void* valPtr = GetProperty(nsGkAtoms::viewBox);
if (valPtr) {
@ -1355,7 +1354,7 @@ nsSVGSVGElement::GetViewBoxProperty() const
}
bool
nsSVGSVGElement::ClearViewBoxProperty()
SVGSVGElement::ClearViewBoxProperty()
{
void* valPtr = UnsetProperty(nsGkAtoms::viewBox);
delete static_cast<nsSVGViewBoxRect*>(valPtr);
@ -1363,7 +1362,7 @@ nsSVGSVGElement::ClearViewBoxProperty()
}
bool
nsSVGSVGElement::SetZoomAndPanProperty(uint16_t aValue)
SVGSVGElement::SetZoomAndPanProperty(uint16_t aValue)
{
nsresult rv = SetProperty(nsGkAtoms::zoomAndPan,
reinterpret_cast<void*>(aValue),
@ -1375,7 +1374,7 @@ nsSVGSVGElement::SetZoomAndPanProperty(uint16_t aValue)
}
uint16_t
nsSVGSVGElement::GetZoomAndPanProperty() const
SVGSVGElement::GetZoomAndPanProperty() const
{
void* valPtr = GetProperty(nsGkAtoms::zoomAndPan);
if (valPtr) {
@ -1385,8 +1384,10 @@ nsSVGSVGElement::GetZoomAndPanProperty() const
}
bool
nsSVGSVGElement::ClearZoomAndPanProperty()
SVGSVGElement::ClearZoomAndPanProperty()
{
return UnsetProperty(nsGkAtoms::zoomAndPan);
}
} // namespace dom
} // namespace mozilla

View File

@ -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_SVGSVGELEMENT_H__
#define __NS_SVGSVGELEMENT_H__
#ifndef mozilla_dom_SVGSVGElement_h
#define mozilla_dom_SVGSVGElement_h
#include "mozilla/dom/FromParser.h"
#include "nsIDOMSVGFitToViewBox.h"
@ -20,19 +20,23 @@
#include "SVGAnimatedPreserveAspectRatio.h"
#include "mozilla/Attributes.h"
nsresult NS_NewSVGSVGElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo,
mozilla::dom::FromParser aFromParser);
class nsSMILTimeContainer;
class nsSVGOuterSVGFrame;
class nsSVGInnerSVGFrame;
class nsSVGImageFrame;
namespace mozilla {
class DOMSVGMatrix;
class SVGFragmentIdentifier;
class DOMSVGMatrix;
class SVGFragmentIdentifier;
namespace dom {
class SVGViewElement;
}
}
namespace dom {
class SVGViewElement;
typedef mozilla::dom::SVGGraphicsElement nsSVGSVGElementBase;
class nsSVGSVGElement;
class SVGSVGElement;
class nsSVGTranslatePoint {
public:
@ -55,7 +59,7 @@ public:
float GetY() const
{ return mY; }
nsresult ToDOMVal(nsSVGSVGElement *aElement, nsISupports **aResult);
nsresult ToDOMVal(SVGSVGElement *aElement, nsISupports **aResult);
bool operator!=(const nsSVGTranslatePoint &rhs) const {
return mX != rhs.mX || mY != rhs.mY;
@ -63,9 +67,9 @@ public:
private:
struct DOMVal MOZ_FINAL : public mozilla::nsISVGPoint {
DOMVal(nsSVGTranslatePoint* aVal, nsSVGSVGElement *aElement)
: mozilla::nsISVGPoint(), mVal(aVal), mElement(aElement) {}
struct DOMVal MOZ_FINAL : public nsISVGPoint {
DOMVal(nsSVGTranslatePoint* aVal, SVGSVGElement *aElement)
: nsISVGPoint(), mVal(aVal), mElement(aElement) {}
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMVal)
@ -73,14 +77,14 @@ private:
// WebIDL
virtual float X() { return mVal->GetX(); }
virtual float Y() { return mVal->GetY(); }
virtual void SetX(float aValue, mozilla::ErrorResult& rv);
virtual void SetY(float aValue, mozilla::ErrorResult& rv);
virtual already_AddRefed<mozilla::nsISVGPoint> MatrixTransform(mozilla::DOMSVGMatrix& matrix);
virtual void SetX(float aValue, ErrorResult& rv);
virtual void SetY(float aValue, ErrorResult& rv);
virtual already_AddRefed<nsISVGPoint> MatrixTransform(DOMSVGMatrix& matrix);
virtual nsISupports* GetParentObject() MOZ_OVERRIDE;
nsSVGTranslatePoint *mVal; // kept alive because it belongs to mElement
nsRefPtr<nsSVGSVGElement> mElement;
nsRefPtr<SVGSVGElement> mElement;
};
float mX;
@ -100,37 +104,37 @@ public:
float height;
};
class nsSVGSVGElement : public nsSVGSVGElementBase,
public nsIDOMSVGSVGElement,
public nsIDOMSVGFitToViewBox,
public nsIDOMSVGZoomAndPan
typedef SVGGraphicsElement SVGSVGElementBase;
class SVGSVGElement MOZ_FINAL : public SVGSVGElementBase,
public nsIDOMSVGSVGElement,
public nsIDOMSVGFitToViewBox,
public nsIDOMSVGZoomAndPan
{
friend class nsSVGOuterSVGFrame;
friend class nsSVGInnerSVGFrame;
friend class nsSVGImageFrame;
friend class ::nsSVGOuterSVGFrame;
friend class ::nsSVGInnerSVGFrame;
friend class ::nsSVGImageFrame;
friend class mozilla::SVGFragmentIdentifier;
friend nsresult NS_NewSVGSVGElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo,
mozilla::dom::FromParser aFromParser);
nsSVGSVGElement(already_AddRefed<nsINodeInfo> aNodeInfo,
mozilla::dom::FromParser aFromParser);
public:
typedef mozilla::SVGAnimatedPreserveAspectRatio SVGAnimatedPreserveAspectRatio;
typedef mozilla::SVGPreserveAspectRatio SVGPreserveAspectRatio;
SVGSVGElement(already_AddRefed<nsINodeInfo> aNodeInfo,
FromParser aFromParser);
friend nsresult (::NS_NewSVGSVGElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo,
mozilla::dom::FromParser aFromParser));
public:
// interfaces:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsSVGSVGElement, nsSVGSVGElementBase)
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SVGSVGElement, SVGSVGElementBase)
NS_DECL_NSIDOMSVGSVGELEMENT
NS_DECL_NSIDOMSVGFITTOVIEWBOX
NS_DECL_NSIDOMSVGZOOMANDPAN
// xxx I wish we could use virtual inheritance
NS_FORWARD_NSIDOMNODE_TO_NSINODE
NS_FORWARD_NSIDOMELEMENT_TO_GENERIC
NS_FORWARD_NSIDOMSVGELEMENT(nsSVGSVGElementBase::)
NS_FORWARD_NSIDOMSVGELEMENT(SVGSVGElementBase::)
/**
* For use by zoom controls to allow currentScale, currentTranslate.x and
@ -171,8 +175,8 @@ public:
virtual gfxMatrix PrependLocalTransformsTo(const gfxMatrix &aMatrix,
TransformTypes aWhich = eAllTransforms) const;
virtual bool HasValidDimensions() const;
// nsSVGSVGElement methods:
// SVGSVGElement methods:
float GetLength(uint8_t mCtxType);
// public helpers:
@ -264,7 +268,7 @@ private:
// implementation helpers:
mozilla::dom::SVGViewElement* GetCurrentViewElement() const;
SVGViewElement* GetCurrentViewElement() const;
// Methods for <image> elements to override my "PreserveAspectRatio" value.
// These are private so that only our friends (nsSVGImageFrame in
@ -388,4 +392,7 @@ private:
bool mUseCurrentView;
};
#endif
} // namespace dom
} // namespace mozilla
#endif // SVGSVGElement_h

View File

@ -17,7 +17,6 @@
typedef nsSVGElement SVGViewElementBase;
class nsSVGSVGElement;
class nsSVGOuterSVGFrame;
nsresult NS_NewSVGViewElement(nsIContent **aResult,
@ -27,6 +26,7 @@ namespace mozilla {
class SVGFragmentIdentifier;
namespace dom {
class SVGSVGElement;
class SVGViewElement : public SVGViewElementBase,
public nsIDOMSVGViewElement,
@ -35,7 +35,7 @@ class SVGViewElement : public SVGViewElementBase,
{
protected:
friend class mozilla::SVGFragmentIdentifier;
friend class ::nsSVGSVGElement;
friend class SVGSVGElement;
friend class ::nsSVGOuterSVGFrame;
SVGViewElement(already_AddRefed<nsINodeInfo> aNodeInfo);
friend nsresult (::NS_NewSVGViewElement(nsIContent **aResult,

View File

@ -6,7 +6,7 @@
#include "nsDOMSVGZoomEvent.h"
#include "nsSVGRect.h"
#include "DOMSVGPoint.h"
#include "nsSVGSVGElement.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "nsIPresShell.h"
#include "nsIDocument.h"
#include "mozilla/dom/Element.h"
@ -48,20 +48,20 @@ nsDOMSVGZoomEvent::nsDOMSVGZoomEvent(nsPresContext* aPresContext,
// non-SVGDocument), then the "New" and "Previous"
// properties will be left null which is probably what we want.
if (rootElement->IsSVG(nsGkAtoms::svg)) {
nsSVGSVGElement *SVGSVGElement =
static_cast<nsSVGSVGElement*>(rootElement);
SVGSVGElement *SVGSVGElem =
static_cast<SVGSVGElement*>(rootElement);
mNewScale = SVGSVGElement->GetCurrentScale();
mPreviousScale = SVGSVGElement->GetPreviousScale();
mNewScale = SVGSVGElem->GetCurrentScale();
mPreviousScale = SVGSVGElem->GetPreviousScale();
const nsSVGTranslatePoint& translate =
SVGSVGElement->GetCurrentTranslate();
SVGSVGElem->GetCurrentTranslate();
mNewTranslate =
new DOMSVGPoint(translate.GetX(), translate.GetY());
mNewTranslate->SetReadonly(true);
const nsSVGTranslatePoint& prevTranslate =
SVGSVGElement->GetPreviousTranslate();
SVGSVGElem->GetPreviousTranslate();
mPreviousTranslate =
new DOMSVGPoint(prevTranslate.GetX(), prevTranslate.GetY());
mPreviousTranslate->SetReadonly(true);

View File

@ -8,7 +8,7 @@
#include "nsSVGElement.h"
#include "nsSVGSVGElement.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "nsIDocument.h"
#include "nsRange.h"
#include "nsIDOMAttr.h"
@ -1156,10 +1156,10 @@ nsSVGElement::GetOwnerSVGElement(nsIDOMSVGSVGElement * *aOwnerSVGElement)
return rv.ErrorCode();
}
nsSVGSVGElement*
SVGSVGElement*
nsSVGElement::GetOwnerSVGElement(ErrorResult& rv)
{
nsSVGSVGElement* ownerSVGElement = GetCtx();
SVGSVGElement* ownerSVGElement = GetCtx();
// If we didn't find anything and we're not the outermost SVG element,
// we've got an invalid structure
@ -1330,7 +1330,7 @@ nsSVGElement::UpdateContentStyleRule()
// Special case: we don't want <svg> 'width'/'height' mapped into style
// if the attribute value isn't a valid <length> according to SVG (which
// only supports a subset of the CSS <length> values). We don't enforce
// this by checking the attribute value in nsSVGSVGElement::
// this by checking the attribute value in SVGSVGElement::
// IsAttributeMapped since we don't want that method to depend on the
// value of the attribute that is being checked. Rather we just prevent
// the actual mapping here, as necessary.
@ -1588,7 +1588,7 @@ nsIAtom* nsSVGElement::GetEventNameForAttr(nsIAtom* aAttr)
return aAttr;
}
nsSVGSVGElement *
SVGSVGElement *
nsSVGElement::GetCtx() const
{
nsIContent* ancestor = GetFlattenedTreeParent();
@ -1599,7 +1599,7 @@ nsSVGElement::GetCtx() const
return nullptr;
}
if (tag == nsGkAtoms::svg) {
return static_cast<nsSVGSVGElement*>(ancestor);
return static_cast<SVGSVGElement*>(ancestor);
}
ancestor = ancestor->GetFlattenedTreeParent();
}
@ -1702,7 +1702,7 @@ nsSVGElement::GetAnimatedLengthValues(float *aFirst, ...)
NS_ASSERTION(info.mLengthCount > 0,
"GetAnimatedLengthValues on element with no length attribs");
nsSVGSVGElement *ctx = nullptr;
SVGSVGElement *ctx = nullptr;
float *f = aFirst;
uint32_t i = 0;

View File

@ -33,12 +33,12 @@ class nsSVGLength2;
class nsSVGNumber2;
class nsSVGNumberPair;
class nsSVGString;
class nsSVGSVGElement;
class nsSVGViewBox;
namespace mozilla {
namespace dom {
class CSSValue;
class SVGSVGElement;
}
class SVGAnimatedNumberList;
@ -129,7 +129,7 @@ public:
// Gets the element that establishes the rectangular viewport against which
// we should resolve percentage lengths (our "coordinate context"). Returns
// nullptr for outer <svg> or SVG without an <svg> parent (invalid SVG).
nsSVGSVGElement* GetCtx() const;
mozilla::dom::SVGSVGElement* GetCtx() const;
enum TransformTypes {
eAllTransforms
@ -299,7 +299,7 @@ public:
}
// WebIDL
nsSVGSVGElement* GetOwnerSVGElement(mozilla::ErrorResult& rv);
mozilla::dom::SVGSVGElement* GetOwnerSVGElement(mozilla::ErrorResult& rv);
nsSVGElement* GetViewportElement();
already_AddRefed<nsIDOMSVGAnimatedString> ClassName();
nsICSSDeclaration* GetStyle(mozilla::ErrorResult& rv);
@ -659,26 +659,6 @@ NS_NewSVG##_elementName##Element(nsIContent **aResult, \
return rv; \
}
#define NS_IMPL_NS_NEW_SVG_ELEMENT_CHECK_PARSER(_elementName) \
nsresult \
NS_NewSVG##_elementName##Element(nsIContent **aResult, \
already_AddRefed<nsINodeInfo> aNodeInfo, \
FromParser aFromParser) \
{ \
nsRefPtr<nsSVG##_elementName##Element> it = \
new nsSVG##_elementName##Element(aNodeInfo, aFromParser); \
\
nsresult rv = it->Init(); \
\
if (NS_FAILED(rv)) { \
return rv; \
} \
\
it.forget(aResult); \
\
return rv; \
}
#define NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT_CHECK_PARSER(_elementName) \
nsresult \
NS_NewSVG##_elementName##Element(nsIContent **aResult, \

View File

@ -8,7 +8,7 @@
#include "nsSVGLength2.h"
#include "prdtoa.h"
#include "nsTextFormatter.h"
#include "nsSVGSVGElement.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "nsIFrame.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGAttrTearoffTable.h"
@ -18,6 +18,7 @@
#include "nsAttrValueInlines.h"
using namespace mozilla;
using namespace mozilla::dom;
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGLength2::DOMBaseVal, mSVGElement)
@ -169,7 +170,7 @@ FixAxisLength(float aLength)
}
float
nsSVGLength2::GetAxisLength(nsSVGSVGElement *aCtx) const
nsSVGLength2::GetAxisLength(SVGSVGElement *aCtx) const
{
if (!aCtx)
return 1;
@ -219,7 +220,7 @@ nsSVGLength2::GetUnitScaleFactor(nsSVGElement *aSVGElement,
}
float
nsSVGLength2::GetUnitScaleFactor(nsSVGSVGElement *aCtx, uint8_t aUnitType) const
nsSVGLength2::GetUnitScaleFactor(SVGSVGElement *aCtx, uint8_t aUnitType) const
{
switch (aUnitType) {
case nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER:

View File

@ -20,7 +20,12 @@
class nsIFrame;
class nsISMILAnimationElement;
class nsSMILValue;
class nsSVGSVGElement;
namespace mozilla {
namespace dom {
class SVGSVGElement;
}
}
class nsSVGLength2
{
@ -67,9 +72,9 @@ public:
float GetAnimValInSpecifiedUnits() const { return mAnimVal; }
float GetBaseValInSpecifiedUnits() const { return mBaseVal; }
float GetBaseValue(nsSVGSVGElement* aCtx) const
float GetBaseValue(mozilla::dom::SVGSVGElement* aCtx) const
{ return mBaseVal / GetUnitScaleFactor(aCtx, mSpecifiedUnitType); }
float GetAnimValue(nsSVGSVGElement* aCtx) const
float GetAnimValue(mozilla::dom::SVGSVGElement* aCtx) const
{ return mAnimVal / GetUnitScaleFactor(aCtx, mSpecifiedUnitType); }
bool HasBaseVal() const {
@ -110,14 +115,14 @@ private:
{ return SVGContentUtils::GetFontXHeight(aFrame); }
float GetUnitScaleFactor(nsIFrame *aFrame, uint8_t aUnitType) const;
float GetMMPerPixel(nsSVGSVGElement *aCtx) const;
float GetAxisLength(nsSVGSVGElement *aCtx) const;
float GetMMPerPixel(mozilla::dom::SVGSVGElement *aCtx) const;
float GetAxisLength(mozilla::dom::SVGSVGElement *aCtx) const;
static float GetEmLength(nsSVGElement *aSVGElement)
{ return SVGContentUtils::GetFontSize(aSVGElement); }
static float GetExLength(nsSVGElement *aSVGElement)
{ return SVGContentUtils::GetFontXHeight(aSVGElement); }
float GetUnitScaleFactor(nsSVGElement *aSVGElement, uint8_t aUnitType) const;
float GetUnitScaleFactor(nsSVGSVGElement *aCtx, uint8_t aUnitType) const;
float GetUnitScaleFactor(mozilla::dom::SVGSVGElement *aCtx, uint8_t aUnitType) const;
// SetBaseValue and SetAnimValue set the value in user units
void SetBaseValue(float aValue, nsSVGElement *aSVGElement, bool aDoSetAttr);

View File

@ -272,8 +272,8 @@ nsSVGMarkerElement::UnsetAttr(int32_t aNamespaceID, nsIAtom* aName,
//----------------------------------------------------------------------
// nsSVGElement methods
void
nsSVGMarkerElement::SetParentCoordCtxProvider(nsSVGSVGElement *aContext)
void
nsSVGMarkerElement::SetParentCoordCtxProvider(SVGSVGElement *aContext)
{
mCoordCtx = aContext;
mViewBoxToViewportTransform = nullptr;

View File

@ -125,7 +125,7 @@ protected:
const nsAString& aValue,
nsAttrValue& aResult);
void SetParentCoordCtxProvider(nsSVGSVGElement *aContext);
void SetParentCoordCtxProvider(mozilla::dom::SVGSVGElement *aContext);
virtual LengthAttributesInfo GetLengthInfo();
virtual AngleAttributesInfo GetAngleInfo();
@ -152,7 +152,7 @@ protected:
// derived properties (from 'orient') handled separately
nsSVGOrientType mOrientType;
nsSVGSVGElement *mCoordCtx;
mozilla::dom::SVGSVGElement *mCoordCtx;
nsAutoPtr<gfxMatrix> mViewBoxToViewportTransform;
};

View File

@ -8,7 +8,7 @@
#include "nsSVGUseElement.h"
#include "nsIDOMSVGGElement.h"
#include "nsGkAtoms.h"
#include "nsSVGSVGElement.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "nsIDOMSVGSymbolElement.h"
#include "nsIDocument.h"
#include "nsIPresShell.h"

View File

@ -18,7 +18,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=506856
basis will be '0' (based off of the viewport width, which is 0 in this
case since we're in a display:none iframe. We use viewport width because
the lack of a viewbox forces us into the not-mViewBox::IsValid() case of
nsSVGSVGElement::GetLength).
SVGSVGElement::GetLength).
And we don't want a percent-length basis of 0, because then when we call
convertToSpecifiedUnits to convert out of percent units, we divide by 0

View File

@ -1197,7 +1197,7 @@ addExternalIface('SVGAnimatedNumber')
addExternalIface('SVGAnimatedString')
addExternalIface('SVGLength')
addExternalIface('SVGNumber')
addExternalIface('SVGSVGElement', nativeType='nsSVGSVGElement')
addExternalIface('SVGSVGElement', nativeType='mozilla::dom::SVGSVGElement')
addExternalIface('TextMetrics', headerFile='nsIDOMCanvasRenderingContext2D.h')
addExternalIface('TreeWalker')
addExternalIface('Touch', headerFile='nsIDOMTouchEvent.h')

View File

@ -47,7 +47,7 @@ LOCAL_INCLUDES += -I$(topsrcdir)/image/decoders
# For URI-related functionality
LOCAL_INCLUDES += -I$(topsrcdir)/netwerk/base/src
# Because SVGDocumentWrapper.cpp includes "nsSVGSVGElement.h"
# Because SVGDocumentWrapper.cpp includes "mozilla/dom/SVGSVGElement.h"
LOCAL_INCLUDES += \
-I$(topsrcdir)/content/svg/content/src \
-I$(topsrcdir)/content/base/src \

View File

@ -27,7 +27,7 @@
#include "nsServiceManagerUtils.h"
#include "nsSize.h"
#include "gfxRect.h"
#include "nsSVGSVGElement.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "nsSVGLength2.h"
#include "nsSVGEffects.h"
@ -71,7 +71,7 @@ bool
SVGDocumentWrapper::GetWidthOrHeight(Dimension aDimension,
int32_t& aResult)
{
nsSVGSVGElement* rootElem = GetRootSVGElem();
SVGSVGElement* rootElem = GetRootSVGElem();
NS_ABORT_IF_FALSE(rootElem, "root elem missing or of wrong type");
nsresult rv;
@ -140,7 +140,7 @@ SVGDocumentWrapper::FlushImageTransformInvalidation()
{
NS_ABORT_IF_FALSE(!mIgnoreInvalidation, "shouldn't be reentrant");
nsSVGSVGElement* svgElem = GetRootSVGElem();
SVGSVGElement* svgElem = GetRootSVGElem();
if (!svgElem)
return;
@ -197,7 +197,7 @@ SVGDocumentWrapper::StopAnimation()
void
SVGDocumentWrapper::ResetAnimation()
{
nsSVGSVGElement* svgElem = GetRootSVGElem();
SVGSVGElement* svgElem = GetRootSVGElem();
if (!svgElem)
return;
@ -287,7 +287,7 @@ SVGDocumentWrapper::Observe(nsISupports* aSubject,
{
if (!strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID)) {
// Sever ties from rendering observers to helper-doc's root SVG node
nsSVGSVGElement* svgElem = GetRootSVGElem();
SVGSVGElement* svgElem = GetRootSVGElem();
if (svgElem) {
nsSVGEffects::RemoveAllRenderingObservers(svgElem);
}
@ -423,7 +423,7 @@ SVGDocumentWrapper::FlushLayout()
}
}
nsSVGSVGElement*
SVGSVGElement*
SVGDocumentWrapper::GetRootSVGElem()
{
if (!mViewer)
@ -438,7 +438,7 @@ SVGDocumentWrapper::GetRootSVGElem()
return nullptr;
}
return static_cast<nsSVGSVGElement*>(rootElem);
return static_cast<SVGSVGElement*>(rootElem);
}
} // namespace image

View File

@ -23,12 +23,15 @@ class nsIRequest;
class nsILoadGroup;
class nsIFrame;
struct nsIntSize;
class nsSVGSVGElement;
#define OBSERVER_SVC_CID "@mozilla.org/observer-service;1"
namespace mozilla {
namespace dom {
class SVGSVGElement;
}
namespace image {
class SVGDocumentWrapper MOZ_FINAL : public nsIStreamListener,
@ -68,7 +71,7 @@ public:
* Returns the root <svg> element for the wrapped document, or nullptr on
* failure.
*/
nsSVGSVGElement* GetRootSVGElem();
mozilla::dom::SVGSVGElement* GetRootSVGElem();
/**
* Returns the root nsIFrame* for the wrapped document, or nullptr on failure.

View File

@ -21,7 +21,7 @@
#include "nsSVGEffects.h" // for nsSVGRenderingObserver
#include "gfxDrawable.h"
#include "gfxUtils.h"
#include "nsSVGSVGElement.h"
#include "mozilla/dom/SVGSVGElement.h"
namespace mozilla {

View File

@ -5,7 +5,7 @@
>
<script type="application/javascript">
function go() {
// Try calling the animation-related methods in nsSVGSVGElement.cpp
// Try calling the animation-related methods in SVGSVGElement.cpp
// If any aren't implemented, we'll throw an exception and
// the rect will stay red.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -7,11 +7,13 @@
#include "nsFrame.h"
#include "nsGkAtoms.h"
#include "nsSVGOuterSVGFrame.h"
#include "nsSVGSVGElement.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "mozilla/dom/SVGViewElement.h"
typedef nsFrame SVGViewFrameBase;
using namespace mozilla::dom;
/**
* While views are not directly rendered in SVG they can be linked to
* and thereby override attributes of an <svg> element via a fragment
@ -110,8 +112,8 @@ SVGViewFrame::AttributeChanged(int32_t aNameSpaceID,
NS_ASSERTION(outerSVGFrame->GetContent()->IsSVG(nsGkAtoms::svg),
"Expecting an <svg> element");
nsSVGSVGElement* svgElement =
static_cast<nsSVGSVGElement*>(outerSVGFrame->GetContent());
SVGSVGElement* svgElement =
static_cast<SVGSVGElement*>(outerSVGFrame->GetContent());
nsAutoString viewID;
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::id, viewID);

View File

@ -479,7 +479,7 @@ nsSVGLinearGradientFrame::GetLengthValue(uint32_t aIndex)
gradientUnits == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX,
"Unknown gradientUnits type");
return length.GetAnimValue(static_cast<nsSVGSVGElement*>(nullptr));
return length.GetAnimValue(static_cast<SVGSVGElement*>(nullptr));
}
nsSVGLinearGradientElement *
@ -610,7 +610,7 @@ nsSVGRadialGradientFrame::GetLengthValueFromElement(uint32_t aIndex,
gradientUnits == nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX,
"Unknown gradientUnits type");
return length.GetAnimValue(static_cast<nsSVGSVGElement*>(nullptr));
return length.GetAnimValue(static_cast<SVGSVGElement*>(nullptr));
}
nsSVGRadialGradientElement *

View File

@ -14,7 +14,7 @@
#include "imgINotificationObserver.h"
#include "nsSVGEffects.h"
#include "nsSVGPathGeometryFrame.h"
#include "nsSVGSVGElement.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "nsSVGUtils.h"
#include "SVGContentUtils.h"
#include "mozilla/dom/SVGImageElement.h"
@ -358,8 +358,8 @@ nsSVGImageFrame::PaintSVG(nsRenderingContext *aContext,
}
// Grab root node (w/ sanity-check to make sure it exists & is <svg>)
nsSVGSVGElement* rootSVGElem =
static_cast<nsSVGSVGElement*>(imgRootFrame->GetContent());
SVGSVGElement* rootSVGElem =
static_cast<SVGSVGElement*>(imgRootFrame->GetContent());
if (!rootSVGElem || !rootSVGElem->IsSVG(nsGkAtoms::svg)) {
NS_ABORT_IF_FALSE(false, "missing or non-<svg> root node!!");
return NS_OK;

View File

@ -13,7 +13,10 @@
#include "nsRenderingContext.h"
#include "nsSVGContainerFrame.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGSVGElement.h"
#include "mozilla/dom/SVGSVGElement.h"
using namespace mozilla;
using namespace mozilla::dom;
nsIFrame*
NS_NewSVGInnerSVGFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
@ -66,7 +69,7 @@ nsSVGInnerSVGFrame::PaintSVG(nsRenderingContext *aContext,
if (GetStyleDisplay()->IsScrollableOverflow()) {
float x, y, width, height;
static_cast<nsSVGSVGElement*>(mContent)->
static_cast<SVGSVGElement*>(mContent)->
GetAnimatedLengthValues(&x, &y, &width, &height, nullptr);
if (width <= 0 || height <= 0) {
@ -92,7 +95,7 @@ nsSVGInnerSVGFrame::ReflowSVG()
// mRect must be set before FinishAndStoreOverflow is called in order
// for our overflow areas to be clipped correctly.
float x, y, width, height;
static_cast<nsSVGSVGElement*>(mContent)->
static_cast<SVGSVGElement*>(mContent)->
GetAnimatedLengthValues(&x, &y, &width, &height, nullptr);
mRect = nsLayoutUtils::RoundGfxRectToAppRect(
gfxRect(x, y, width, height),
@ -108,14 +111,14 @@ nsSVGInnerSVGFrame::NotifySVGChanged(uint32_t aFlags)
if (aFlags & COORD_CONTEXT_CHANGED) {
nsSVGSVGElement *svg = static_cast<nsSVGSVGElement*>(mContent);
SVGSVGElement *svg = static_cast<SVGSVGElement*>(mContent);
bool xOrYIsPercentage =
svg->mLengthAttributes[nsSVGSVGElement::X].IsPercentage() ||
svg->mLengthAttributes[nsSVGSVGElement::Y].IsPercentage();
svg->mLengthAttributes[SVGSVGElement::X].IsPercentage() ||
svg->mLengthAttributes[SVGSVGElement::Y].IsPercentage();
bool widthOrHeightIsPercentage =
svg->mLengthAttributes[nsSVGSVGElement::WIDTH].IsPercentage() ||
svg->mLengthAttributes[nsSVGSVGElement::HEIGHT].IsPercentage();
svg->mLengthAttributes[SVGSVGElement::WIDTH].IsPercentage() ||
svg->mLengthAttributes[SVGSVGElement::HEIGHT].IsPercentage();
if (xOrYIsPercentage || widthOrHeightIsPercentage) {
// Ancestor changes can't affect how we render from the perspective of
@ -165,7 +168,7 @@ nsSVGInnerSVGFrame::AttributeChanged(int32_t aNameSpaceID,
if (aNameSpaceID == kNameSpaceID_None &&
!(GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD)) {
nsSVGSVGElement* content = static_cast<nsSVGSVGElement*>(mContent);
SVGSVGElement* content = static_cast<SVGSVGElement*>(mContent);
if (aAttribute == nsGkAtoms::width ||
aAttribute == nsGkAtoms::height) {
@ -268,7 +271,7 @@ nsSVGInnerSVGFrame::GetCanvasTM(uint32_t aFor)
NS_ASSERTION(mParent, "null parent");
nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(mParent);
nsSVGSVGElement *content = static_cast<nsSVGSVGElement*>(mContent);
SVGSVGElement *content = static_cast<SVGSVGElement*>(mContent);
gfxMatrix tm = content->PrependLocalTransformsTo(parent->GetCanvasTM(aFor));
@ -280,7 +283,7 @@ nsSVGInnerSVGFrame::GetCanvasTM(uint32_t aFor)
bool
nsSVGInnerSVGFrame::HasChildrenOnlyTransform(gfxMatrix *aTransform) const
{
nsSVGSVGElement *content = static_cast<nsSVGSVGElement*>(mContent);
SVGSVGElement *content = static_cast<SVGSVGElement*>(mContent);
if (content->HasViewBoxOrSyntheticViewBox()) {
// XXX Maybe return false if the transform is the identity transform?

View File

@ -14,6 +14,8 @@
#include "nsSVGPathGeometryElement.h"
#include "nsSVGPathGeometryFrame.h"
using namespace mozilla::dom;
nsIFrame*
NS_NewSVGMarkerFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
@ -200,7 +202,7 @@ nsSVGMarkerFrame::GetMarkBBoxContribution(const gfxMatrix &aToBBoxUserspace,
}
void
nsSVGMarkerFrame::SetParentCoordCtxProvider(nsSVGSVGElement *aContext)
nsSVGMarkerFrame::SetParentCoordCtxProvider(SVGSVGElement *aContext)
{
nsSVGMarkerElement *marker = static_cast<nsSVGMarkerElement*>(mContent);
marker->SetParentCoordCtxProvider(aContext);
@ -217,7 +219,7 @@ nsSVGMarkerFrame::AutoMarkerReferencer::AutoMarkerReferencer(
mFrame->mInUse = true;
mFrame->mMarkedFrame = aMarkedFrame;
nsSVGSVGElement *ctx =
SVGSVGElement *ctx =
static_cast<nsSVGElement*>(aMarkedFrame->GetContent())->GetCtx();
mFrame->SetParentCoordCtxProvider(ctx);
}

View File

@ -21,7 +21,12 @@ class nsIPresShell;
class nsRenderingContext;
class nsStyleContext;
class nsSVGPathGeometryFrame;
class nsSVGSVGElement;
namespace mozilla {
namespace dom {
class SVGSVGElement;
}
}
struct nsSVGMark;
@ -110,7 +115,7 @@ private:
};
// nsSVGMarkerFrame methods:
void SetParentCoordCtxProvider(nsSVGSVGElement *aContext);
void SetParentCoordCtxProvider(mozilla::dom::SVGSVGElement *aContext);
// recursion prevention flag
bool mInUse;

View File

@ -18,12 +18,12 @@
#include "nsStubMutationObserver.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGForeignObjectFrame.h"
#include "nsSVGSVGElement.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "nsSVGTextFrame.h"
#include "mozilla/dom/SVGViewElement.h"
#include "nsSubDocumentFrame.h"
namespace dom = mozilla::dom;
using namespace mozilla::dom;
class nsSVGMutationObserver : public nsStubMutationObserver
{
@ -54,7 +54,7 @@ static nsSVGMutationObserver sSVGMutationObserver;
void
nsSVGMutationObserver::AttributeChanged(nsIDocument* aDocument,
dom::Element* aElement,
Element* aElement,
int32_t aNameSpaceID,
nsIAtom* aAttribute,
int32_t aModType)
@ -164,7 +164,7 @@ nsSVGOuterSVGFrame::Init(nsIContent* aContent,
// prevent them from painting by [ab]use NS_STATE_SVG_NONDISPLAY_CHILD. The
// frame will be recreated via an nsChangeHint_ReconstructFrame restyle if
// the value returned by PassesConditionalProcessingTests changes.
nsSVGSVGElement *svg = static_cast<nsSVGSVGElement*>(aContent);
SVGSVGElement *svg = static_cast<SVGSVGElement*>(aContent);
if (!svg->PassesConditionalProcessingTests()) {
AddStateBits(NS_STATE_SVG_NONDISPLAY_CHILD);
}
@ -215,8 +215,8 @@ nsSVGOuterSVGFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
nscoord result;
DISPLAY_PREF_WIDTH(this, result);
nsSVGSVGElement *svg = static_cast<nsSVGSVGElement*>(mContent);
nsSVGLength2 &width = svg->mLengthAttributes[nsSVGSVGElement::WIDTH];
SVGSVGElement *svg = static_cast<SVGSVGElement*>(mContent);
nsSVGLength2 &width = svg->mLengthAttributes[SVGSVGElement::WIDTH];
if (width.IsPercentage()) {
// It looks like our containing block's width may depend on our width. In
@ -241,9 +241,9 @@ nsSVGOuterSVGFrame::GetIntrinsicSize()
IntrinsicSize intrinsicSize;
nsSVGSVGElement *content = static_cast<nsSVGSVGElement*>(mContent);
nsSVGLength2 &width = content->mLengthAttributes[nsSVGSVGElement::WIDTH];
nsSVGLength2 &height = content->mLengthAttributes[nsSVGSVGElement::HEIGHT];
SVGSVGElement *content = static_cast<SVGSVGElement*>(mContent);
nsSVGLength2 &width = content->mLengthAttributes[SVGSVGElement::WIDTH];
nsSVGLength2 &height = content->mLengthAttributes[SVGSVGElement::HEIGHT];
if (!width.IsPercentage()) {
nscoord val = nsPresContext::CSSPixelsToAppUnits(width.GetAnimValue(content));
@ -267,9 +267,9 @@ nsSVGOuterSVGFrame::GetIntrinsicRatio()
// are both specified and set to non-percentage values, or we have a viewBox
// rect: http://www.w3.org/TR/SVGMobile12/coords.html#IntrinsicSizing
nsSVGSVGElement *content = static_cast<nsSVGSVGElement*>(mContent);
nsSVGLength2 &width = content->mLengthAttributes[nsSVGSVGElement::WIDTH];
nsSVGLength2 &height = content->mLengthAttributes[nsSVGSVGElement::HEIGHT];
SVGSVGElement *content = static_cast<SVGSVGElement*>(mContent);
nsSVGLength2 &width = content->mLengthAttributes[SVGSVGElement::WIDTH];
nsSVGLength2 &height = content->mLengthAttributes[SVGSVGElement::HEIGHT];
if (!width.IsPercentage() && !height.IsPercentage()) {
nsSize ratio(NSToCoordRoundWithClamp(width.GetAnimValue(content)),
@ -283,7 +283,7 @@ nsSVGOuterSVGFrame::GetIntrinsicRatio()
return ratio;
}
dom::SVGViewElement* viewElement = content->GetCurrentViewElement();
SVGViewElement* viewElement = content->GetCurrentViewElement();
const nsSVGViewBoxRect* viewbox = nullptr;
// The logic here should match HasViewBox().
@ -344,10 +344,10 @@ nsSVGOuterSVGFrame::ComputeSize(nsRenderingContext *aRenderingContext,
// intrinsic size. Also note that explicit percentage values are mapped
// into style, so the following isn't for them.)
nsSVGSVGElement* content = static_cast<nsSVGSVGElement*>(mContent);
SVGSVGElement* content = static_cast<SVGSVGElement*>(mContent);
nsSVGLength2 &width =
content->mLengthAttributes[nsSVGSVGElement::WIDTH];
content->mLengthAttributes[SVGSVGElement::WIDTH];
if (width.IsPercentage()) {
NS_ABORT_IF_FALSE(intrinsicSize.width.GetUnit() == eStyleUnit_None,
"GetIntrinsicSize should have reported no "
@ -358,7 +358,7 @@ nsSVGOuterSVGFrame::ComputeSize(nsRenderingContext *aRenderingContext,
}
nsSVGLength2 &height =
content->mLengthAttributes[nsSVGSVGElement::HEIGHT];
content->mLengthAttributes[SVGSVGElement::HEIGHT];
NS_ASSERTION(aCBSize.height != NS_AUTOHEIGHT,
"root should not have auto-height containing block");
if (height.IsPercentage()) {
@ -404,7 +404,7 @@ nsSVGOuterSVGFrame::Reflow(nsPresContext* aPresContext,
NS_ASSERTION(!GetPrevInFlow(), "SVG can't currently be broken across pages.");
nsSVGSVGElement *svgElem = static_cast<nsSVGSVGElement*>(mContent);
SVGSVGElement *svgElem = static_cast<SVGSVGElement*>(mContent);
nsSVGOuterSVGAnonChildFrame *anonKid =
static_cast<nsSVGOuterSVGAnonChildFrame*>(GetFirstPrincipalChild());
@ -429,7 +429,7 @@ nsSVGOuterSVGFrame::Reflow(nsPresContext* aPresContext,
// The overflow rects of our child frames will be empty if we had a
// [synthetic] viewBox during our last reflow, since under
// FinishAndStoreOverflow() the nsDisplayTransform::TransformRect call
// will have ended up calling nsSVGSVGElement::GetViewBoxTransform()
// will have ended up calling SVGSVGElement::GetViewBoxTransform()
// which will have returned the identity matrix due to our viewport
// having been zero-sized. Mark all our child frames as dirty so that we
// reflow them below and update their overflow rects:
@ -655,7 +655,7 @@ nsSVGOuterSVGFrame::AttributeChanged(int32_t aNameSpaceID,
aAttribute == nsGkAtoms::viewBox ?
TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED : TRANSFORM_CHANGED);
static_cast<nsSVGSVGElement*>(mContent)->ChildrenOnlyTransformChanged();
static_cast<SVGSVGElement*>(mContent)->ChildrenOnlyTransformChanged();
} else if (aAttribute == nsGkAtoms::width ||
aAttribute == nsGkAtoms::height) {
@ -757,7 +757,7 @@ nsSVGOuterSVGFrame::NotifyViewportOrTransformChanged(uint32_t aFlags)
return;
}
nsSVGSVGElement *content = static_cast<nsSVGSVGElement*>(mContent);
SVGSVGElement *content = static_cast<SVGSVGElement*>(mContent);
if (aFlags & COORD_CONTEXT_CHANGED) {
if (content->HasViewBox()) {
@ -795,7 +795,7 @@ nsSVGOuterSVGFrame::NotifyViewportOrTransformChanged(uint32_t aFlags)
if (haveNonFulLZoomTransformChange &&
!(mState & NS_STATE_SVG_NONDISPLAY_CHILD)) {
uint32_t flags = (mState & NS_FRAME_IN_REFLOW) ?
nsSVGSVGElement::eDuringReflow : 0;
SVGSVGElement::eDuringReflow : 0;
content->ChildrenOnlyTransformChanged(flags);
}
}
@ -847,7 +847,7 @@ nsSVGOuterSVGFrame::GetCanvasTM(uint32_t aFor)
}
}
if (!mCanvasTM) {
nsSVGSVGElement *content = static_cast<nsSVGSVGElement*>(mContent);
SVGSVGElement *content = static_cast<SVGSVGElement*>(mContent);
float devPxPerCSSPx =
1.0f / PresContext()->AppUnitsToFloatCSSPixels(
@ -909,8 +909,8 @@ nsSVGOuterSVGFrame::IsRootOfImage()
bool
nsSVGOuterSVGFrame::VerticalScrollbarNotNeeded() const
{
nsSVGLength2 &height = static_cast<nsSVGSVGElement*>(mContent)->
mLengthAttributes[nsSVGSVGElement::HEIGHT];
nsSVGLength2 &height = static_cast<SVGSVGElement*>(mContent)->
mLengthAttributes[SVGSVGElement::HEIGHT];
return height.IsPercentage() && height.GetBaseValInSpecifiedUnits() <= 100;
}
@ -951,7 +951,7 @@ nsSVGOuterSVGAnonChildFrame::HasChildrenOnlyTransform(gfxMatrix *aTransform) con
// We must claim our nsSVGOuterSVGFrame's children-only transforms as our own
// so that the children we are used to wrap are transformed properly.
nsSVGSVGElement *content = static_cast<nsSVGSVGElement*>(mContent);
SVGSVGElement *content = static_cast<SVGSVGElement*>(mContent);
bool hasTransform = content->HasChildrenOnlyTransform();

View File

@ -24,6 +24,7 @@
#include "SVGContentUtils.h"
using namespace mozilla;
using namespace mozilla::dom;
//----------------------------------------------------------------------
// Helper classes
@ -617,7 +618,7 @@ nsSVGPatternFrame::ConstructCTM(const nsSVGViewBox& aViewBox,
nsIFrame *aTarget)
{
gfxMatrix tCTM;
nsSVGSVGElement *ctx = nullptr;
SVGSVGElement *ctx = nullptr;
nsIContent* targetContent = aTarget->GetContent();
// The objectBoundingBox conversion must be handled in the CTM:

View File

@ -48,7 +48,7 @@
#include "nsSVGPathGeometryElement.h"
#include "nsSVGPathGeometryFrame.h"
#include "nsSVGPaintServerFrame.h"
#include "nsSVGSVGElement.h"
#include "mozilla/dom/SVGSVGElement.h"
#include "nsSVGTextContainerFrame.h"
#include "nsTextFrame.h"
#include "SVGContentUtils.h"
@ -329,7 +329,7 @@ nsSVGUtils::CoordToFloat(nsPresContext *aPresContext,
return nsPresContext::AppUnitsToFloatCSSPixels(aCoord.GetCoordValue());
case eStyleUnit_Percent: {
nsSVGSVGElement* ctx = aContent->GetCtx();
SVGSVGElement* ctx = aContent->GetCtx();
return ctx ? aCoord.GetPercentValue() * ctx->GetLength(SVGContentUtils::XY) : 0.0f;
}
default:
@ -452,7 +452,7 @@ nsSVGUtils::InvalidateBounds(nsIFrame *aFrame, bool aDuringUpdate,
aFrame->GetStyleDisplay()->IsScrollableOverflow()) {
// Clip rect to the viewport established by this inner-<svg>:
float x, y, width, height;
static_cast<nsSVGSVGElement*>(aFrame->GetContent())->
static_cast<SVGSVGElement*>(aFrame->GetContent())->
GetAnimatedLengthValues(&x, &y, &width, &height, nullptr);
if (width <= 0.0f || height <= 0.0f) {
return; // Nothing to invalidate
@ -616,7 +616,7 @@ nsSVGUtils::ObjectSpace(const gfxRect &aRect, const nsSVGLength2 *aLength)
// Multiply first to avoid precision errors:
return axis * aLength->GetAnimValInSpecifiedUnits() / 100;
}
return aLength->GetAnimValue(static_cast<nsSVGSVGElement*>(nullptr)) * axis;
return aLength->GetAnimValue(static_cast<SVGSVGElement*>(nullptr)) * axis;
}
float