From 4494fc67d808d61bdbd1a32a58f3ec9471b4841f Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Sun, 6 Jan 2013 01:25:55 -0500 Subject: [PATCH] Bug 825147: Convert SVGForeignObjectElement to WebIDL r=bz --HG-- rename : content/svg/content/src/nsSVGForeignObjectElement.cpp => content/svg/content/src/SVGForeignObjectElement.cpp --- content/svg/content/src/Makefile.in | 3 +- .../content/src/SVGForeignObjectElement.cpp | 195 ++++++++++++++++++ .../svg/content/src/SVGForeignObjectElement.h | 76 +++++++ .../content/src/nsSVGForeignObjectElement.cpp | 144 ------------- .../content/src/nsSVGForeignObjectElement.h | 58 ------ dom/webidl/SVGForeignObjectElement.webidl | 25 +++ dom/webidl/WebIDL.mk | 1 + layout/svg/nsSVGForeignObjectFrame.cpp | 27 +-- 8 files changed, 313 insertions(+), 216 deletions(-) create mode 100644 content/svg/content/src/SVGForeignObjectElement.cpp create mode 100644 content/svg/content/src/SVGForeignObjectElement.h delete mode 100644 content/svg/content/src/nsSVGForeignObjectElement.cpp delete mode 100644 content/svg/content/src/nsSVGForeignObjectElement.h create mode 100644 dom/webidl/SVGForeignObjectElement.webidl diff --git a/content/svg/content/src/Makefile.in b/content/svg/content/src/Makefile.in index cc1615dd97fe..11b194f50c36 100644 --- a/content/svg/content/src/Makefile.in +++ b/content/svg/content/src/Makefile.in @@ -51,7 +51,6 @@ CPPSRCS = \ nsSVGFeatures.cpp \ nsSVGFilterElement.cpp \ nsSVGFilters.cpp \ - nsSVGForeignObjectElement.cpp \ nsSVGGElement.cpp \ nsSVGGradientElement.cpp \ nsSVGImageElement.cpp \ @@ -116,6 +115,7 @@ CPPSRCS = \ SVGContentUtils.cpp \ SVGDefsElement.cpp \ SVGDescElement.cpp \ + SVGForeignObjectElement.cpp \ SVGIntegerPairSMILType.cpp \ SVGLengthListSMILType.cpp \ SVGLocatableElement.cpp \ @@ -158,6 +158,7 @@ EXPORTS_mozilla/dom = \ SVGAnimatedBoolean.h \ SVGDefsElement.h \ SVGDescElement.h \ + SVGForeignObjectElement.h \ SVGGraphicsElement.h \ SVGLocatableElement.h \ SVGMetadataElement.h \ diff --git a/content/svg/content/src/SVGForeignObjectElement.cpp b/content/svg/content/src/SVGForeignObjectElement.cpp new file mode 100644 index 000000000000..5c674b292620 --- /dev/null +++ b/content/svg/content/src/SVGForeignObjectElement.cpp @@ -0,0 +1,195 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "mozilla/Util.h" + +#include "nsCOMPtr.h" +#include "mozilla/dom/SVGForeignObjectElement.h" +#include "mozilla/dom/SVGForeignObjectElementBinding.h" + +DOMCI_NODE_DATA(SVGForeignObjectElement, mozilla::dom::SVGForeignObjectElement) + +NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(ForeignObject) + +namespace mozilla { +namespace dom { + +JSObject* +SVGForeignObjectElement::WrapNode(JSContext *aCx, JSObject *aScope, bool *aTriedToWrap) +{ + return SVGForeignObjectElementBinding::Wrap(aCx, aScope, this, aTriedToWrap); +} + +nsSVGElement::LengthInfo SVGForeignObjectElement::sLengthInfo[4] = +{ + { &nsGkAtoms::x, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X }, + { &nsGkAtoms::y, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y }, + { &nsGkAtoms::width, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X }, + { &nsGkAtoms::height, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y }, +}; + +//---------------------------------------------------------------------- +// nsISupports methods + +NS_IMPL_ADDREF_INHERITED(SVGForeignObjectElement, SVGGraphicsElement) +NS_IMPL_RELEASE_INHERITED(SVGForeignObjectElement, SVGGraphicsElement) + +NS_INTERFACE_TABLE_HEAD(SVGForeignObjectElement) + NS_NODE_INTERFACE_TABLE4(SVGForeignObjectElement, nsIDOMNode, nsIDOMElement, + nsIDOMSVGElement, + nsIDOMSVGForeignObjectElement) + NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGForeignObjectElement) +NS_INTERFACE_MAP_END_INHERITING(SVGGraphicsElement) + +//---------------------------------------------------------------------- +// Implementation + +SVGForeignObjectElement::SVGForeignObjectElement(already_AddRefed aNodeInfo) + : SVGGraphicsElement(aNodeInfo) +{ + SetIsDOMBinding(); +} + +//---------------------------------------------------------------------- +// nsIDOMNode methods + +NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGForeignObjectElement) + +//---------------------------------------------------------------------- +// nsIDOMSVGForeignObjectElement methods: + +/* readonly attribute nsIDOMSVGAnimatedLength x; */ +NS_IMETHODIMP SVGForeignObjectElement::GetX(nsIDOMSVGAnimatedLength * *aX) +{ + *aX = X().get(); + return NS_OK; +} + +already_AddRefed +SVGForeignObjectElement::X() +{ + nsCOMPtr x; + mLengthAttributes[ATTR_X].ToDOMAnimatedLength(getter_AddRefs(x), this); + return x.forget(); +} + +/* readonly attribute nsIDOMSVGAnimatedLength y; */ +NS_IMETHODIMP SVGForeignObjectElement::GetY(nsIDOMSVGAnimatedLength * *aY) +{ + *aY = Y().get(); + return NS_OK; +} + +already_AddRefed +SVGForeignObjectElement::Y() +{ + nsCOMPtr y; + mLengthAttributes[ATTR_Y].ToDOMAnimatedLength(getter_AddRefs(y), this); + return y.forget(); +} + + +/* readonly attribute nsIDOMSVGAnimatedLength width; */ +NS_IMETHODIMP SVGForeignObjectElement::GetWidth(nsIDOMSVGAnimatedLength * *aWidth) +{ + *aWidth = Width().get(); + return NS_OK; +} + +already_AddRefed +SVGForeignObjectElement::Width() +{ + nsCOMPtr width; + mLengthAttributes[ATTR_WIDTH].ToDOMAnimatedLength(getter_AddRefs(width), this); + return width.forget(); +} + + +/* readonly attribute nsIDOMSVGAnimatedLength height; */ +NS_IMETHODIMP SVGForeignObjectElement::GetHeight(nsIDOMSVGAnimatedLength * *aHeight) +{ + *aHeight = Height().get(); + return NS_OK; +} + +already_AddRefed +SVGForeignObjectElement::Height() +{ + nsCOMPtr height; + mLengthAttributes[ATTR_HEIGHT].ToDOMAnimatedLength(getter_AddRefs(height), this); + return height.forget(); +} + +//---------------------------------------------------------------------- +// nsSVGElement methods + +/* virtual */ gfxMatrix +SVGForeignObjectElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix, + TransformTypes aWhich) const +{ + NS_ABORT_IF_FALSE(aWhich != eChildToUserSpace || aMatrix.IsIdentity(), + "Skipping eUserSpaceToParent transforms makes no sense"); + + // 'transform' attribute: + gfxMatrix fromUserSpace = + SVGGraphicsElement::PrependLocalTransformsTo(aMatrix, aWhich); + if (aWhich == eUserSpaceToParent) { + return fromUserSpace; + } + // our 'x' and 'y' attributes: + float x, y; + const_cast(this)-> + GetAnimatedLengthValues(&x, &y, nullptr); + gfxMatrix toUserSpace = gfxMatrix().Translate(gfxPoint(x, y)); + if (aWhich == eChildToUserSpace) { + return toUserSpace; + } + NS_ABORT_IF_FALSE(aWhich == eAllTransforms, "Unknown TransformTypes"); + return toUserSpace * fromUserSpace; +} + +/* virtual */ bool +SVGForeignObjectElement::HasValidDimensions() const +{ + return mLengthAttributes[ATTR_WIDTH].IsExplicitlySet() && + mLengthAttributes[ATTR_WIDTH].GetAnimValInSpecifiedUnits() > 0 && + mLengthAttributes[ATTR_HEIGHT].IsExplicitlySet() && + mLengthAttributes[ATTR_HEIGHT].GetAnimValInSpecifiedUnits() > 0; +} + +//---------------------------------------------------------------------- +// nsIContent methods + +NS_IMETHODIMP_(bool) +SVGForeignObjectElement::IsAttributeMapped(const nsIAtom* name) const +{ + static const MappedAttributeEntry* const map[] = { + sFEFloodMap, + sFiltersMap, + sFontSpecificationMap, + sGradientStopMap, + sLightingEffectsMap, + sMarkersMap, + sTextContentElementsMap, + sViewportsMap + }; + + return FindAttributeDependence(name, map) || + SVGGraphicsElement::IsAttributeMapped(name); +} + +//---------------------------------------------------------------------- +// nsSVGElement methods + +nsSVGElement::LengthAttributesInfo +SVGForeignObjectElement::GetLengthInfo() +{ + return LengthAttributesInfo(mLengthAttributes, sLengthInfo, + ArrayLength(sLengthInfo)); +} + +} // namespace dom +} // namespace mozilla + diff --git a/content/svg/content/src/SVGForeignObjectElement.h b/content/svg/content/src/SVGForeignObjectElement.h new file mode 100644 index 000000000000..6c629653d346 --- /dev/null +++ b/content/svg/content/src/SVGForeignObjectElement.h @@ -0,0 +1,76 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef mozilla_dom_SVGForeignObjectElement_h +#define mozilla_dom_SVGForeignObjectElement_h + +#include "mozilla/dom/SVGGraphicsElement.h" +#include "nsIDOMSVGForeignObjectElem.h" +#include "nsSVGLength2.h" + +nsresult NS_NewSVGForeignObjectElement(nsIContent **aResult, + already_AddRefed aNodeInfo); + +class nsSVGForeignObjectFrame; + +namespace mozilla { +namespace dom { + +class SVGForeignObjectElement MOZ_FINAL : public SVGGraphicsElement, + public nsIDOMSVGForeignObjectElement +{ + friend class ::nsSVGForeignObjectFrame; + +protected: + friend nsresult (::NS_NewSVGForeignObjectElement(nsIContent **aResult, + already_AddRefed aNodeInfo)); + SVGForeignObjectElement(already_AddRefed aNodeInfo); + virtual JSObject* WrapNode(JSContext *cx, JSObject *scope, bool *triedToWrap) MOZ_OVERRIDE; + +public: + // interfaces: + + NS_DECL_ISUPPORTS_INHERITED + NS_DECL_NSIDOMSVGFOREIGNOBJECTELEMENT + + // xxx I wish we could use virtual inheritance + NS_FORWARD_NSIDOMNODE_TO_NSINODE + NS_FORWARD_NSIDOMELEMENT_TO_GENERIC + NS_FORWARD_NSIDOMSVGELEMENT(SVGGraphicsElement::) + + // nsSVGElement specializations: + virtual gfxMatrix PrependLocalTransformsTo(const gfxMatrix &aMatrix, + TransformTypes aWhich = eAllTransforms) const; + virtual bool HasValidDimensions() const; + + // nsIContent interface + NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const; + + virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; + + virtual nsXPCClassInfo* GetClassInfo(); + + virtual nsIDOMNode* AsDOMNode() { return this; } + + // WebIDL + already_AddRefed X(); + already_AddRefed Y(); + already_AddRefed Width(); + already_AddRefed Height(); + +protected: + + virtual LengthAttributesInfo GetLengthInfo(); + + enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT }; + nsSVGLength2 mLengthAttributes[4]; + static LengthInfo sLengthInfo[4]; +}; + +} // namespace dom +} // namespace mozilla + +#endif // mozilla_dom_SVGForeignObjectElement_h + diff --git a/content/svg/content/src/nsSVGForeignObjectElement.cpp b/content/svg/content/src/nsSVGForeignObjectElement.cpp deleted file mode 100644 index 491369b17b6c..000000000000 --- a/content/svg/content/src/nsSVGForeignObjectElement.cpp +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "mozilla/Util.h" - -#include "nsCOMPtr.h" -#include "nsSVGForeignObjectElement.h" - -using namespace mozilla; - -nsSVGElement::LengthInfo nsSVGForeignObjectElement::sLengthInfo[4] = -{ - { &nsGkAtoms::x, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X }, - { &nsGkAtoms::y, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y }, - { &nsGkAtoms::width, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::X }, - { &nsGkAtoms::height, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, SVGContentUtils::Y }, -}; - -NS_IMPL_NS_NEW_SVG_ELEMENT(ForeignObject) - -//---------------------------------------------------------------------- -// nsISupports methods - -NS_IMPL_ADDREF_INHERITED(nsSVGForeignObjectElement,nsSVGForeignObjectElementBase) -NS_IMPL_RELEASE_INHERITED(nsSVGForeignObjectElement,nsSVGForeignObjectElementBase) - -DOMCI_NODE_DATA(SVGForeignObjectElement, nsSVGForeignObjectElement) - -NS_INTERFACE_TABLE_HEAD(nsSVGForeignObjectElement) - NS_NODE_INTERFACE_TABLE4(nsSVGForeignObjectElement, nsIDOMNode, nsIDOMElement, - nsIDOMSVGElement, - nsIDOMSVGForeignObjectElement) - NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGForeignObjectElement) -NS_INTERFACE_MAP_END_INHERITING(nsSVGForeignObjectElementBase) - -//---------------------------------------------------------------------- -// Implementation - -nsSVGForeignObjectElement::nsSVGForeignObjectElement(already_AddRefed aNodeInfo) - : nsSVGForeignObjectElementBase(aNodeInfo) -{ -} - -//---------------------------------------------------------------------- -// nsIDOMNode methods - -NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGForeignObjectElement) - -//---------------------------------------------------------------------- -// nsIDOMSVGForeignObjectElement methods: - -/* readonly attribute nsIDOMSVGAnimatedLength x; */ -NS_IMETHODIMP nsSVGForeignObjectElement::GetX(nsIDOMSVGAnimatedLength * *aX) -{ - return mLengthAttributes[X].ToDOMAnimatedLength(aX, this); -} - -/* readonly attribute nsIDOMSVGAnimatedLength y; */ -NS_IMETHODIMP nsSVGForeignObjectElement::GetY(nsIDOMSVGAnimatedLength * *aY) -{ - return mLengthAttributes[Y].ToDOMAnimatedLength(aY, this); -} - -/* readonly attribute nsIDOMSVGAnimatedLength width; */ -NS_IMETHODIMP nsSVGForeignObjectElement::GetWidth(nsIDOMSVGAnimatedLength * *aWidth) -{ - return mLengthAttributes[WIDTH].ToDOMAnimatedLength(aWidth, this); -} - -/* readonly attribute nsIDOMSVGAnimatedLength height; */ -NS_IMETHODIMP nsSVGForeignObjectElement::GetHeight(nsIDOMSVGAnimatedLength * *aHeight) -{ - return mLengthAttributes[HEIGHT].ToDOMAnimatedLength(aHeight, this); -} - -//---------------------------------------------------------------------- -// nsSVGElement methods - -/* virtual */ gfxMatrix -nsSVGForeignObjectElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix, - TransformTypes aWhich) const -{ - NS_ABORT_IF_FALSE(aWhich != eChildToUserSpace || aMatrix.IsIdentity(), - "Skipping eUserSpaceToParent transforms makes no sense"); - - // 'transform' attribute: - gfxMatrix fromUserSpace = - nsSVGForeignObjectElementBase::PrependLocalTransformsTo(aMatrix, aWhich); - if (aWhich == eUserSpaceToParent) { - return fromUserSpace; - } - // our 'x' and 'y' attributes: - float x, y; - const_cast(this)-> - GetAnimatedLengthValues(&x, &y, nullptr); - gfxMatrix toUserSpace = gfxMatrix().Translate(gfxPoint(x, y)); - if (aWhich == eChildToUserSpace) { - return toUserSpace; - } - NS_ABORT_IF_FALSE(aWhich == eAllTransforms, "Unknown TransformTypes"); - return toUserSpace * fromUserSpace; -} - -/* virtual */ bool -nsSVGForeignObjectElement::HasValidDimensions() const -{ - return mLengthAttributes[WIDTH].IsExplicitlySet() && - mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0 && - mLengthAttributes[HEIGHT].IsExplicitlySet() && - mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() > 0; -} - -//---------------------------------------------------------------------- -// nsIContent methods - -NS_IMETHODIMP_(bool) -nsSVGForeignObjectElement::IsAttributeMapped(const nsIAtom* name) const -{ - static const MappedAttributeEntry* const map[] = { - sFEFloodMap, - sFiltersMap, - sFontSpecificationMap, - sGradientStopMap, - sLightingEffectsMap, - sMarkersMap, - sTextContentElementsMap, - sViewportsMap - }; - - return FindAttributeDependence(name, map) || - nsSVGForeignObjectElementBase::IsAttributeMapped(name); -} - -//---------------------------------------------------------------------- -// nsSVGElement methods - -nsSVGElement::LengthAttributesInfo -nsSVGForeignObjectElement::GetLengthInfo() -{ - return LengthAttributesInfo(mLengthAttributes, sLengthInfo, - ArrayLength(sLengthInfo)); -} diff --git a/content/svg/content/src/nsSVGForeignObjectElement.h b/content/svg/content/src/nsSVGForeignObjectElement.h deleted file mode 100644 index 9c527e3f1833..000000000000 --- a/content/svg/content/src/nsSVGForeignObjectElement.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef __NS_SVGFOREIGNOBJECTELEMENT_H__ -#define __NS_SVGFOREIGNOBJECTELEMENT_H__ - -#include "SVGGraphicsElement.h" -#include "nsIDOMSVGForeignObjectElem.h" -#include "nsSVGLength2.h" - -typedef mozilla::dom::SVGGraphicsElement nsSVGForeignObjectElementBase; - -class nsSVGForeignObjectElement : public nsSVGForeignObjectElementBase, - public nsIDOMSVGForeignObjectElement -{ - friend class nsSVGForeignObjectFrame; - -protected: - friend nsresult NS_NewSVGForeignObjectElement(nsIContent **aResult, - already_AddRefed aNodeInfo); - nsSVGForeignObjectElement(already_AddRefed aNodeInfo); - -public: - // interfaces: - - NS_DECL_ISUPPORTS_INHERITED - NS_DECL_NSIDOMSVGFOREIGNOBJECTELEMENT - - // xxx I wish we could use virtual inheritance - NS_FORWARD_NSIDOMNODE_TO_NSINODE - NS_FORWARD_NSIDOMELEMENT_TO_GENERIC - NS_FORWARD_NSIDOMSVGELEMENT(nsSVGForeignObjectElementBase::) - - // nsSVGElement specializations: - virtual gfxMatrix PrependLocalTransformsTo(const gfxMatrix &aMatrix, - TransformTypes aWhich = eAllTransforms) const; - virtual bool HasValidDimensions() const; - - // nsIContent interface - NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const; - - virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const; - - virtual nsXPCClassInfo* GetClassInfo(); - - virtual nsIDOMNode* AsDOMNode() { return this; } -protected: - - virtual LengthAttributesInfo GetLengthInfo(); - - enum { X, Y, WIDTH, HEIGHT }; - nsSVGLength2 mLengthAttributes[4]; - static LengthInfo sLengthInfo[4]; -}; - -#endif diff --git a/dom/webidl/SVGForeignObjectElement.webidl b/dom/webidl/SVGForeignObjectElement.webidl new file mode 100644 index 000000000000..1279b7d3a697 --- /dev/null +++ b/dom/webidl/SVGForeignObjectElement.webidl @@ -0,0 +1,25 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. + * + * The origin of this IDL file is + * http://www.w3.org/TR/SVG2/ + * + * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C + * liability, trademark and document use rules apply. + */ + +interface SVGAnimatedLength; + +interface SVGForeignObjectElement : SVGGraphicsElement { + [Constant] + readonly attribute SVGAnimatedLength x; + [Constant] + readonly attribute SVGAnimatedLength y; + [Constant] + readonly attribute SVGAnimatedLength width; + [Constant] + readonly attribute SVGAnimatedLength height; +}; + diff --git a/dom/webidl/WebIDL.mk b/dom/webidl/WebIDL.mk index e46c40bd222d..3df9bc65c76a 100644 --- a/dom/webidl/WebIDL.mk +++ b/dom/webidl/WebIDL.mk @@ -106,6 +106,7 @@ webidl_files = \ SVGDefsElement.webidl \ SVGDescElement.webidl \ SVGElement.webidl \ + SVGForeignObjectElement.webidl \ SVGGraphicsElement.webidl \ SVGLengthList.webidl \ SVGLocatableElement.webidl \ diff --git a/layout/svg/nsSVGForeignObjectFrame.cpp b/layout/svg/nsSVGForeignObjectFrame.cpp index 39f28115e6ad..a25a8c357a56 100644 --- a/layout/svg/nsSVGForeignObjectFrame.cpp +++ b/layout/svg/nsSVGForeignObjectFrame.cpp @@ -17,13 +17,14 @@ #include "nsRenderingContext.h" #include "nsSVGContainerFrame.h" #include "nsSVGEffects.h" -#include "nsSVGForeignObjectElement.h" +#include "mozilla/dom/SVGForeignObjectElement.h" #include "nsSVGIntegrationUtils.h" #include "nsSVGOuterSVGFrame.h" #include "nsSVGUtils.h" #include "mozilla/AutoRestore.h" using namespace mozilla; +using namespace mozilla::dom; //---------------------------------------------------------------------- // Implementation @@ -357,7 +358,7 @@ NS_IMETHODIMP_(nsRect) nsSVGForeignObjectFrame::GetCoveredRegion() { float x, y, w, h; - static_cast(mContent)-> + static_cast(mContent)-> GetAnimatedLengthValues(&x, &y, &w, &h, nullptr); if (w < 0.0f) w = 0.0f; if (h < 0.0f) h = 0.0f; @@ -383,7 +384,7 @@ nsSVGForeignObjectFrame::ReflowSVG() // correct dimensions: float x, y, w, h; - static_cast(mContent)-> + static_cast(mContent)-> GetAnimatedLengthValues(&x, &y, &w, &h, nullptr); // If mRect's width or height are negative, reflow blows up! We must clamp! @@ -433,19 +434,19 @@ nsSVGForeignObjectFrame::NotifySVGChanged(uint32_t aFlags) bool needNewCanvasTM = false; if (aFlags & COORD_CONTEXT_CHANGED) { - nsSVGForeignObjectElement *fO = - static_cast(mContent); + SVGForeignObjectElement *fO = + static_cast(mContent); // Coordinate context changes affect mCanvasTM if we have a // percentage 'x' or 'y' - if (fO->mLengthAttributes[nsSVGForeignObjectElement::X].IsPercentage() || - fO->mLengthAttributes[nsSVGForeignObjectElement::Y].IsPercentage()) { + if (fO->mLengthAttributes[SVGForeignObjectElement::ATTR_X].IsPercentage() || + fO->mLengthAttributes[SVGForeignObjectElement::ATTR_Y].IsPercentage()) { needNewBounds = true; needNewCanvasTM = true; } // Our coordinate context's width/height has changed. If we have a // percentage width/height our dimensions will change so we must reflow. - if (fO->mLengthAttributes[nsSVGForeignObjectElement::WIDTH].IsPercentage() || - fO->mLengthAttributes[nsSVGForeignObjectElement::HEIGHT].IsPercentage()) { + if (fO->mLengthAttributes[SVGForeignObjectElement::ATTR_WIDTH].IsPercentage() || + fO->mLengthAttributes[SVGForeignObjectElement::ATTR_HEIGHT].IsPercentage()) { needNewBounds = true; needReflow = true; } @@ -496,8 +497,8 @@ SVGBBox nsSVGForeignObjectFrame::GetBBoxContribution(const gfxMatrix &aToBBoxUserspace, uint32_t aFlags) { - nsSVGForeignObjectElement *content = - static_cast(mContent); + SVGForeignObjectElement *content = + static_cast(mContent); float x, y, w, h; content->GetAnimatedLengthValues(&x, &y, &w, &h, nullptr); @@ -527,8 +528,8 @@ nsSVGForeignObjectFrame::GetCanvasTM(uint32_t aFor) NS_ASSERTION(mParent, "null parent"); nsSVGContainerFrame *parent = static_cast(mParent); - nsSVGForeignObjectElement *content = - static_cast(mContent); + SVGForeignObjectElement *content = + static_cast(mContent); gfxMatrix tm = content->PrependLocalTransformsTo(parent->GetCanvasTM(aFor));