Bug 866796 - Convert SVGAnimatedRect to WebIDL. r=Ms2ger
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 09 May 2013 13:42:12 -0400
changeset 142359 78a43b5ffabd78dfb84bf38a0aa0d6949e846f4c
parent 142358 29a83a39f02a5dfdf5c3acbafdade9faab3ef5e6
child 142360 b4c12bd0ca4e3e61eebef3aeb49ee01b311fefd6
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMs2ger
bugs866796
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 866796 - Convert SVGAnimatedRect to WebIDL. r=Ms2ger
content/svg/content/src/Makefile.in
content/svg/content/src/SVGAnimatedRect.cpp
content/svg/content/src/SVGAnimatedRect.h
content/svg/content/src/SVGIRect.h
content/svg/content/src/SVGMarkerElement.cpp
content/svg/content/src/SVGMarkerElement.h
content/svg/content/src/SVGPatternElement.cpp
content/svg/content/src/SVGPatternElement.h
content/svg/content/src/SVGRect.cpp
content/svg/content/src/SVGRect.h
content/svg/content/src/SVGSVGElement.cpp
content/svg/content/src/SVGSVGElement.h
content/svg/content/src/SVGSymbolElement.cpp
content/svg/content/src/SVGSymbolElement.h
content/svg/content/src/SVGTransformableElement.cpp
content/svg/content/src/SVGViewElement.cpp
content/svg/content/src/SVGViewElement.h
content/svg/content/src/moz.build
content/svg/content/src/nsSVGViewBox.cpp
content/svg/content/src/nsSVGViewBox.h
dom/base/nsDOMClassInfo.cpp
dom/base/nsDOMClassInfoClasses.h
dom/bindings/Bindings.conf
dom/interfaces/svg/moz.build
dom/interfaces/svg/nsIDOMSVGAnimatedRect.idl
dom/webidl/SVGAnimatedRect.webidl
dom/webidl/SVGFitToViewBox.webidl
dom/webidl/WebIDL.mk
layout/svg/nsSVGGlyphFrame.cpp
layout/svg/nsSVGTextFrame2.cpp
--- a/content/svg/content/src/Makefile.in
+++ b/content/svg/content/src/Makefile.in
@@ -54,16 +54,17 @@ CPPSRCS		= \
 		SVGAnimatedAngle.cpp \
 		SVGAnimatedBoolean.cpp \
 		SVGAnimatedLength.cpp \
 		SVGAnimatedLengthList.cpp \
 		SVGAnimatedNumberList.cpp \
 		SVGAnimatedPathSegList.cpp \
 		SVGAnimatedPointList.cpp \
 		SVGAnimatedPreserveAspectRatio.cpp \
+		SVGAnimatedRect.cpp \
 		SVGAnimatedTransformList.cpp \
 		SVGAnimateElement.cpp \
 		SVGAnimateTransformElement.cpp \
 		SVGAnimateMotionElement.cpp \
 		SVGAnimationElement.cpp \
 		SVGAttrValueWrapper.cpp \
 		SVGClipPathElement.cpp \
 		SVGCircleElement.cpp \
new file mode 100644
--- /dev/null
+++ b/content/svg/content/src/SVGAnimatedRect.cpp
@@ -0,0 +1,61 @@
+/* -*- 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 "SVGAnimatedRect.h"
+#include "mozilla/dom/SVGAnimatedRectBinding.h"
+#include "nsSVGElement.h"
+#include "nsSVGViewBox.h"
+#include "SVGIRect.h"
+
+namespace mozilla {
+namespace dom {
+
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SVGAnimatedRect)
+  NS_INTERFACE_MAP_ENTRY(nsISupports)
+  NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
+NS_INTERFACE_MAP_END
+
+NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(SVGAnimatedRect, mSVGElement)
+
+NS_IMPL_CYCLE_COLLECTING_ADDREF(SVGAnimatedRect)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(SVGAnimatedRect)
+
+SVGAnimatedRect::SVGAnimatedRect(nsSVGViewBox* aVal, nsSVGElement* aSVGElement)
+  : mVal(aVal)
+  , mSVGElement(aSVGElement)
+{
+  SetIsDOMBinding();
+}
+
+SVGAnimatedRect::~SVGAnimatedRect()
+{
+  nsSVGViewBox::sSVGAnimatedRectTearoffTable.RemoveTearoff(mVal);
+}
+
+already_AddRefed<SVGIRect>
+SVGAnimatedRect::GetBaseVal(ErrorResult& aRv)
+{
+  nsRefPtr<SVGIRect> rect;
+  aRv = mVal->ToDOMBaseVal(getter_AddRefs(rect), mSVGElement);
+  return rect.forget();
+}
+
+already_AddRefed<SVGIRect>
+SVGAnimatedRect::GetAnimVal(ErrorResult& aRv)
+{
+  nsRefPtr<SVGIRect> rect;
+  aRv = mVal->ToDOMAnimVal(getter_AddRefs(rect), mSVGElement);
+  return rect.forget();
+}
+
+JSObject*
+SVGAnimatedRect::WrapObject(JSContext* aCx,
+                            JS::Handle<JSObject*> aScope)
+{
+  return SVGAnimatedRectBinding::Wrap(aCx, aScope, this);
+}
+
+} // namespace dom
+} // namespace mozilla
new file mode 100644
--- /dev/null
+++ b/content/svg/content/src/SVGAnimatedRect.h
@@ -0,0 +1,53 @@
+/* -*- 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_SVGAnimatedRect_h
+#define mozilla_dom_SVGAnimatedRect_h
+
+#include "nsCycleCollectionParticipant.h"
+#include "mozilla/dom/SVGRectBinding.h"
+#include "mozilla/Attributes.h"
+#include "mozilla/ErrorResult.h"
+#include "nsWrapperCache.h"
+
+class nsSVGElement;
+class nsSVGViewBox;
+
+namespace mozilla {
+namespace dom {
+
+class SVGAnimatedRect MOZ_FINAL : public nsISupports,
+                                  public nsWrapperCache
+{
+public:
+  NS_DECL_CYCLE_COLLECTING_ISUPPORTS
+  NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(SVGAnimatedRect)
+
+  SVGAnimatedRect(nsSVGViewBox* aVal, nsSVGElement* aSVGElement);
+
+  virtual ~SVGAnimatedRect();
+
+  nsSVGElement* GetParentObject() const
+  {
+    return mSVGElement;
+  }
+
+  virtual JSObject* WrapObject(JSContext* aCx,
+                               JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;
+
+  already_AddRefed<SVGIRect> GetBaseVal(ErrorResult& aRv);
+
+  already_AddRefed<SVGIRect> GetAnimVal(ErrorResult& aRv);
+
+private:
+  nsSVGViewBox* mVal; // kept alive because it belongs to content
+  nsRefPtr<nsSVGElement> mSVGElement;
+};
+
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_SVGAnimatedRect_h
+
--- a/content/svg/content/src/SVGIRect.h
+++ b/content/svg/content/src/SVGIRect.h
@@ -7,28 +7,48 @@
 #define mozilla_dom_SVGIRect_h
 
 #include "nsIDOMSVGRect.h"
 #include "nsContentUtils.h"
 #include "nsCycleCollectionParticipant.h"
 #include "mozilla/dom/SVGRectBinding.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/ErrorResult.h"
+#include "nsWrapperCache.h"
+#include "nsIContent.h"
+
+class nsSVGElement;
 
 namespace mozilla {
 namespace dom {
 
-class SVGIRect : public nsIDOMSVGRect
+class SVGIRect : public nsIDOMSVGRect,
+                 public nsWrapperCache
 {
 public:
+  SVGIRect(nsIContent* aParent)
+    : mParent(aParent)
+  {
+    SetIsDOMBinding();
+  }
+
+  virtual ~SVGIRect()
+  {
+  }
+
   JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
   {
     return SVGRectBinding::Wrap(aCx, aScope, this);
   }
 
+  nsIContent* GetParentObject() const
+  {
+    return mParent;
+  }
+
   virtual float X() const = 0;
 
   NS_IMETHOD GetX(float *aX) MOZ_OVERRIDE MOZ_FINAL
   {
     *aX = X();
     return NS_OK;
   }
 
@@ -94,15 +114,18 @@ public:
   NS_IMETHOD SetHeight(float aHeight) MOZ_OVERRIDE MOZ_FINAL
   {
     NS_ENSURE_FINITE(aHeight, NS_ERROR_ILLEGAL_VALUE);
 
     ErrorResult rv;
     SetHeight(aHeight, rv);
     return rv.ErrorCode();
   }
+
+private:
+  nsCOMPtr<nsIContent> mParent;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 #endif //mozilla_dom_SVGIRect_h
 
--- a/content/svg/content/src/SVGMarkerElement.cpp
+++ b/content/svg/content/src/SVGMarkerElement.cpp
@@ -101,20 +101,20 @@ SVGMarkerElement::SVGMarkerElement(alrea
 
 //----------------------------------------------------------------------
 // nsIDOMNode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGMarkerElement)
 
 //----------------------------------------------------------------------
 
-already_AddRefed<nsIDOMSVGAnimatedRect>
+already_AddRefed<SVGAnimatedRect>
 SVGMarkerElement::ViewBox()
 {
-  nsCOMPtr<nsIDOMSVGAnimatedRect> rect;
+  nsRefPtr<SVGAnimatedRect> rect;
   mViewBox.ToDOMAnimatedRect(getter_AddRefs(rect), this);
   return rect.forget();
 }
 
 already_AddRefed<DOMSVGAnimatedPreserveAspectRatio>
 SVGMarkerElement::PreserveAspectRatio()
 {
   nsRefPtr<DOMSVGAnimatedPreserveAspectRatio> ratio;
--- a/content/svg/content/src/SVGMarkerElement.h
+++ b/content/svg/content/src/SVGMarkerElement.h
@@ -113,17 +113,17 @@ public:
   nsSVGViewBoxRect GetViewBoxRect();
   gfxMatrix GetViewBoxTransform();
 
   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
 
   nsSVGOrientType* GetOrientType() { return &mOrientType; }
 
   // WebIDL
-  already_AddRefed<nsIDOMSVGAnimatedRect> ViewBox();
+  already_AddRefed<SVGAnimatedRect> ViewBox();
   already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
   already_AddRefed<SVGAnimatedLength> RefX();
   already_AddRefed<SVGAnimatedLength> RefY();
   already_AddRefed<nsIDOMSVGAnimatedEnumeration> MarkerUnits();
   already_AddRefed<SVGAnimatedLength> MarkerWidth();
   already_AddRefed<SVGAnimatedLength> MarkerHeight();
   already_AddRefed<nsIDOMSVGAnimatedEnumeration> OrientType();
   already_AddRefed<SVGAnimatedAngle> OrientAngle();
--- a/content/svg/content/src/SVGPatternElement.cpp
+++ b/content/svg/content/src/SVGPatternElement.cpp
@@ -59,20 +59,20 @@ SVGPatternElement::SVGPatternElement(alr
 
 //----------------------------------------------------------------------
 // nsIDOMNode method
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGPatternElement)
 
 //----------------------------------------------------------------------
 
-already_AddRefed<nsIDOMSVGAnimatedRect>
+already_AddRefed<SVGAnimatedRect>
 SVGPatternElement::ViewBox()
 {
-  nsCOMPtr<nsIDOMSVGAnimatedRect> rect;
+  nsRefPtr<SVGAnimatedRect> rect;
   mViewBox.ToDOMAnimatedRect(getter_AddRefs(rect), this);
   return rect.forget();
 }
 
 already_AddRefed<DOMSVGAnimatedPreserveAspectRatio>
 SVGPatternElement::PreserveAspectRatio()
 {
   nsRefPtr<DOMSVGAnimatedPreserveAspectRatio> ratio;
--- a/content/svg/content/src/SVGPatternElement.h
+++ b/content/svg/content/src/SVGPatternElement.h
@@ -49,17 +49,17 @@ public:
 
   virtual mozilla::nsSVGAnimatedTransformList*
     GetAnimatedTransformList(uint32_t aFlags = 0) MOZ_OVERRIDE;
   virtual nsIAtom* GetTransformListAttrName() const MOZ_OVERRIDE {
     return nsGkAtoms::patternTransform;
   }
 
   // WebIDL
-  already_AddRefed<nsIDOMSVGAnimatedRect> ViewBox();
+  already_AddRefed<SVGAnimatedRect> ViewBox();
   already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
   already_AddRefed<nsIDOMSVGAnimatedEnumeration> PatternUnits();
   already_AddRefed<nsIDOMSVGAnimatedEnumeration> PatternContentUnits();
   already_AddRefed<SVGAnimatedTransformList> PatternTransform();
   already_AddRefed<SVGAnimatedLength> X();
   already_AddRefed<SVGAnimatedLength> Y();
   already_AddRefed<SVGAnimatedLength> Width();
   already_AddRefed<SVGAnimatedLength> Height();
--- a/content/svg/content/src/SVGRect.cpp
+++ b/content/svg/content/src/SVGRect.cpp
@@ -1,27 +1,28 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/dom/SVGRect.h"
 #include "nsContentUtils.h"
 #include "nsDOMClassInfoID.h"
+#include "nsSVGElement.h"
 
 DOMCI_DATA(SVGRect, mozilla::dom::SVGRect)
 
 namespace mozilla {
 namespace dom {
 
 //----------------------------------------------------------------------
 // implementation:
 
-SVGRect::SVGRect(float x, float y, float w, float h)
-    : mX(x), mY(y), mWidth(w), mHeight(h)
+SVGRect::SVGRect(nsIContent* aParent, float x, float y, float w, float h)
+  : SVGIRect(aParent), mX(x), mY(y), mWidth(w), mHeight(h)
 {
 }
 
 //----------------------------------------------------------------------
 // nsISupports methods:
 
 NS_IMPL_ADDREF(SVGRect)
 NS_IMPL_RELEASE(SVGRect)
@@ -34,23 +35,24 @@ NS_INTERFACE_MAP_END
 
 } // namespace dom
 } // namespace mozilla
 
 ////////////////////////////////////////////////////////////////////////
 // Exported creation functions:
 
 already_AddRefed<mozilla::dom::SVGRect>
-NS_NewSVGRect(float x, float y, float width, float height)
+NS_NewSVGRect(nsIContent* aParent, float aX, float aY, float aWidth,
+              float aHeight)
 {
   nsRefPtr<mozilla::dom::SVGRect> rect =
-    new mozilla::dom::SVGRect(x, y, width, height);
+    new mozilla::dom::SVGRect(aParent, aX, aY, aWidth, aHeight);
 
   return rect.forget();
 }
 
 already_AddRefed<mozilla::dom::SVGRect>
-NS_NewSVGRect(const gfxRect& rect)
+NS_NewSVGRect(nsIContent* aParent, const gfxRect& aRect)
 {
-  return NS_NewSVGRect(rect.X(), rect.Y(),
-                       rect.Width(), rect.Height());
+  return NS_NewSVGRect(aParent, aRect.X(), aRect.Y(),
+                       aRect.Width(), aRect.Height());
 }
 
--- a/content/svg/content/src/SVGRect.h
+++ b/content/svg/content/src/SVGRect.h
@@ -3,27 +3,29 @@
  * 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_SVGRect_h
 #define mozilla_dom_SVGRect_h
 
 #include "gfxRect.h"
 #include "mozilla/dom/SVGIRect.h"
+#include "nsSVGElement.h"
 
 ////////////////////////////////////////////////////////////////////////
 // SVGRect class
 
 namespace mozilla {
 namespace dom {
 
 class SVGRect MOZ_FINAL : public SVGIRect
 {
 public:
-  SVGRect(float x=0.0f, float y=0.0f, float w=0.0f, float h=0.0f);
+  SVGRect(nsIContent* aParent, float x=0.0f, float y=0.0f, float w=0.0f,
+          float h=0.0f);
 
   // nsISupports interface:
   NS_DECL_ISUPPORTS
 
   // WebIDL
   virtual float X() const MOZ_OVERRIDE MOZ_FINAL
   {
     return mX;
@@ -72,14 +74,15 @@ public:
 protected:
   float mX, mY, mWidth, mHeight;
 };
 
 } // namespace dom
 } // namespace mozilla
 
 already_AddRefed<mozilla::dom::SVGRect>
-NS_NewSVGRect(float x=0.0f, float y=0.0f, float width=0.0f, float height=0.0f);
+NS_NewSVGRect(nsIContent* aParent, float x=0.0f, float y=0.0f,
+              float width=0.0f, float height=0.0f);
 
 already_AddRefed<mozilla::dom::SVGRect>
-NS_NewSVGRect(const gfxRect& rect);
+NS_NewSVGRect(nsIContent* aParent, const gfxRect& rect);
 
 #endif //mozilla_dom_SVGRect_h
--- a/content/svg/content/src/SVGSVGElement.cpp
+++ b/content/svg/content/src/SVGSVGElement.cpp
@@ -406,17 +406,17 @@ SVGSVGElement::CreateSVGMatrix()
 {
   nsRefPtr<SVGMatrix> matrix = new SVGMatrix();
   return matrix.forget();
 }
 
 already_AddRefed<SVGIRect>
 SVGSVGElement::CreateSVGRect()
 {
-  return NS_NewSVGRect();
+  return NS_NewSVGRect(this);
 }
 
 already_AddRefed<SVGTransform>
 SVGSVGElement::CreateSVGTransform()
 {
   nsRefPtr<SVGTransform> transform = new SVGTransform();
   return transform.forget();
 }
@@ -437,20 +437,20 @@ SVGSVGElement::GetElementById(const nsAS
   if (!rv.Failed() && element) {
     return element->AsElement();
   }
   return nullptr;
 }
 
 //----------------------------------------------------------------------
 
-already_AddRefed<nsIDOMSVGAnimatedRect>
+already_AddRefed<SVGAnimatedRect>
 SVGSVGElement::ViewBox()
 {
-  nsCOMPtr<nsIDOMSVGAnimatedRect> rect;
+  nsRefPtr<SVGAnimatedRect> rect;
   mViewBox.ToDOMAnimatedRect(getter_AddRefs(rect), this);
   return rect.forget();
 }
 
 already_AddRefed<DOMSVGAnimatedPreserveAspectRatio>
 SVGSVGElement::PreserveAspectRatio()
 {
   nsRefPtr<DOMSVGAnimatedPreserveAspectRatio> ratio;
--- a/content/svg/content/src/SVGSVGElement.h
+++ b/content/svg/content/src/SVGSVGElement.h
@@ -29,16 +29,17 @@ class nsSVGImageFrame;
 
 namespace mozilla {
 class DOMSVGAnimatedPreserveAspectRatio;
 class SVGFragmentIdentifier;
 class AutoSVGRenderingState;
 
 namespace dom {
 class SVGAngle;
+class SVGAnimatedRect;
 class SVGMatrix;
 class SVGTransform;
 class SVGViewElement;
 class SVGIRect;
 
 class SVGSVGElement;
 
 class DOMSVGTranslatePoint MOZ_FINAL : public nsISVGPoint {
@@ -240,17 +241,17 @@ public:
   already_AddRefed<nsIDOMSVGLength> CreateSVGLength();
   already_AddRefed<SVGAngle> CreateSVGAngle();
   already_AddRefed<nsISVGPoint> CreateSVGPoint();
   already_AddRefed<SVGMatrix> CreateSVGMatrix();
   already_AddRefed<SVGIRect> CreateSVGRect();
   already_AddRefed<SVGTransform> CreateSVGTransform();
   already_AddRefed<SVGTransform> CreateSVGTransformFromMatrix(SVGMatrix& matrix);
   Element* GetElementById(const nsAString& elementId, ErrorResult& rv);
-  already_AddRefed<nsIDOMSVGAnimatedRect> ViewBox();
+  already_AddRefed<SVGAnimatedRect> ViewBox();
   already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
   uint16_t ZoomAndPan();
   void SetZoomAndPan(uint16_t aZoomAndPan, ErrorResult& rv);
 
 private:
   // nsSVGElement overrides
 
   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
--- a/content/svg/content/src/SVGSymbolElement.cpp
+++ b/content/svg/content/src/SVGSymbolElement.cpp
@@ -35,20 +35,20 @@ SVGSymbolElement::SVGSymbolElement(alrea
 
 //----------------------------------------------------------------------
 // nsIDOMNode methods
 
 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGSymbolElement)
 
 //----------------------------------------------------------------------
 
-already_AddRefed<nsIDOMSVGAnimatedRect>
+already_AddRefed<SVGAnimatedRect>
 SVGSymbolElement::ViewBox()
 {
-  nsCOMPtr<nsIDOMSVGAnimatedRect> rect;
+  nsRefPtr<SVGAnimatedRect> rect;
   mViewBox.ToDOMAnimatedRect(getter_AddRefs(rect), this);
   return rect.forget();
 }
 
 already_AddRefed<DOMSVGAnimatedPreserveAspectRatio>
 SVGSymbolElement::PreserveAspectRatio()
 {
   nsRefPtr<DOMSVGAnimatedPreserveAspectRatio> ratio;
--- a/content/svg/content/src/SVGSymbolElement.h
+++ b/content/svg/content/src/SVGSymbolElement.h
@@ -35,17 +35,17 @@ public:
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIContent interface
   NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* name) const;
 
   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
 
   // WebIDL
-  already_AddRefed<nsIDOMSVGAnimatedRect> ViewBox();
+  already_AddRefed<SVGAnimatedRect> ViewBox();
   already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
 
 protected:
   virtual nsSVGViewBox *GetViewBox();
   virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio();
 
   nsSVGViewBox mViewBox;
   SVGAnimatedPreserveAspectRatio mPreserveAspectRatio;
--- a/content/svg/content/src/SVGTransformableElement.cpp
+++ b/content/svg/content/src/SVGTransformableElement.cpp
@@ -168,17 +168,17 @@ SVGTransformableElement::GetBBox(ErrorRe
   }
 
   nsISVGChildFrame* svgframe = do_QueryFrame(frame);
   if (!svgframe) {
     rv.Throw(NS_ERROR_NOT_IMPLEMENTED); // XXX: outer svg
     return nullptr;
   }
 
-  return NS_NewSVGRect(nsSVGUtils::GetBBox(frame));
+  return NS_NewSVGRect(this, nsSVGUtils::GetBBox(frame));
 }
 
 already_AddRefed<SVGMatrix>
 SVGTransformableElement::GetCTM()
 {
   nsIDocument* currentDoc = GetCurrentDoc();
   if (currentDoc) {
     // Flush all pending notifications so that our frames are up to date
--- a/content/svg/content/src/SVGViewElement.cpp
+++ b/content/svg/content/src/SVGViewElement.cpp
@@ -59,20 +59,20 @@ SVGViewElement::SetZoomAndPan(uint16_t a
     return;
   }
 
   rv.Throw(NS_ERROR_RANGE_ERR);
 }
 
 //----------------------------------------------------------------------
 
-already_AddRefed<nsIDOMSVGAnimatedRect>
+already_AddRefed<SVGAnimatedRect>
 SVGViewElement::ViewBox()
 {
-  nsCOMPtr<nsIDOMSVGAnimatedRect> box;
+  nsRefPtr<SVGAnimatedRect> box;
   mViewBox.ToDOMAnimatedRect(getter_AddRefs(box), this);
   return box.forget();
 }
 
 already_AddRefed<DOMSVGAnimatedPreserveAspectRatio>
 SVGViewElement::PreserveAspectRatio()
 {
   nsRefPtr<DOMSVGAnimatedPreserveAspectRatio> ratio;
--- a/content/svg/content/src/SVGViewElement.h
+++ b/content/svg/content/src/SVGViewElement.h
@@ -42,17 +42,17 @@ protected:
                              JS::Handle<JSObject*> scope) MOZ_OVERRIDE;
 
 public:
   virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const MOZ_OVERRIDE;
 
   // WebIDL
   uint16_t ZoomAndPan() { return mEnumAttributes[ZOOMANDPAN].GetAnimValue(); }
   void SetZoomAndPan(uint16_t aZoomAndPan, ErrorResult& rv);
-  already_AddRefed<nsIDOMSVGAnimatedRect> ViewBox();
+  already_AddRefed<SVGAnimatedRect> ViewBox();
   already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
   already_AddRefed<DOMSVGStringList> ViewTarget();
 
 private:
 
   // nsSVGElement overrides
 
   virtual EnumAttributesInfo GetEnumInfo() MOZ_OVERRIDE;
--- a/content/svg/content/src/moz.build
+++ b/content/svg/content/src/moz.build
@@ -19,16 +19,17 @@ EXPORTS.mozilla.dom += [
     'SVGAltGlyphElement.h',
     'SVGAngle.h',
     'SVGAnimateElement.h',
     'SVGAnimateMotionElement.h',
     'SVGAnimateTransformElement.h',
     'SVGAnimatedAngle.h',
     'SVGAnimatedBoolean.h',
     'SVGAnimatedLength.h',
+    'SVGAnimatedRect.h',
     'SVGAnimatedTransformList.h',
     'SVGAnimationElement.h',
     'SVGCircleElement.h',
     'SVGClipPathElement.h',
     'SVGComponentTransferFunctionElement.h',
     'SVGDefsElement.h',
     'SVGDescElement.h',
     'SVGEllipseElement.h',
--- a/content/svg/content/src/nsSVGViewBox.cpp
+++ b/content/svg/content/src/nsSVGViewBox.cpp
@@ -4,17 +4,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsSVGViewBox.h"
 #include "prdtoa.h"
 #include "nsTextFormatter.h"
 #include "nsCharSeparatedTokenizer.h"
 #include "nsMathUtils.h"
 #include "nsSMILValue.h"
-#include "nsSVGAttrTearoffTable.h"
 #include "SVGContentUtils.h"
 #include "SVGViewBoxSMILType.h"
 #include "nsAttrValueInlines.h"
 
 #define NUM_VIEWBOX_COMPONENTS 4
 using namespace mozilla;
 
 /* Implementation of nsSVGViewBoxRect methods */
@@ -32,53 +31,41 @@ nsSVGViewBoxRect::operator==(const nsSVG
      width == aOther.width &&
      height == aOther.height);
 }
 
 /* Cycle collection macros for nsSVGViewBox */
 
 NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGViewBox::DOMBaseVal, mSVGElement)
 NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGViewBox::DOMAnimVal, mSVGElement)
-NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGViewBox::DOMAnimatedRect, mSVGElement)
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGViewBox::DOMBaseVal)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGViewBox::DOMBaseVal)
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGViewBox::DOMAnimVal)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGViewBox::DOMAnimVal)
 
-NS_IMPL_CYCLE_COLLECTING_ADDREF(nsSVGViewBox::DOMAnimatedRect)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(nsSVGViewBox::DOMAnimatedRect)
-
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGViewBox::DOMBaseVal)
   NS_INTERFACE_MAP_ENTRY(nsIDOMSVGRect)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGRect)
 NS_INTERFACE_MAP_END
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGViewBox::DOMAnimVal)
   NS_INTERFACE_MAP_ENTRY(nsIDOMSVGRect)
   NS_INTERFACE_MAP_ENTRY(nsISupports)
   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGRect)
 NS_INTERFACE_MAP_END
 
-DOMCI_DATA(SVGAnimatedRect, nsSVGViewBox::DOMAnimatedRect)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsSVGViewBox::DOMAnimatedRect)
-  NS_INTERFACE_MAP_ENTRY(nsIDOMSVGAnimatedRect)
-  NS_INTERFACE_MAP_ENTRY(nsISupports)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGAnimatedRect)
-NS_INTERFACE_MAP_END
-
-static nsSVGAttrTearoffTable<nsSVGViewBox, nsSVGViewBox::DOMAnimatedRect>
-  sSVGAnimatedRectTearoffTable;
 static nsSVGAttrTearoffTable<nsSVGViewBox, nsSVGViewBox::DOMBaseVal>
   sBaseSVGViewBoxTearoffTable;
 static nsSVGAttrTearoffTable<nsSVGViewBox, nsSVGViewBox::DOMAnimVal>
   sAnimSVGViewBoxTearoffTable;
+nsSVGAttrTearoffTable<nsSVGViewBox, mozilla::dom::SVGAnimatedRect>
+  nsSVGViewBox::sSVGAnimatedRectTearoffTable;
 
 
 /* Implementation of nsSVGViewBox methods */
 
 void
 nsSVGViewBox::Init()
 {
   mHasBaseVal = false;
@@ -209,37 +196,33 @@ nsSVGViewBox::GetBaseValueString(nsAStri
   nsTextFormatter::snprintf(buf, sizeof(buf)/sizeof(PRUnichar),
                             NS_LITERAL_STRING("%g %g %g %g").get(),
                             (double)mBaseVal.x, (double)mBaseVal.y,
                             (double)mBaseVal.width, (double)mBaseVal.height);
   aValue.Assign(buf);
 }
 
 nsresult
-nsSVGViewBox::ToDOMAnimatedRect(nsIDOMSVGAnimatedRect **aResult,
+nsSVGViewBox::ToDOMAnimatedRect(dom::SVGAnimatedRect **aResult,
                                 nsSVGElement* aSVGElement)
 {
-  nsRefPtr<DOMAnimatedRect> domAnimatedRect =
+  nsRefPtr<dom::SVGAnimatedRect> domAnimatedRect =
     sSVGAnimatedRectTearoffTable.GetTearoff(this);
   if (!domAnimatedRect) {
-    domAnimatedRect = new DOMAnimatedRect(this, aSVGElement);
+    domAnimatedRect = new dom::SVGAnimatedRect(this, aSVGElement);
     sSVGAnimatedRectTearoffTable.AddTearoff(this, domAnimatedRect);
   }
 
   domAnimatedRect.forget(aResult);
   return NS_OK;
 }
 
-nsSVGViewBox::DOMAnimatedRect::~DOMAnimatedRect()
-{
-  sSVGAnimatedRectTearoffTable.RemoveTearoff(mVal);
-}
-
 nsresult
-nsSVGViewBox::ToDOMBaseVal(nsIDOMSVGRect **aResult, nsSVGElement *aSVGElement)
+nsSVGViewBox::ToDOMBaseVal(dom::SVGIRect **aResult,
+                           nsSVGElement *aSVGElement)
 {
   if (!mHasBaseVal || mBaseVal.none) {
     *aResult = nullptr;
     return NS_OK;
   }
   nsRefPtr<DOMBaseVal> domBaseVal =
     sBaseSVGViewBoxTearoffTable.GetTearoff(this);
   if (!domBaseVal) {
@@ -252,17 +235,18 @@ nsSVGViewBox::ToDOMBaseVal(nsIDOMSVGRect
 }
 
 nsSVGViewBox::DOMBaseVal::~DOMBaseVal()
 {
   sBaseSVGViewBoxTearoffTable.RemoveTearoff(mVal);
 }
 
 nsresult
-nsSVGViewBox::ToDOMAnimVal(nsIDOMSVGRect **aResult, nsSVGElement *aSVGElement)
+nsSVGViewBox::ToDOMAnimVal(dom::SVGIRect **aResult,
+                           nsSVGElement *aSVGElement)
 {
   if ((mAnimVal && mAnimVal->none) ||
       (!mAnimVal && (!mHasBaseVal || mBaseVal.none))) {
     *aResult = nullptr;
     return NS_OK;
   }
   nsRefPtr<DOMAnimVal> domAnimVal =
     sAnimSVGViewBoxTearoffTable.GetTearoff(this);
--- a/content/svg/content/src/nsSVGViewBox.h
+++ b/content/svg/content/src/nsSVGViewBox.h
@@ -4,21 +4,22 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef __NS_SVGVIEWBOX_H__
 #define __NS_SVGVIEWBOX_H__
 
 #include "nsAutoPtr.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsError.h"
-#include "nsIDOMSVGAnimatedRect.h"
+#include "mozilla/dom/SVGAnimatedRect.h"
 #include "mozilla/dom/SVGIRect.h"
 #include "nsISMILAttr.h"
 #include "nsSVGElement.h"
 #include "mozilla/Attributes.h"
+#include "nsSVGAttrTearoffTable.h"
 
 class nsSMILValue;
 
 namespace mozilla {
 namespace dom {
 class SVGAnimationElement;
 }
 }
@@ -74,20 +75,22 @@ public:
   void SetAnimValue(const nsSVGViewBoxRect& aRect,
                     nsSVGElement *aSVGElement);
 
   nsresult SetBaseValueString(const nsAString& aValue,
                               nsSVGElement *aSVGElement,
                               bool aDoSetAttr);
   void GetBaseValueString(nsAString& aValue) const;
 
-  nsresult ToDOMAnimatedRect(nsIDOMSVGAnimatedRect **aResult,
+  nsresult ToDOMAnimatedRect(mozilla::dom::SVGAnimatedRect **aResult,
                              nsSVGElement *aSVGElement);
-  nsresult ToDOMBaseVal(nsIDOMSVGRect **aResult, nsSVGElement* aSVGElement);
-  nsresult ToDOMAnimVal(nsIDOMSVGRect **aResult, nsSVGElement* aSVGElement);
+  nsresult ToDOMBaseVal(mozilla::dom::SVGIRect **aResult,
+                        nsSVGElement* aSVGElement);
+  nsresult ToDOMAnimVal(mozilla::dom::SVGIRect **aResult,
+                        nsSVGElement* aSVGElement);
   // Returns a new nsISMILAttr object that the caller must delete
   nsISMILAttr* ToSMILAttr(nsSVGElement* aSVGElement);
 
 private:
 
   nsSVGViewBoxRect mBaseVal;
   nsAutoPtr<nsSVGViewBoxRect> mAnimVal;
   bool mHasBaseVal;
@@ -99,17 +102,20 @@ public:
     using mozilla::dom::SVGIRect::SetY;
     using mozilla::dom::SVGIRect::SetWidth;
     using mozilla::dom::SVGIRect::SetHeight;
 
     NS_DECL_CYCLE_COLLECTING_ISUPPORTS
     NS_DECL_CYCLE_COLLECTION_CLASS(DOMBaseVal)
 
     DOMBaseVal(nsSVGViewBox *aVal, nsSVGElement *aSVGElement)
-      : mVal(aVal), mSVGElement(aSVGElement) {}
+      : mozilla::dom::SVGIRect(aSVGElement)
+      , mVal(aVal)
+      , mSVGElement(aSVGElement)
+    {}
     virtual ~DOMBaseVal();
 
     nsSVGViewBox* mVal; // kept alive because it belongs to content
     nsRefPtr<nsSVGElement> mSVGElement;
 
     float X() const MOZ_OVERRIDE MOZ_FINAL
     {
       return mVal->GetBaseValue().x;
@@ -142,17 +148,20 @@ public:
     using mozilla::dom::SVGIRect::SetY;
     using mozilla::dom::SVGIRect::SetWidth;
     using mozilla::dom::SVGIRect::SetHeight;
 
     NS_DECL_CYCLE_COLLECTING_ISUPPORTS
     NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimVal)
 
     DOMAnimVal(nsSVGViewBox *aVal, nsSVGElement *aSVGElement)
-      : mVal(aVal), mSVGElement(aSVGElement) {}
+      : mozilla::dom::SVGIRect(aSVGElement)
+      , mVal(aVal)
+      , mSVGElement(aSVGElement)
+    {}
     virtual ~DOMAnimVal();
 
     nsSVGViewBox* mVal; // kept alive because it belongs to content
     nsRefPtr<nsSVGElement> mSVGElement;
 
     // Script may have modified animation parameters or timeline -- DOM getters
     // need to flush any resample requests to reflect these modifications.
     float X() const MOZ_OVERRIDE MOZ_FINAL
@@ -195,35 +204,16 @@ public:
     }
 
     void SetHeight(float aHeight, mozilla::ErrorResult& aRv) MOZ_FINAL
     {
       aRv.Throw(NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR);
     }
   };
 
-  struct DOMAnimatedRect MOZ_FINAL : public nsIDOMSVGAnimatedRect
-  {
-    NS_DECL_CYCLE_COLLECTING_ISUPPORTS
-    NS_DECL_CYCLE_COLLECTION_CLASS(DOMAnimatedRect)
-
-    DOMAnimatedRect(nsSVGViewBox *aVal, nsSVGElement *aSVGElement)
-      : mVal(aVal), mSVGElement(aSVGElement) {}
-    virtual ~DOMAnimatedRect();
-
-    nsSVGViewBox* mVal; // kept alive because it belongs to content
-    nsRefPtr<nsSVGElement> mSVGElement;
-
-    NS_IMETHOD GetBaseVal(nsIDOMSVGRect **aBaseVal)
-      { return mVal->ToDOMBaseVal(aBaseVal, mSVGElement); }
-
-    NS_IMETHOD GetAnimVal(nsIDOMSVGRect **aAnimVal)
-      { return mVal->ToDOMAnimVal(aAnimVal, mSVGElement); }
-  };
-
   struct SMILViewBox : public nsISMILAttr
   {
   public:
     SMILViewBox(nsSVGViewBox* aVal, nsSVGElement* aSVGElement)
       : mVal(aVal), mSVGElement(aSVGElement) {}
 
     // These will stay alive because a nsISMILAttr only lives as long
     // as the Compositing step, and DOM elements don't get a chance to
@@ -235,11 +225,14 @@ public:
     virtual nsresult ValueFromString(const nsAString& aStr,
                                      const mozilla::dom::SVGAnimationElement* aSrcElement,
                                      nsSMILValue& aValue,
                                      bool& aPreventCachingOfSandwich) const;
     virtual nsSMILValue GetBaseValue() const;
     virtual void ClearAnimValue();
     virtual nsresult SetAnimValue(const nsSMILValue& aValue);
   };
+
+  static nsSVGAttrTearoffTable<nsSVGViewBox, mozilla::dom::SVGAnimatedRect>
+    sSVGAnimatedRectTearoffTable;
 };
 
 #endif // __NS_SVGVIEWBOX_H__
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -209,17 +209,16 @@
 #include "nsIDOMNSXPathExpression.h"
 #include "nsIDOMXPathNSResolver.h"
 #include "nsIDOMXPathResult.h"
 #include "nsIDOMMozBrowserFrame.h"
 
 #include "nsIDOMSVGAnimatedEnum.h"
 #include "nsIDOMSVGAnimatedInteger.h"
 #include "nsIDOMSVGAnimatedNumber.h"
-#include "nsIDOMSVGAnimatedRect.h"
 #include "nsIDOMSVGAnimatedString.h"
 #include "nsIDOMTimeEvent.h"
 #include "nsIDOMSVGLength.h"
 #include "nsIDOMSVGNumber.h"
 #include "nsIDOMSVGRect.h"
 
 // Storage includes
 #include "DOMStorage.h"
@@ -690,18 +689,16 @@ static nsDOMClassInfoData sClassInfoData
 
   // other SVG classes
   NS_DEFINE_CLASSINFO_DATA(SVGAnimatedEnumeration, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(SVGAnimatedInteger, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(SVGAnimatedNumber, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
-  NS_DEFINE_CLASSINFO_DATA(SVGAnimatedRect, nsDOMGenericSH,
-                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(SVGAnimatedString, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(SVGLength, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(SVGNumber, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(SVGRect, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
@@ -1928,20 +1925,16 @@ nsDOMClassInfo::Init()
   DOM_CLASSINFO_MAP_BEGIN(SVGAnimatedInteger, nsIDOMSVGAnimatedInteger)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGAnimatedInteger)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(SVGAnimatedNumber, nsIDOMSVGAnimatedNumber)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGAnimatedNumber)
   DOM_CLASSINFO_MAP_END
 
-  DOM_CLASSINFO_MAP_BEGIN(SVGAnimatedRect, nsIDOMSVGAnimatedRect)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGAnimatedRect)
-  DOM_CLASSINFO_MAP_END
-
   DOM_CLASSINFO_MAP_BEGIN(SVGAnimatedString, nsIDOMSVGAnimatedString)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGAnimatedString)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(SVGLength, nsIDOMSVGLength)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMSVGLength)
   DOM_CLASSINFO_MAP_END
 
--- a/dom/base/nsDOMClassInfoClasses.h
+++ b/dom/base/nsDOMClassInfoClasses.h
@@ -100,17 +100,16 @@ DOMCI_CLASS(CSSSupportsRule)
 DOMCI_CLASS(BeforeUnloadEvent)
 
 DOMCI_CLASS(TimeEvent)
 
 // other SVG classes
 DOMCI_CLASS(SVGAnimatedEnumeration)
 DOMCI_CLASS(SVGAnimatedInteger)
 DOMCI_CLASS(SVGAnimatedNumber)
-DOMCI_CLASS(SVGAnimatedRect)
 DOMCI_CLASS(SVGAnimatedString)
 DOMCI_CLASS(SVGLength)
 DOMCI_CLASS(SVGNumber)
 DOMCI_CLASS(SVGRect)
 
 // Canvas
 DOMCI_CLASS(MozCanvasPrintState)
 
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -952,17 +952,16 @@ DOMInterfaces = {
     'headerFile': 'SVGPreserveAspectRatio.h'
 },
 
 'SVGRadialGradientElement': {
     'headerFile': 'mozilla/dom/SVGGradientElement.h',
 },
 
 'SVGRect': {
-    'wrapperCache': False,
     'nativeType': 'mozilla::dom::SVGIRect'
 },
 
 'SVGTextContentElement': {
     'concrete': False
 },
 
 'SVGTextPositioningElement': {
--- a/dom/interfaces/svg/moz.build
+++ b/dom/interfaces/svg/moz.build
@@ -5,17 +5,16 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 XPIDL_SOURCES += [
     'nsIDOMGetSVGDocument.idl',
     'nsIDOMSVGAnimatedEnum.idl',
     'nsIDOMSVGAnimatedInteger.idl',
     'nsIDOMSVGAnimatedLength.idl',
     'nsIDOMSVGAnimatedNumber.idl',
-    'nsIDOMSVGAnimatedRect.idl',
     'nsIDOMSVGAnimatedString.idl',
     'nsIDOMSVGDocument.idl',
     'nsIDOMSVGElement.idl',
     'nsIDOMSVGLength.idl',
     'nsIDOMSVGNumber.idl',
     'nsIDOMSVGRect.idl',
 ]
 
deleted file mode 100644
--- a/dom/interfaces/svg/nsIDOMSVGAnimatedRect.idl
+++ /dev/null
@@ -1,15 +0,0 @@
-/* -*- 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/. */
-
-#include "domstubs.idl"
-
-interface nsIDOMSVGRect;
-
-[scriptable, uuid(ca45959e-f1da-46f6-af19-1ecdc322285a)]
-interface nsIDOMSVGAnimatedRect : nsISupports
-{
-  readonly attribute nsIDOMSVGRect baseVal;
-  readonly attribute nsIDOMSVGRect animVal;
-};
new file mode 100644
--- /dev/null
+++ b/dom/webidl/SVGAnimatedRect.webidl
@@ -0,0 +1,18 @@
+/* -*- 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 SVGAnimatedRect {
+  [GetterThrows]
+  readonly attribute SVGRect? baseVal;
+  [GetterThrows]
+  readonly attribute SVGRect? animVal;
+};
--- a/dom/webidl/SVGFitToViewBox.webidl
+++ b/dom/webidl/SVGFitToViewBox.webidl
@@ -5,18 +5,16 @@
  *
  * 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 SVGAnimatedRect;
-
 [NoInterfaceObject]
 interface SVGFitToViewBox {
   [Constant]
   readonly attribute SVGAnimatedRect viewBox;
   [Constant]
   readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio;
 };
 
--- a/dom/webidl/WebIDL.mk
+++ b/dom/webidl/WebIDL.mk
@@ -201,16 +201,17 @@ webidl_files = \
   SVGAnimatedAngle.webidl \
   SVGAnimatedBoolean.webidl \
   SVGAnimatedLength.webidl \
   SVGAnimatedLengthList.webidl \
   SVGAnimatedNumberList.webidl \
   SVGAnimatedPathData.webidl \
   SVGAnimatedPoints.webidl \
   SVGAnimatedPreserveAspectRatio.webidl \
+  SVGAnimatedRect.webidl \
   SVGAnimatedTransformList.webidl \
   SVGAnimateElement.webidl \
   SVGAnimateMotionElement.webidl \
   SVGAnimateTransformElement.webidl \
   SVGAnimationElement.webidl \
   SVGCircleElement.webidl \
   SVGClipPathElement.webidl \
   SVGComponentTransferFunctionElement.webidl \
--- a/layout/svg/nsSVGGlyphFrame.cpp
+++ b/layout/svg/nsSVGGlyphFrame.cpp
@@ -1281,17 +1281,18 @@ nsSVGGlyphFrame::GetExtentOfChar(uint32_
 
   nsRefPtr<gfxContext> tmpCtx = MakeTmpCtx();
   iter.SetupForMetrics(tmpCtx);
   tmpCtx->Rectangle(gfxRect(0, -metrics.mAscent,
                             metrics.mAdvanceWidth,
                             metrics.mAscent + metrics.mDescent));
   tmpCtx->IdentityMatrix();
 
-  nsRefPtr<dom::SVGRect> rect = NS_NewSVGRect(tmpCtx->GetUserPathExtent());
+  nsRefPtr<dom::SVGRect> rect =
+    NS_NewSVGRect(mContent, tmpCtx->GetUserPathExtent());
 
   rect.forget(_retval);
   return NS_OK;
 }
 
 nsresult
 nsSVGGlyphFrame::GetRotationOfChar(uint32_t charnum, float *_retval)
 {
--- a/layout/svg/nsSVGTextFrame2.cpp
+++ b/layout/svg/nsSVGTextFrame2.cpp
@@ -3942,17 +3942,17 @@ nsSVGTextFrame2::GetExtentOfChar(nsICont
 
   gfxRect glyphRect
     (x, -presContext->AppUnitsToGfxUnits(ascent) * cssPxPerDevPx,
      advance, presContext->AppUnitsToGfxUnits(ascent + descent) * cssPxPerDevPx);
 
   // Transform the glyph's rect into user space.
   gfxRect r = m.TransformBounds(glyphRect);
 
-  NS_ADDREF(*aResult = new dom::SVGRect(r.x, r.y, r.width, r.height));
+  NS_ADDREF(*aResult = new dom::SVGRect(aContent, r.x, r.y, r.width, r.height));
   return NS_OK;
 }
 
 /**
  * Implements the SVG DOM GetRotationOfChar method for the specified
  * text content element.
  */
 nsresult