Bug 1540408 Part 2 - Move nsSVGLength2 and nsSVGNumber2 to the mozilla namespace renaming them to be SVGAnimatedLength and SVGAnimatedNumber. r=dholbert
authorlongsonr <longsonr@gmail.com>
Tue, 09 Apr 2019 21:04:33 +0100
changeset 468712 ea65b4513b3b38101fa2b18816e0284309df5831
parent 468638 8eaa269b362fd429c04779eaff8e2e7cd0075ad7
child 468713 43d7139e412a18fe85b14cca6c6bf27694fba030
push id35846
push userncsoregi@mozilla.com
push dateWed, 10 Apr 2019 10:00:20 +0000
treeherdermozilla-central@a1eb490ba448 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1540408
milestone68.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 1540408 Part 2 - Move nsSVGLength2 and nsSVGNumber2 to the mozilla namespace renaming them to be SVGAnimatedLength and SVGAnimatedNumber. r=dholbert
dom/base/nsAttrValue.cpp
dom/base/nsAttrValue.h
dom/base/nsAttrValueInlines.h
dom/canvas/CanvasRenderingContext2D.cpp
dom/svg/DOMSVGAnimatedLength.cpp
dom/svg/DOMSVGAnimatedLength.h
dom/svg/DOMSVGLength.cpp
dom/svg/DOMSVGLength.h
dom/svg/DOMSVGNumber.h
dom/svg/SVGAnimatedLength.cpp
dom/svg/SVGAnimatedLength.h
dom/svg/SVGAnimatedNumber.cpp
dom/svg/SVGAnimatedNumber.h
dom/svg/SVGAttrTearoffTable.h
dom/svg/SVGAttrValueWrapper.cpp
dom/svg/SVGAttrValueWrapper.h
dom/svg/SVGCircleElement.h
dom/svg/SVGComponentTransferFunctionElement.h
dom/svg/SVGElement.cpp
dom/svg/SVGElement.h
dom/svg/SVGEllipseElement.h
dom/svg/SVGFECompositeElement.h
dom/svg/SVGFEConvolveMatrixElement.h
dom/svg/SVGFEDisplacementMapElement.h
dom/svg/SVGFEDistantLightElement.h
dom/svg/SVGFEDropShadowElement.h
dom/svg/SVGFEOffsetElement.h
dom/svg/SVGFEPointLightElement.h
dom/svg/SVGFESpotLightElement.h
dom/svg/SVGFETurbulenceElement.h
dom/svg/SVGFilterElement.h
dom/svg/SVGFilters.h
dom/svg/SVGForeignObjectElement.h
dom/svg/SVGGeometryElement.cpp
dom/svg/SVGGeometryElement.h
dom/svg/SVGGradientElement.h
dom/svg/SVGImageElement.h
dom/svg/SVGLength.h
dom/svg/SVGLineElement.h
dom/svg/SVGMarkerElement.h
dom/svg/SVGMaskElement.h
dom/svg/SVGPatternElement.h
dom/svg/SVGRectElement.h
dom/svg/SVGStopElement.h
dom/svg/SVGTSpanElement.h
dom/svg/SVGTextContentElement.h
dom/svg/SVGTextElement.h
dom/svg/SVGTextPathElement.h
dom/svg/SVGUseElement.cpp
dom/svg/SVGUseElement.h
dom/svg/SVGViewportElement.cpp
dom/svg/SVGViewportElement.h
dom/svg/moz.build
dom/svg/nsSVGLength2.cpp
dom/svg/nsSVGLength2.h
dom/svg/nsSVGNumber2.cpp
dom/svg/nsSVGNumber2.h
layout/svg/SVGTextFrame.cpp
layout/svg/nsSVGFilterFrame.cpp
layout/svg/nsSVGFilterFrame.h
layout/svg/nsSVGFilterInstance.cpp
layout/svg/nsSVGFilterInstance.h
layout/svg/nsSVGGradientFrame.cpp
layout/svg/nsSVGOuterSVGFrame.cpp
layout/svg/nsSVGPatternFrame.cpp
layout/svg/nsSVGPatternFrame.h
layout/svg/nsSVGUtils.cpp
layout/svg/nsSVGUtils.h
--- a/dom/base/nsAttrValue.cpp
+++ b/dom/base/nsAttrValue.cpp
@@ -405,17 +405,17 @@ void nsAttrValue::SetTo(const SVGAnimate
   SetSVGType(eSVGOrient, &aValue, aSerialized);
 }
 
 void nsAttrValue::SetTo(const SVGAnimatedIntegerPair& aValue,
                         const nsAString* aSerialized) {
   SetSVGType(eSVGIntegerPair, &aValue, aSerialized);
 }
 
-void nsAttrValue::SetTo(const nsSVGLength2& aValue,
+void nsAttrValue::SetTo(const SVGAnimatedLength& aValue,
                         const nsAString* aSerialized) {
   SetSVGType(eSVGLength, &aValue, aSerialized);
 }
 
 void nsAttrValue::SetTo(const SVGLengthList& aValue,
                         const nsAString* aSerialized) {
   // While an empty string will parse as a length list, there's no need to store
   // it (and SetMiscAtomOrString will assert if we try)
@@ -1605,17 +1605,17 @@ void nsAttrValue::SetSVGType(ValueType a
                              const nsAString* aSerialized) {
   MOZ_ASSERT(IsSVGType(aType), "Not an SVG type");
 
   MiscContainer* cont = EnsureEmptyMiscContainer();
   // All SVG types are just pointers to classes so just setting any of them
   // will do. We'll lose type-safety but the signature of the calling
   // function should ensure we don't get anything unexpected, and once we
   // stick aValue in a union we lose type information anyway.
-  cont->mValue.mSVGLength = static_cast<const nsSVGLength2*>(aValue);
+  cont->mValue.mSVGLength = static_cast<const SVGAnimatedLength*>(aValue);
   cont->mType = aType;
   SetMiscAtomOrString(aSerialized);
 }
 
 MiscContainer* nsAttrValue::ClearMiscContainer() {
   MiscContainer* cont = nullptr;
   if (BaseType() == eOtherBase) {
     cont = GetMiscContainer();
--- a/dom/base/nsAttrValue.h
+++ b/dom/base/nsAttrValue.h
@@ -148,17 +148,18 @@ class nsAttrValue {
   void SetTo(int32_t aInt, const nsAString* aSerialized);
   void SetTo(double aValue, const nsAString* aSerialized);
   void SetTo(already_AddRefed<mozilla::DeclarationBlock> aValue,
              const nsAString* aSerialized);
   void SetTo(nsIURI* aValue, const nsAString* aSerialized);
   void SetTo(const nsIntMargin& aValue);
   void SetTo(const mozilla::SVGAnimatedIntegerPair& aValue,
              const nsAString* aSerialized);
-  void SetTo(const nsSVGLength2& aValue, const nsAString* aSerialized);
+  void SetTo(const mozilla::SVGAnimatedLength& aValue,
+             const nsAString* aSerialized);
   void SetTo(const mozilla::SVGAnimatedNumberPair& aValue,
              const nsAString* aSerialized);
   void SetTo(const mozilla::SVGAnimatedOrient& aValue,
              const nsAString* aSerialized);
   void SetTo(const mozilla::SVGAnimatedPreserveAspectRatio& aValue,
              const nsAString* aSerialized);
   void SetTo(const mozilla::SVGAnimatedViewBox& aValue,
              const nsAString* aSerialized);
--- a/dom/base/nsAttrValueInlines.h
+++ b/dom/base/nsAttrValueInlines.h
@@ -40,21 +40,21 @@ struct MiscContainer final {
         nscolor mColor;
         uint32_t mEnumValue;
         int32_t mPercent;
         mozilla::DeclarationBlock* mCSSDeclaration;
         nsIURI* mURL;
         mozilla::AtomArray* mAtomArray;
         nsIntMargin* mIntMargin;
         const mozilla::SVGAnimatedIntegerPair* mSVGAnimatedIntegerPair;
+        const mozilla::SVGAnimatedLength* mSVGLength;
+        const mozilla::SVGAnimatedNumberPair* mSVGAnimatedNumberPair;
+        const mozilla::SVGAnimatedOrient* mSVGAnimatedOrient;
         const mozilla::SVGAnimatedPreserveAspectRatio*
             mSVGAnimatedPreserveAspectRatio;
-        const mozilla::SVGAnimatedNumberPair* mSVGAnimatedNumberPair;
-        const mozilla::SVGAnimatedOrient* mSVGAnimatedOrient;
-        const nsSVGLength2* mSVGLength;
         const mozilla::SVGAnimatedViewBox* mSVGAnimatedViewBox;
         const mozilla::SVGLengthList* mSVGLengthList;
         const mozilla::SVGNumberList* mSVGNumberList;
         const mozilla::SVGPathData* mSVGPathData;
         const mozilla::SVGPointList* mSVGPointList;
         const mozilla::SVGStringList* mSVGStringList;
         const mozilla::SVGTransformList* mSVGTransformList;
       };
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -106,17 +106,16 @@
 #include "mozilla/dom/SVGImageElement.h"
 #include "mozilla/dom/SVGMatrix.h"
 #include "mozilla/dom/TextMetrics.h"
 #include "mozilla/dom/SVGMatrix.h"
 #include "mozilla/FloatingPoint.h"
 #include "nsGlobalWindow.h"
 #include "nsIScreenManager.h"
 #include "nsFilterInstance.h"
-#include "nsSVGLength2.h"
 #include "nsDeviceContext.h"
 #include "nsFontMetrics.h"
 #include "Units.h"
 #include "CanvasUtils.h"
 #include "mozilla/CycleCollectedJSRuntime.h"
 #include "mozilla/ServoCSSParser.h"
 #include "mozilla/ServoStyleSet.h"
 #include "mozilla/SVGContentUtils.h"
--- a/dom/svg/DOMSVGAnimatedLength.cpp
+++ b/dom/svg/DOMSVGAnimatedLength.cpp
@@ -2,17 +2,17 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "DOMSVGAnimatedLength.h"
 
 #include "mozilla/dom/SVGAnimatedLengthBinding.h"
-#include "nsSVGLength2.h"
+#include "SVGAnimatedLength.h"
 #include "DOMSVGLength.h"
 
 namespace mozilla {
 namespace dom {
 
 NS_SVG_VAL_IMPL_CYCLE_COLLECTION_WRAPPERCACHED(DOMSVGAnimatedLength,
                                                mSVGElement)
 
--- a/dom/svg/DOMSVGAnimatedLength.h
+++ b/dom/svg/DOMSVGAnimatedLength.h
@@ -5,42 +5,42 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_DOMSVGAnimatedLength_h
 #define mozilla_dom_DOMSVGAnimatedLength_h
 
 #include "mozilla/Attributes.h"
 #include "SVGElement.h"
 
-class nsSVGLength2;
+namespace mozilla {
 
-namespace mozilla {
+class SVGAnimatedLength;
 
 namespace dom {
 
 class DOMSVGLength;
 
 class DOMSVGAnimatedLength final : public nsWrapperCache {
  public:
   NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(DOMSVGAnimatedLength)
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(DOMSVGAnimatedLength)
 
-  DOMSVGAnimatedLength(nsSVGLength2* aVal, SVGElement* aSVGElement)
+  DOMSVGAnimatedLength(SVGAnimatedLength* aVal, SVGElement* aSVGElement)
       : mVal(aVal), mSVGElement(aSVGElement) {}
 
   // WebIDL
   SVGElement* GetParentObject() { return mSVGElement; }
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aGivenProto) override;
   already_AddRefed<DOMSVGLength> BaseVal();
   already_AddRefed<DOMSVGLength> AnimVal();
 
  protected:
   ~DOMSVGAnimatedLength();
 
-  nsSVGLength2* mVal;  // kept alive because it belongs to content
+  SVGAnimatedLength* mVal;  // kept alive because it belongs to content
   RefPtr<SVGElement> mSVGElement;
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
 #endif  // mozilla_dom_DOMSVGAnimatedLength_h
--- a/dom/svg/DOMSVGLength.cpp
+++ b/dom/svg/DOMSVGLength.cpp
@@ -5,31 +5,31 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "DOMSVGLength.h"
 
 #include "DOMSVGLengthList.h"
 #include "DOMSVGAnimatedLengthList.h"
 #include "nsError.h"
 #include "nsMathUtils.h"
+#include "SVGAnimatedLength.h"
 #include "SVGAnimatedLengthList.h"
 #include "SVGAttrTearoffTable.h"
 #include "SVGLength.h"
-#include "nsSVGLength2.h"
 #include "mozilla/dom/SVGElement.h"
 #include "mozilla/dom/SVGLengthBinding.h"
 #include "mozilla/FloatingPoint.h"
 
 // See the architecture comment in DOMSVGAnimatedLengthList.h.
 
 namespace mozilla {
 
 namespace dom {
 
-static SVGAttrTearoffTable<nsSVGLength2, DOMSVGLength>
+static SVGAttrTearoffTable<SVGAnimatedLength, DOMSVGLength>
     sBaseSVGLengthTearOffTable, sAnimSVGLengthTearOffTable;
 
 // We could use NS_IMPL_CYCLE_COLLECTION(, except that in Unlink() we need to
 // clear our list's weak ref to us to be safe. (The other option would be to
 // not unlink and rely on the breaking of the other edges in the cycle, as
 // NS_SVG_VAL_IMPL_CYCLE_COLLECTION does.)
 NS_IMPL_CYCLE_COLLECTION_CLASS(DOMSVGLength)
 
@@ -112,17 +112,17 @@ DOMSVGLength::DOMSVGLength()
     : mList(nullptr),
       mListIndex(0),
       mAttrEnum(0),
       mIsAnimValItem(false),
       mUnit(SVGLength_Binding::SVG_LENGTHTYPE_NUMBER),
       mValue(0.0f),
       mVal(nullptr) {}
 
-DOMSVGLength::DOMSVGLength(nsSVGLength2* aVal, SVGElement* aSVGElement,
+DOMSVGLength::DOMSVGLength(SVGAnimatedLength* aVal, SVGElement* aSVGElement,
                            bool aAnimVal)
     : mList(nullptr),
       mListIndex(0),
       mAttrEnum(0),
       mIsAnimValItem(aAnimVal),
       mUnit(SVGLength_Binding::SVG_LENGTHTYPE_NUMBER),
       mValue(0.0f),
       mVal(aVal),
@@ -144,17 +144,17 @@ void DOMSVGLength::CleanupWeakRefs() {
     auto& table = mIsAnimValItem ? sAnimSVGLengthTearOffTable
                                  : sBaseSVGLengthTearOffTable;
     table.RemoveTearoff(mVal);
   }
 }
 
 DOMSVGLength::~DOMSVGLength() { CleanupWeakRefs(); }
 
-already_AddRefed<DOMSVGLength> DOMSVGLength::GetTearOff(nsSVGLength2* aVal,
+already_AddRefed<DOMSVGLength> DOMSVGLength::GetTearOff(SVGAnimatedLength* aVal,
                                                         SVGElement* aSVGElement,
                                                         bool aAnimVal) {
   auto& table =
       aAnimVal ? sAnimSVGLengthTearOffTable : sBaseSVGLengthTearOffTable;
   RefPtr<DOMSVGLength> domLength = table.GetTearoff(aVal);
   if (!domLength) {
     domLength = new DOMSVGLength(aVal, aSVGElement, aAnimVal);
     table.AddTearoff(aVal, domLength);
--- a/dom/svg/DOMSVGLength.h
+++ b/dom/svg/DOMSVGLength.h
@@ -38,17 +38,17 @@ class SVGElement;
 
 /**
  * Class DOMSVGLength
  *
  * This class creates the DOM objects that wrap internal SVGLength objects that
  * are in an SVGLengthList. It is also used to create the objects returned by
  * SVGSVGElement.createSVGLength().
  *
- * For the DOM wrapper classes for non-list SVGLength, see nsSVGLength2.h.
+ * For the DOM wrapper classes for non-list SVGLength, see SVGAnimatedLength.h.
  *
  * See the architecture comment in DOMSVGAnimatedLengthList.h.
  *
  * This class is strongly intertwined with DOMSVGAnimatedLengthList and
  * DOMSVGLengthList. We are a friend of DOMSVGLengthList, and are responsible
  * for nulling out our DOMSVGLengthList's pointer to us when we die, making it
  * a real weak pointer.
  *
@@ -61,36 +61,37 @@ class SVGElement;
  * copy of its internal SVGLength's value and unit so that it doesn't appear to
  * "lose" its value from script's perspective on being removed from the list.
  * This means that these DOM tearoffs have space to store these values, even
  * though they're not used in the common case.
  *
  * Objects of this type are also used to reflect the baseVal and animVal of
  * a single, non-list SVGLength attribute. Getting and settings values of the
  * DOMSVGLength in this case requires reading and writing to the corresponding
- * nsSVGLength2 object.
+ * SVGAnimatedLength object.
  *
  * This class also stores its current list index, attribute enum, and whether
  * it belongs to a baseVal or animVal list. This is so that objects of this
  * type can find their corresponding internal SVGLength.
  *
  * To use these classes for <length> attributes as well as <list-of-length>
  * attributes, we would need to take a bit from mListIndex and use that to
  * indicate whether the object belongs to a list or non-list attribute, then
  * if-else as appropriate. The bug for doing that work is:
  * https://bugzilla.mozilla.org/show_bug.cgi?id=571734
  */
 class DOMSVGLength final : public nsISupports, public nsWrapperCache {
   friend class AutoChangeLengthNotifier;
 
   /**
    * Ctor for creating the object returned by
-   * nsSVGLength2::ToDOMBaseVal/ToDOMAnimVal
+   * SVGAnimatedLength::ToDOMBaseVal/ToDOMAnimVal
    */
-  DOMSVGLength(nsSVGLength2* aVal, dom::SVGElement* aSVGElement, bool aAnimVal);
+  DOMSVGLength(SVGAnimatedLength* aVal, dom::SVGElement* aSVGElement,
+               bool aAnimVal);
 
   ~DOMSVGLength();
 
  public:
   NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_DOMSVGLENGTH_IID)
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMSVGLength)
 
@@ -101,17 +102,17 @@ class DOMSVGLength final : public nsISup
                bool aIsAnimValItem);
 
   /**
    * Ctor for creating the objects returned by SVGSVGElement.createSVGLength(),
    * which do not initially belong to an attribute.
    */
   DOMSVGLength();
 
-  static already_AddRefed<DOMSVGLength> GetTearOff(nsSVGLength2* aVal,
+  static already_AddRefed<DOMSVGLength> GetTearOff(SVGAnimatedLength* aVal,
                                                    dom::SVGElement* aSVGElement,
                                                    bool aAnimVal);
 
   /**
    * Create an unowned copy of a length that is owned or is reflecting a single
    * attribute. The caller is responsible for the first AddRef().
    */
   DOMSVGLength* Copy();
@@ -222,18 +223,18 @@ class DOMSVGLength final : public nsISup
   uint32_t mAttrEnum : 4;  // supports up to 16 attributes
   uint32_t mIsAnimValItem : 1;
 
   // The following members are only used when we're not in a list:
   uint32_t mUnit : 5;  // can handle 31 units (the 10 SVG 1.1 units + rem, vw,
                        // vh, wm, calc + future additions)
   float mValue;
 
-  // The following members are only used when we have an nsSVGLength2
-  nsSVGLength2* mVal;  // kept alive because it belongs to mSVGElement
+  // The following members are only used when we have an SVGAnimatedLength
+  SVGAnimatedLength* mVal;  // kept alive because it belongs to mSVGElement
   RefPtr<dom::SVGElement> mSVGElement;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(DOMSVGLength, MOZILLA_DOMSVGLENGTH_IID)
 
 }  // namespace dom
 }  // namespace mozilla
 
--- a/dom/svg/DOMSVGNumber.h
+++ b/dom/svg/DOMSVGNumber.h
@@ -26,17 +26,17 @@ class SVGSVGElement;
 
 /**
  * Class DOMSVGNumber
  *
  * This class creates the DOM objects that wrap internal SVGNumber objects that
  * are in an SVGNumberList. It is also used to create the objects returned by
  * SVGSVGElement.createSVGNumber().
  *
- * For the DOM wrapper classes for non-list SVGNumber, see nsSVGNumber2.h.
+ * For the DOM wrapper classes for non-list SVGNumber, see SVGAnimatedNumber.h.
  *
  * See the architecture comment in DOMSVGAnimatedNumberList.h.
  *
  * See the comment in DOMSVGLength.h (yes, LENGTH), which applies here too.
  */
 class DOMSVGNumber final : public nsISupports, public nsWrapperCache {
   friend class AutoChangeNumberNotifier;
 
rename from dom/svg/nsSVGLength2.cpp
rename to dom/svg/SVGAnimatedLength.cpp
--- a/dom/svg/nsSVGLength2.cpp
+++ b/dom/svg/SVGAnimatedLength.cpp
@@ -1,46 +1,47 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "nsSVGLength2.h"
+#include "SVGAnimatedLength.h"
 
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/SMILValue.h"
 #include "mozilla/dom/SVGViewportElement.h"
 #include "DOMSVGAnimatedLength.h"
 #include "DOMSVGLength.h"
 #include "LayoutLogging.h"
 #include "nsContentUtils.h"
 #include "nsIFrame.h"
 #include "nsTextFormatter.h"
 #include "SMILFloatType.h"
 #include "SVGAttrTearoffTable.h"
 #include "nsSVGIntegrationUtils.h"
 
-using namespace mozilla;
 using namespace mozilla::dom;
 
+namespace mozilla {
+
 static const nsStaticAtom* const unitMap[] = {
     nullptr, /* SVG_LENGTHTYPE_UNKNOWN */
     nullptr, /* SVG_LENGTHTYPE_NUMBER */
     nsGkAtoms::percentage,
     nsGkAtoms::em,
     nsGkAtoms::ex,
     nsGkAtoms::px,
     nsGkAtoms::cm,
     nsGkAtoms::mm,
     nsGkAtoms::in,
     nsGkAtoms::pt,
     nsGkAtoms::pc};
 
-static SVGAttrTearoffTable<nsSVGLength2, DOMSVGAnimatedLength>
+static SVGAttrTearoffTable<SVGAnimatedLength, DOMSVGAnimatedLength>
     sSVGAnimatedLengthTearoffTable;
 
 /* Helper functions */
 
 static bool IsValidUnitType(uint16_t unit) {
   if (unit > SVGLength_Binding::SVG_LENGTHTYPE_UNKNOWN &&
       unit <= SVGLength_Binding::SVG_LENGTHTYPE_PC)
     return true;
@@ -174,41 +175,41 @@ float UserSpaceMetricsWithSize::GetAxisL
     default:
       MOZ_ASSERT_UNREACHABLE("Unknown axis type");
       length = 1;
       break;
   }
   return FixAxisLength(length);
 }
 
-float nsSVGLength2::GetPixelsPerUnit(SVGElement* aSVGElement,
-                                     uint8_t aUnitType) const {
+float SVGAnimatedLength::GetPixelsPerUnit(SVGElement* aSVGElement,
+                                          uint8_t aUnitType) const {
   return GetPixelsPerUnit(SVGElementMetrics(aSVGElement), aUnitType);
 }
 
-float nsSVGLength2::GetPixelsPerUnit(SVGViewportElement* aCtx,
-                                     uint8_t aUnitType) const {
+float SVGAnimatedLength::GetPixelsPerUnit(SVGViewportElement* aCtx,
+                                          uint8_t aUnitType) const {
   return GetPixelsPerUnit(SVGElementMetrics(aCtx, aCtx), aUnitType);
 }
 
-float nsSVGLength2::GetPixelsPerUnit(nsIFrame* aFrame,
-                                     uint8_t aUnitType) const {
+float SVGAnimatedLength::GetPixelsPerUnit(nsIFrame* aFrame,
+                                          uint8_t aUnitType) const {
   nsIContent* content = aFrame->GetContent();
   if (content->IsSVGElement()) {
     return GetPixelsPerUnit(
         SVGElementMetrics(static_cast<SVGElement*>(content)), aUnitType);
   }
   return GetPixelsPerUnit(NonSVGFrameUserSpaceMetrics(aFrame), aUnitType);
 }
 
 // See https://www.w3.org/TR/css-values-3/#absolute-lengths
 static const float DPI = 96.0f;
 
-float nsSVGLength2::GetPixelsPerUnit(const UserSpaceMetrics& aMetrics,
-                                     uint8_t aUnitType) const {
+float SVGAnimatedLength::GetPixelsPerUnit(const UserSpaceMetrics& aMetrics,
+                                          uint8_t aUnitType) const {
   switch (aUnitType) {
     case SVGLength_Binding::SVG_LENGTHTYPE_NUMBER:
     case SVGLength_Binding::SVG_LENGTHTYPE_PX:
       return 1;
     case SVGLength_Binding::SVG_LENGTHTYPE_MM:
       return DPI / MM_PER_INCH_FLOAT;
     case SVGLength_Binding::SVG_LENGTHTYPE_CM:
       return 10.0f * DPI / MM_PER_INCH_FLOAT;
@@ -225,19 +226,19 @@ float nsSVGLength2::GetPixelsPerUnit(con
     case SVGLength_Binding::SVG_LENGTHTYPE_EXS:
       return aMetrics.GetExLength();
     default:
       MOZ_ASSERT_UNREACHABLE("Unknown unit type");
       return 0;
   }
 }
 
-void nsSVGLength2::SetBaseValueInSpecifiedUnits(float aValue,
-                                                SVGElement* aSVGElement,
-                                                bool aDoSetAttr) {
+void SVGAnimatedLength::SetBaseValueInSpecifiedUnits(float aValue,
+                                                     SVGElement* aSVGElement,
+                                                     bool aDoSetAttr) {
   if (mIsBaseSet && mBaseVal == aValue) {
     return;
   }
 
   nsAttrValue emptyOrOldValue;
   if (aDoSetAttr) {
     emptyOrOldValue = aSVGElement->WillChangeLength(mAttrEnum);
   }
@@ -248,18 +249,18 @@ void nsSVGLength2::SetBaseValueInSpecifi
   } else {
     aSVGElement->AnimationNeedsResample();
   }
   if (aDoSetAttr) {
     aSVGElement->DidChangeLength(mAttrEnum, emptyOrOldValue);
   }
 }
 
-nsresult nsSVGLength2::ConvertToSpecifiedUnits(uint16_t unitType,
-                                               SVGElement* aSVGElement) {
+nsresult SVGAnimatedLength::ConvertToSpecifiedUnits(uint16_t unitType,
+                                                    SVGElement* aSVGElement) {
   if (!IsValidUnitType(unitType)) return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
 
   if (mIsBaseSet && mSpecifiedUnitType == uint8_t(unitType)) return NS_OK;
 
   float pixelsPerUnit = GetPixelsPerUnit(aSVGElement, unitType);
   if (pixelsPerUnit == 0.0f) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
@@ -283,19 +284,19 @@ nsresult nsSVGLength2::ConvertToSpecifie
   // Will/DidChangeAngle a second time (and dispatch duplicate notifications).
   SetBaseValueInSpecifiedUnits(valueInSpecifiedUnits, aSVGElement, false);
 
   aSVGElement->DidChangeLength(mAttrEnum, emptyOrOldValue);
 
   return NS_OK;
 }
 
-nsresult nsSVGLength2::NewValueSpecifiedUnits(uint16_t unitType,
-                                              float valueInSpecifiedUnits,
-                                              SVGElement* aSVGElement) {
+nsresult SVGAnimatedLength::NewValueSpecifiedUnits(uint16_t unitType,
+                                                   float valueInSpecifiedUnits,
+                                                   SVGElement* aSVGElement) {
   NS_ENSURE_FINITE(valueInSpecifiedUnits, NS_ERROR_ILLEGAL_VALUE);
 
   if (!IsValidUnitType(unitType)) return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
 
   if (mIsBaseSet && mBaseVal == valueInSpecifiedUnits &&
       mSpecifiedUnitType == uint8_t(unitType)) {
     return NS_OK;
   }
@@ -308,31 +309,31 @@ nsresult nsSVGLength2::NewValueSpecified
     mAnimVal = mBaseVal;
   } else {
     aSVGElement->AnimationNeedsResample();
   }
   aSVGElement->DidChangeLength(mAttrEnum, emptyOrOldValue);
   return NS_OK;
 }
 
-already_AddRefed<DOMSVGLength> nsSVGLength2::ToDOMBaseVal(
+already_AddRefed<DOMSVGLength> SVGAnimatedLength::ToDOMBaseVal(
     SVGElement* aSVGElement) {
   return DOMSVGLength::GetTearOff(this, aSVGElement, false);
 }
 
-already_AddRefed<DOMSVGLength> nsSVGLength2::ToDOMAnimVal(
+already_AddRefed<DOMSVGLength> SVGAnimatedLength::ToDOMAnimVal(
     SVGElement* aSVGElement) {
   return DOMSVGLength::GetTearOff(this, aSVGElement, true);
 }
 
 /* Implementation */
 
-nsresult nsSVGLength2::SetBaseValueString(const nsAString& aValueAsString,
-                                          SVGElement* aSVGElement,
-                                          bool aDoSetAttr) {
+nsresult SVGAnimatedLength::SetBaseValueString(const nsAString& aValueAsString,
+                                               SVGElement* aSVGElement,
+                                               bool aDoSetAttr) {
   float value;
   uint16_t unitType;
 
   if (!GetValueFromString(aValueAsString, value, &unitType)) {
     return NS_ERROR_DOM_SYNTAX_ERR;
   }
 
   if (mIsBaseSet && mBaseVal == float(value) &&
@@ -354,82 +355,83 @@ nsresult nsSVGLength2::SetBaseValueStrin
   }
 
   if (aDoSetAttr) {
     aSVGElement->DidChangeLength(mAttrEnum, emptyOrOldValue);
   }
   return NS_OK;
 }
 
-void nsSVGLength2::GetBaseValueString(nsAString& aValueAsString) const {
+void SVGAnimatedLength::GetBaseValueString(nsAString& aValueAsString) const {
   GetValueString(aValueAsString, mBaseVal, mSpecifiedUnitType);
 }
 
-void nsSVGLength2::GetAnimValueString(nsAString& aValueAsString) const {
+void SVGAnimatedLength::GetAnimValueString(nsAString& aValueAsString) const {
   GetValueString(aValueAsString, mAnimVal, mSpecifiedUnitType);
 }
 
-nsresult nsSVGLength2::SetBaseValue(float aValue, SVGElement* aSVGElement,
-                                    bool aDoSetAttr) {
+nsresult SVGAnimatedLength::SetBaseValue(float aValue, SVGElement* aSVGElement,
+                                         bool aDoSetAttr) {
   float pixelsPerUnit = GetPixelsPerUnit(aSVGElement, mSpecifiedUnitType);
   if (pixelsPerUnit == 0.0f) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   float valueInSpecifiedUnits = aValue / pixelsPerUnit;
   if (!IsFinite(valueInSpecifiedUnits)) {
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   SetBaseValueInSpecifiedUnits(valueInSpecifiedUnits, aSVGElement, aDoSetAttr);
   return NS_OK;
 }
 
-void nsSVGLength2::SetAnimValueInSpecifiedUnits(float aValue,
-                                                SVGElement* aSVGElement) {
+void SVGAnimatedLength::SetAnimValueInSpecifiedUnits(float aValue,
+                                                     SVGElement* aSVGElement) {
   if (mAnimVal == aValue && mIsAnimated) {
     return;
   }
   mAnimVal = aValue;
   mIsAnimated = true;
   aSVGElement->DidAnimateLength(mAttrEnum);
 }
 
-nsresult nsSVGLength2::SetAnimValue(float aValue, SVGElement* aSVGElement) {
+nsresult SVGAnimatedLength::SetAnimValue(float aValue,
+                                         SVGElement* aSVGElement) {
   float valueInSpecifiedUnits =
       aValue / GetPixelsPerUnit(aSVGElement, mSpecifiedUnitType);
 
   if (IsFinite(valueInSpecifiedUnits)) {
     SetAnimValueInSpecifiedUnits(valueInSpecifiedUnits, aSVGElement);
     return NS_OK;
   }
   return NS_ERROR_ILLEGAL_VALUE;
 }
 
-already_AddRefed<DOMSVGAnimatedLength> nsSVGLength2::ToDOMAnimatedLength(
+already_AddRefed<DOMSVGAnimatedLength> SVGAnimatedLength::ToDOMAnimatedLength(
     SVGElement* aSVGElement) {
   RefPtr<DOMSVGAnimatedLength> svgAnimatedLength =
       sSVGAnimatedLengthTearoffTable.GetTearoff(this);
   if (!svgAnimatedLength) {
     svgAnimatedLength = new DOMSVGAnimatedLength(this, aSVGElement);
     sSVGAnimatedLengthTearoffTable.AddTearoff(this, svgAnimatedLength);
   }
 
   return svgAnimatedLength.forget();
 }
 
 DOMSVGAnimatedLength::~DOMSVGAnimatedLength() {
   sSVGAnimatedLengthTearoffTable.RemoveTearoff(mVal);
 }
 
-UniquePtr<SMILAttr> nsSVGLength2::ToSMILAttr(SVGElement* aSVGElement) {
+UniquePtr<SMILAttr> SVGAnimatedLength::ToSMILAttr(SVGElement* aSVGElement) {
   return MakeUnique<SMILLength>(this, aSVGElement);
 }
 
-nsresult nsSVGLength2::SMILLength::ValueFromString(
+nsresult SVGAnimatedLength::SMILLength::ValueFromString(
     const nsAString& aStr, const SVGAnimationElement* /*aSrcElement*/,
     SMILValue& aValue, bool& aPreventCachingOfSandwich) const {
   float value;
   uint16_t unitType;
 
   if (!GetValueFromString(aStr, value, &unitType)) {
     return NS_ERROR_DOM_SYNTAX_ERR;
   }
@@ -440,30 +442,32 @@ nsresult nsSVGLength2::SMILLength::Value
   aPreventCachingOfSandwich =
       (unitType == SVGLength_Binding::SVG_LENGTHTYPE_PERCENTAGE ||
        unitType == SVGLength_Binding::SVG_LENGTHTYPE_EMS ||
        unitType == SVGLength_Binding::SVG_LENGTHTYPE_EXS);
 
   return NS_OK;
 }
 
-SMILValue nsSVGLength2::SMILLength::GetBaseValue() const {
+SMILValue SVGAnimatedLength::SMILLength::GetBaseValue() const {
   SMILValue val(SMILFloatType::Singleton());
   val.mU.mDouble = mVal->GetBaseValue(mSVGElement);
   return val;
 }
 
-void nsSVGLength2::SMILLength::ClearAnimValue() {
+void SVGAnimatedLength::SMILLength::ClearAnimValue() {
   if (mVal->mIsAnimated) {
     mVal->mIsAnimated = false;
     mVal->mAnimVal = mVal->mBaseVal;
     mSVGElement->DidAnimateLength(mVal->mAttrEnum);
   }
 }
 
-nsresult nsSVGLength2::SMILLength::SetAnimValue(const SMILValue& aValue) {
+nsresult SVGAnimatedLength::SMILLength::SetAnimValue(const SMILValue& aValue) {
   NS_ASSERTION(aValue.mType == SMILFloatType::Singleton(),
                "Unexpected type to assign animated value");
   if (aValue.mType == SMILFloatType::Singleton()) {
     return mVal->SetAnimValue(float(aValue.mU.mDouble), mSVGElement);
   }
   return NS_OK;
 }
+
+}  // namespace mozilla
rename from dom/svg/nsSVGLength2.h
rename to dom/svg/SVGAnimatedLength.h
--- a/dom/svg/nsSVGLength2.h
+++ b/dom/svg/SVGAnimatedLength.h
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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_SVGLENGTH2_H__
-#define __NS_SVGLENGTH2_H__
+#ifndef mozilla_SVGAnimatedLength_h
+#define mozilla_SVGAnimatedLength_h
 
 #include "mozilla/Attributes.h"
 #include "mozilla/SMILAttr.h"
 #include "mozilla/SVGContentUtils.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/dom/SVGLengthBinding.h"
 #include "mozilla/dom/SVGElement.h"
 #include "mozilla/gfx/Rect.h"
@@ -25,21 +25,16 @@ namespace mozilla {
 
 class SMILValue;
 
 namespace dom {
 class DOMSVGAnimatedLength;
 class DOMSVGLength;
 class SVGAnimationElement;
 class SVGViewportElement;
-}  // namespace dom
-}  // namespace mozilla
-
-namespace mozilla {
-namespace dom {
 
 class UserSpaceMetrics {
  public:
   virtual ~UserSpaceMetrics() {}
 
   virtual float GetEmLength() const = 0;
   virtual float GetExLength() const = 0;
   virtual float GetAxisLength(uint8_t aCtxType) const = 0;
@@ -78,19 +73,18 @@ class NonSVGFrameUserSpaceMetrics : publ
   virtual float GetExLength() const override;
   virtual gfx::Size GetSize() const override;
 
  private:
   nsIFrame* mFrame;
 };
 
 }  // namespace dom
-}  // namespace mozilla
 
-class nsSVGLength2 {
+class SVGAnimatedLength {
   friend class mozilla::dom::DOMSVGAnimatedLength;
   friend class mozilla::dom::DOMSVGLength;
   typedef mozilla::dom::DOMSVGLength DOMSVGLength;
   typedef mozilla::dom::SVGElement SVGElement;
   typedef mozilla::dom::SVGViewportElement SVGViewportElement;
   typedef mozilla::dom::UserSpaceMetrics UserSpaceMetrics;
   typedef mozilla::SMILAttr SMILAttr;
   typedef mozilla::SMILValue SMILValue;
@@ -104,17 +98,17 @@ class nsSVGLength2 {
     mAnimVal = mBaseVal = aValue;
     mSpecifiedUnitType = aUnitType;
     mAttrEnum = aAttrEnum;
     mCtxType = aCtxType;
     mIsAnimated = false;
     mIsBaseSet = false;
   }
 
-  nsSVGLength2& operator=(const nsSVGLength2& aLength) {
+  SVGAnimatedLength& operator=(const SVGAnimatedLength& aLength) {
     mBaseVal = aLength.mBaseVal;
     mAnimVal = aLength.mAnimVal;
     mSpecifiedUnitType = aLength.mSpecifiedUnitType;
     mIsAnimated = aLength.mIsAnimated;
     mIsBaseSet = aLength.mIsBaseSet;
     return *this;
   }
 
@@ -197,29 +191,31 @@ class nsSVGLength2 {
                                   SVGElement* aSVGElement);
   nsresult ConvertToSpecifiedUnits(uint16_t aUnitType, SVGElement* aSVGElement);
   already_AddRefed<DOMSVGLength> ToDOMBaseVal(SVGElement* aSVGElement);
   already_AddRefed<DOMSVGLength> ToDOMAnimVal(SVGElement* aSVGElement);
 
  public:
   struct SMILLength : public SMILAttr {
    public:
-    SMILLength(nsSVGLength2* aVal, SVGElement* aSVGElement)
+    SMILLength(SVGAnimatedLength* aVal, SVGElement* aSVGElement)
         : mVal(aVal), mSVGElement(aSVGElement) {}
 
     // These will stay alive because a SMILAttr only lives as long
     // as the Compositing step, and DOM elements don't get a chance to
     // die during that.
-    nsSVGLength2* mVal;
+    SVGAnimatedLength* mVal;
     SVGElement* mSVGElement;
 
     // SMILAttr methods
     virtual nsresult ValueFromString(
         const nsAString& aStr,
         const mozilla::dom::SVGAnimationElement* aSrcElement, SMILValue& aValue,
         bool& aPreventCachingOfSandwich) const override;
     virtual SMILValue GetBaseValue() const override;
     virtual void ClearAnimValue() override;
     virtual nsresult SetAnimValue(const SMILValue& aValue) override;
   };
 };
 
-#endif  //  __NS_SVGLENGTH2_H__
+}  // namespace mozilla
+
+#endif  //  mozilla_SVGAnimatedLength_h
rename from dom/svg/nsSVGNumber2.cpp
rename to dom/svg/SVGAnimatedNumber.cpp
--- a/dom/svg/nsSVGNumber2.cpp
+++ b/dom/svg/SVGAnimatedNumber.cpp
@@ -1,29 +1,31 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "nsSVGNumber2.h"
+#include "SVGAnimatedNumber.h"
 
 #include "mozilla/Attributes.h"
 #include "mozilla/SMILValue.h"
 #include "mozilla/SVGContentUtils.h"
 #include "nsContentUtils.h"
 #include "SMILFloatType.h"
 #include "SVGAttrTearoffTable.h"
 
-using namespace mozilla;
 using namespace mozilla::dom;
 
+namespace mozilla {
+
 /* Implementation */
 
-static SVGAttrTearoffTable<nsSVGNumber2, nsSVGNumber2::DOMAnimatedNumber>
+static SVGAttrTearoffTable<SVGAnimatedNumber,
+                           SVGAnimatedNumber::DOMAnimatedNumber>
     sSVGAnimatedNumberTearoffTable;
 
 static bool GetValueFromString(const nsAString& aString,
                                bool aPercentagesAllowed, float& aValue) {
   bool success;
   auto token = SVGContentUtils::GetAndEnsureOneToken(aString, success);
 
   if (!success) {
@@ -43,18 +45,18 @@ static bool GetValueFromString(const nsA
       aValue /= 100;
       return true;
     }
   }
 
   return iter == end;
 }
 
-nsresult nsSVGNumber2::SetBaseValueString(const nsAString& aValueAsString,
-                                          SVGElement* aSVGElement) {
+nsresult SVGAnimatedNumber::SetBaseValueString(const nsAString& aValueAsString,
+                                               SVGElement* aSVGElement) {
   float val;
 
   if (!GetValueFromString(aValueAsString,
                           aSVGElement->NumberAttrAllowsPercentage(mAttrEnum),
                           val)) {
     return NS_ERROR_DOM_SYNTAX_ERR;
   }
 
@@ -67,66 +69,66 @@ nsresult nsSVGNumber2::SetBaseValueStrin
   }
 
   // We don't need to call DidChange* here - we're only called by
   // SVGElement::ParseAttribute under Element::SetAttr,
   // which takes care of notifying.
   return NS_OK;
 }
 
-void nsSVGNumber2::GetBaseValueString(nsAString& aValueAsString) {
+void SVGAnimatedNumber::GetBaseValueString(nsAString& aValueAsString) {
   aValueAsString.Truncate();
   aValueAsString.AppendFloat(mBaseVal);
 }
 
-void nsSVGNumber2::SetBaseValue(float aValue, SVGElement* aSVGElement) {
+void SVGAnimatedNumber::SetBaseValue(float aValue, SVGElement* aSVGElement) {
   if (mIsBaseSet && aValue == mBaseVal) {
     return;
   }
 
   mBaseVal = aValue;
   mIsBaseSet = true;
   if (!mIsAnimated) {
     mAnimVal = mBaseVal;
   } else {
     aSVGElement->AnimationNeedsResample();
   }
   aSVGElement->DidChangeNumber(mAttrEnum);
 }
 
-void nsSVGNumber2::SetAnimValue(float aValue, SVGElement* aSVGElement) {
+void SVGAnimatedNumber::SetAnimValue(float aValue, SVGElement* aSVGElement) {
   if (mIsAnimated && aValue == mAnimVal) {
     return;
   }
   mAnimVal = aValue;
   mIsAnimated = true;
   aSVGElement->DidAnimateNumber(mAttrEnum);
 }
 
-already_AddRefed<DOMSVGAnimatedNumber> nsSVGNumber2::ToDOMAnimatedNumber(
+already_AddRefed<DOMSVGAnimatedNumber> SVGAnimatedNumber::ToDOMAnimatedNumber(
     SVGElement* aSVGElement) {
   RefPtr<DOMAnimatedNumber> domAnimatedNumber =
       sSVGAnimatedNumberTearoffTable.GetTearoff(this);
   if (!domAnimatedNumber) {
     domAnimatedNumber = new DOMAnimatedNumber(this, aSVGElement);
     sSVGAnimatedNumberTearoffTable.AddTearoff(this, domAnimatedNumber);
   }
 
   return domAnimatedNumber.forget();
 }
 
-nsSVGNumber2::DOMAnimatedNumber::~DOMAnimatedNumber() {
+SVGAnimatedNumber::DOMAnimatedNumber::~DOMAnimatedNumber() {
   sSVGAnimatedNumberTearoffTable.RemoveTearoff(mVal);
 }
 
-UniquePtr<SMILAttr> nsSVGNumber2::ToSMILAttr(SVGElement* aSVGElement) {
+UniquePtr<SMILAttr> SVGAnimatedNumber::ToSMILAttr(SVGElement* aSVGElement) {
   return MakeUnique<SMILNumber>(this, aSVGElement);
 }
 
-nsresult nsSVGNumber2::SMILNumber::ValueFromString(
+nsresult SVGAnimatedNumber::SMILNumber::ValueFromString(
     const nsAString& aStr,
     const mozilla::dom::SVGAnimationElement* /*aSrcElement*/, SMILValue& aValue,
     bool& aPreventCachingOfSandwich) const {
   float value;
 
   if (!GetValueFromString(
           aStr, mSVGElement->NumberAttrAllowsPercentage(mVal->mAttrEnum),
           value)) {
@@ -136,30 +138,32 @@ nsresult nsSVGNumber2::SMILNumber::Value
   SMILValue val(SMILFloatType::Singleton());
   val.mU.mDouble = value;
   aValue = val;
   aPreventCachingOfSandwich = false;
 
   return NS_OK;
 }
 
-SMILValue nsSVGNumber2::SMILNumber::GetBaseValue() const {
+SMILValue SVGAnimatedNumber::SMILNumber::GetBaseValue() const {
   SMILValue val(SMILFloatType::Singleton());
   val.mU.mDouble = mVal->mBaseVal;
   return val;
 }
 
-void nsSVGNumber2::SMILNumber::ClearAnimValue() {
+void SVGAnimatedNumber::SMILNumber::ClearAnimValue() {
   if (mVal->mIsAnimated) {
     mVal->mIsAnimated = false;
     mVal->mAnimVal = mVal->mBaseVal;
     mSVGElement->DidAnimateNumber(mVal->mAttrEnum);
   }
 }
 
-nsresult nsSVGNumber2::SMILNumber::SetAnimValue(const SMILValue& aValue) {
+nsresult SVGAnimatedNumber::SMILNumber::SetAnimValue(const SMILValue& aValue) {
   NS_ASSERTION(aValue.mType == SMILFloatType::Singleton(),
                "Unexpected type to assign animated value");
   if (aValue.mType == SMILFloatType::Singleton()) {
     mVal->SetAnimValue(float(aValue.mU.mDouble), mSVGElement);
   }
   return NS_OK;
 }
+
+}  // namespace mozilla
rename from dom/svg/nsSVGNumber2.h
rename to dom/svg/SVGAnimatedNumber.h
--- a/dom/svg/nsSVGNumber2.h
+++ b/dom/svg/SVGAnimatedNumber.h
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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_SVGNUMBER2_H__
-#define __NS_SVGNUMBER2_H__
+#ifndef mozilla_SVGAnimatedNumber_h
+#define mozilla_SVGAnimatedNumber_h
 
 #include "DOMSVGAnimatedNumber.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsError.h"
 #include "nsMathUtils.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/FloatingPoint.h"
 #include "mozilla/SMILAttr.h"
@@ -19,19 +19,18 @@
 
 namespace mozilla {
 
 class SMILValue;
 
 namespace dom {
 class SVGAnimationElement;
 }  // namespace dom
-}  // namespace mozilla
 
-class nsSVGNumber2 {
+class SVGAnimatedNumber {
  public:
   typedef mozilla::SMILAttr SMILAttr;
   typedef mozilla::SMILValue SMILValue;
   typedef mozilla::dom::SVGElement SVGElement;
 
   void Init(uint8_t aAttrEnum = 0xff, float aValue = 0) {
     mAnimVal = mBaseVal = aValue;
     mAttrEnum = aAttrEnum;
@@ -62,23 +61,23 @@ class nsSVGNumber2 {
   float mAnimVal;
   float mBaseVal;
   uint8_t mAttrEnum;  // element specified tracking for attribute
   bool mIsAnimated;
   bool mIsBaseSet;
 
  public:
   // DOM wrapper class for the (DOM)SVGAnimatedNumber interface where the
-  // wrapped class is nsSVGNumber2.
+  // wrapped class is SVGAnimatedNumber.
   struct DOMAnimatedNumber final : public mozilla::dom::DOMSVGAnimatedNumber {
-    DOMAnimatedNumber(nsSVGNumber2* aVal, SVGElement* aSVGElement)
+    DOMAnimatedNumber(SVGAnimatedNumber* aVal, SVGElement* aSVGElement)
         : mozilla::dom::DOMSVGAnimatedNumber(aSVGElement), mVal(aVal) {}
     virtual ~DOMAnimatedNumber();
 
-    nsSVGNumber2* mVal;  // kept alive because it belongs to content
+    SVGAnimatedNumber* mVal;  // kept alive because it belongs to content
 
     virtual float BaseVal() override { return mVal->GetBaseValue(); }
     virtual void SetBaseVal(float aValue) override {
       MOZ_ASSERT(mozilla::IsFinite(aValue));
       mVal->SetBaseValue(aValue, mSVGElement);
     }
 
     // Script may have modified animation parameters or timeline -- DOM getters
@@ -86,29 +85,31 @@ class nsSVGNumber2 {
     virtual float AnimVal() override {
       mSVGElement->FlushAnimations();
       return mVal->GetAnimValue();
     }
   };
 
   struct SMILNumber : public SMILAttr {
    public:
-    SMILNumber(nsSVGNumber2* aVal, SVGElement* aSVGElement)
+    SMILNumber(SVGAnimatedNumber* aVal, SVGElement* aSVGElement)
         : mVal(aVal), mSVGElement(aSVGElement) {}
 
     // These will stay alive because a SMILAttr only lives as long
     // as the Compositing step, and DOM elements don't get a chance to
     // die during that.
-    nsSVGNumber2* mVal;
+    SVGAnimatedNumber* mVal;
     SVGElement* mSVGElement;
 
     // SMILAttr methods
     virtual nsresult ValueFromString(
         const nsAString& aStr,
         const mozilla::dom::SVGAnimationElement* aSrcElement, SMILValue& aValue,
         bool& aPreventCachingOfSandwich) const override;
     virtual SMILValue GetBaseValue() const override;
     virtual void ClearAnimValue() override;
     virtual nsresult SetAnimValue(const SMILValue& aValue) override;
   };
 };
 
-#endif  //__NS_SVGNUMBER2_H__
+}  // namespace mozilla
+
+#endif  //  mozilla_SVGAnimatedNumber_h
--- a/dom/svg/SVGAttrTearoffTable.h
+++ b/dom/svg/SVGAttrTearoffTable.h
@@ -9,19 +9,19 @@
 
 #include "nsDataHashtable.h"
 #include "nsDebug.h"
 #include "nsHashKeys.h"
 
 namespace mozilla {
 
 /**
- * Global hashmap to associate internal SVG data types (e.g. nsSVGLength2) with
- * DOM tear-off objects (e.g. DOMSVGLength). This allows us to always return
- * the same object for subsequent requests for DOM objects.
+ * Global hashmap to associate internal SVG data types (e.g. SVGAnimatedLength)
+ * with DOM tear-off objects (e.g. DOMSVGLength). This allows us to always
+ * return the same object for subsequent requests for DOM objects.
  *
  * We don't keep an owning reference to the tear-off objects so they are
  * responsible for removing themselves from this table when they die.
  */
 template <class SimpleType, class TearoffType>
 class SVGAttrTearoffTable {
  public:
 #ifdef DEBUG
--- a/dom/svg/SVGAttrValueWrapper.cpp
+++ b/dom/svg/SVGAttrValueWrapper.cpp
@@ -1,24 +1,24 @@
 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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 "SVGAttrValueWrapper.h"
 
+#include "SVGAnimatedIntegerPair.h"
+#include "SVGAnimatedLength.h"
+#include "SVGAnimatedNumberPair.h"
+#include "SVGAnimatedOrient.h"
 #include "SVGAnimatedPreserveAspectRatio.h"
-#include "SVGAnimatedIntegerPair.h"
-#include "nsSVGLength2.h"
+#include "SVGAnimatedViewBox.h"
 #include "SVGLengthList.h"
-#include "SVGAnimatedNumberPair.h"
 #include "SVGNumberList.h"
-#include "SVGAnimatedOrient.h"
-#include "SVGAnimatedViewBox.h"
 #include "SVGPathData.h"
 #include "SVGPointList.h"
 #include "SVGStringList.h"
 #include "SVGTransformList.h"
 
 namespace mozilla {
 
 /*static*/
@@ -29,17 +29,17 @@ void SVGAttrValueWrapper::ToString(const
 
 /*static*/
 void SVGAttrValueWrapper::ToString(const SVGAnimatedIntegerPair* aIntegerPair,
                                    nsAString& aResult) {
   aIntegerPair->GetBaseValueString(aResult);
 }
 
 /*static*/
-void SVGAttrValueWrapper::ToString(const nsSVGLength2* aLength,
+void SVGAttrValueWrapper::ToString(const SVGAnimatedLength* aLength,
                                    nsAString& aResult) {
   aLength->GetBaseValueString(aResult);
 }
 
 /*static*/
 void SVGAttrValueWrapper::ToString(const SVGLengthList* aLengthList,
                                    nsAString& aResult) {
   aLengthList->GetValueAsString(aResult);
--- a/dom/svg/SVGAttrValueWrapper.h
+++ b/dom/svg/SVGAttrValueWrapper.h
@@ -9,47 +9,46 @@
 
 /**
  * Utility wrapper for handling SVG types used inside nsAttrValue so that these
  * types don't need to be exported outside the SVG module.
  */
 
 #include "nsString.h"
 
-class nsSVGLength2;
-
 namespace mozilla {
 class SVGAnimatedIntegerPair;
+class SVGAnimatedLength;
 class SVGAnimatedNumberPair;
 class SVGAnimatedOrient;
 class SVGAnimatedPreserveAspectRatio;
 class SVGAnimatedViewBox;
 class SVGLengthList;
 class SVGNumberList;
 class SVGPathData;
 class SVGPointList;
 class SVGStringList;
 class SVGTransformList;
 
 class SVGAttrValueWrapper {
  public:
   static void ToString(const SVGAnimatedIntegerPair* aIntegerPair,
                        nsAString& aResult);
+  static void ToString(const SVGAnimatedLength* aLength, nsAString& aResult);
   static void ToString(const SVGAnimatedNumberPair* aNumberPair,
                        nsAString& aResult);
   static void ToString(const SVGAnimatedOrient* aOrient, nsAString& aResult);
-  static void ToString(const nsSVGLength2* aLength, nsAString& aResult);
+  static void ToString(
+      const SVGAnimatedPreserveAspectRatio* aPreserveAspectRatio,
+      nsAString& aResult);
   static void ToString(const SVGAnimatedViewBox* aViewBox, nsAString& aResult);
   static void ToString(const SVGLengthList* aLengthList, nsAString& aResult);
   static void ToString(const SVGNumberList* aNumberList, nsAString& aResult);
   static void ToString(const SVGPathData* aPathData, nsAString& aResult);
   static void ToString(const SVGPointList* aPointList, nsAString& aResult);
-  static void ToString(
-      const SVGAnimatedPreserveAspectRatio* aPreserveAspectRatio,
-      nsAString& aResult);
   static void ToString(const SVGStringList* aStringList, nsAString& aResult);
   static void ToString(const SVGTransformList* aTransformList,
                        nsAString& aResult);
 };
 
 } /* namespace mozilla */
 
 #endif  // MOZILLA_SVGATTRVALUEWRAPPER_H__
--- a/dom/svg/SVGCircleElement.h
+++ b/dom/svg/SVGCircleElement.h
@@ -3,17 +3,17 @@
 /* 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_SVGCircleElement_h
 #define mozilla_dom_SVGCircleElement_h
 
 #include "SVGGeometryElement.h"
-#include "nsSVGLength2.h"
+#include "SVGAnimatedLength.h"
 
 nsresult NS_NewSVGCircleElement(
     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 namespace mozilla {
 namespace dom {
 
 typedef SVGGeometryElement SVGCircleElementBase;
@@ -45,16 +45,16 @@ class SVGCircleElement final : public SV
   already_AddRefed<DOMSVGAnimatedLength> Cx();
   already_AddRefed<DOMSVGAnimatedLength> Cy();
   already_AddRefed<DOMSVGAnimatedLength> R();
 
  protected:
   virtual LengthAttributesInfo GetLengthInfo() override;
 
   enum { ATTR_CX, ATTR_CY, ATTR_R };
-  nsSVGLength2 mLengthAttributes[3];
+  SVGAnimatedLength mLengthAttributes[3];
   static LengthInfo sLengthInfo[3];
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
 #endif  // mozilla_dom_SVGCircleElement_h
--- a/dom/svg/SVGComponentTransferFunctionElement.h
+++ b/dom/svg/SVGComponentTransferFunctionElement.h
@@ -2,20 +2,20 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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_SVGComponentTransferFunctionElement_h
 #define mozilla_dom_SVGComponentTransferFunctionElement_h
 
+#include "SVGAnimatedEnumeration.h"
+#include "SVGAnimatedNumber.h"
 #include "SVGAnimatedNumberList.h"
-#include "SVGAnimatedEnumeration.h"
 #include "SVGFilters.h"
-#include "nsSVGNumber2.h"
 
 #define NS_SVG_FE_COMPONENT_TRANSFER_FUNCTION_ELEMENT_CID \
   {                                                       \
     0xafab106d, 0xbc18, 0x4f7f, {                         \
       0x9e, 0x29, 0xfe, 0xb4, 0xb0, 0x16, 0x5f, 0xf4      \
     }                                                     \
   }
 
@@ -69,17 +69,17 @@ class SVGComponentTransferFunctionElemen
   virtual EnumAttributesInfo GetEnumInfo() override;
   virtual NumberListAttributesInfo GetNumberListInfo() override;
 
   enum { TABLEVALUES };
   SVGAnimatedNumberList mNumberListAttributes[1];
   static NumberListInfo sNumberListInfo[1];
 
   enum { SLOPE, INTERCEPT, AMPLITUDE, EXPONENT, OFFSET };
-  nsSVGNumber2 mNumberAttributes[5];
+  SVGAnimatedNumber mNumberAttributes[5];
   static NumberInfo sNumberInfo[5];
 
   enum { TYPE };
   SVGAnimatedEnumeration mEnumAttributes[1];
   static SVGEnumMapping sTypeMap[];
   static EnumInfo sEnumInfo[1];
 };
 
--- a/dom/svg/SVGElement.cpp
+++ b/dom/svg/SVGElement.cpp
@@ -42,18 +42,18 @@
 #include "SVGAnimatedLengthList.h"
 #include "SVGAnimatedPointList.h"
 #include "SVGAnimatedPathSegList.h"
 #include "SVGAnimatedTransformList.h"
 #include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedEnumeration.h"
 #include "SVGAnimatedInteger.h"
 #include "SVGAnimatedIntegerPair.h"
-#include "nsSVGLength2.h"
-#include "nsSVGNumber2.h"
+#include "SVGAnimatedLength.h"
+#include "SVGAnimatedNumber.h"
 #include "SVGAnimatedNumberPair.h"
 #include "SVGAnimatedOrient.h"
 #include "SVGAnimatedString.h"
 #include "SVGAnimatedViewBox.h"
 #include "SVGMotionSMILAttr.h"
 #include <stdarg.h>
 
 // This is needed to ensure correct handling of calls to the
@@ -296,17 +296,17 @@ bool SVGElement::ParseAttribute(int32_t 
                                 const nsAString& aValue,
                                 nsIPrincipal* aMaybeScriptedPrincipal,
                                 nsAttrValue& aResult) {
   nsresult rv = NS_OK;
   bool foundMatch = false;
   bool didSetResult = false;
 
   if (aNamespaceID == kNameSpaceID_None) {
-    // Check for nsSVGLength2 attribute
+    // Check for SVGAnimatedLength attribute
     LengthAttributesInfo lengthInfo = GetLengthInfo();
 
     uint32_t i;
     for (i = 0; i < lengthInfo.mLengthCount; i++) {
       if (aAttribute == lengthInfo.mLengthInfo[i].mName) {
         rv = lengthInfo.mLengths[i].SetBaseValueString(aValue, this, false);
         if (NS_FAILED(rv)) {
           lengthInfo.Reset(i);
@@ -385,17 +385,17 @@ bool SVGElement::ParseAttribute(int32_t 
           aResult.SetTo(segList->GetBaseValue(), &aValue);
           didSetResult = true;
           foundMatch = true;
         }
       }
     }
 
     if (!foundMatch) {
-      // Check for nsSVGNumber2 attribute
+      // Check for SVGAnimatedNumber attribute
       NumberAttributesInfo numberInfo = GetNumberInfo();
       for (i = 0; i < numberInfo.mNumberCount; i++) {
         if (aAttribute == numberInfo.mNumberInfo[i].mName) {
           rv = numberInfo.mNumbers[i].SetBaseValueString(aValue, this);
           if (NS_FAILED(rv)) {
             numberInfo.Reset(i);
           } else {
             aResult.SetTo(numberInfo.mNumbers[i].GetBaseValue(), &aValue);
@@ -1254,19 +1254,19 @@ nsAttrValue SVGElement::WillChangeValue(
 
   uint8_t modType =
       attrValue ? static_cast<uint8_t>(MutationEvent_Binding::MODIFICATION)
                 : static_cast<uint8_t>(MutationEvent_Binding::ADDITION);
   nsNodeUtils::AttributeWillChange(this, kNameSpaceID_None, aName, modType);
 
   // This is not strictly correct--the attribute value parameter for
   // BeforeSetAttr should reflect the value that *will* be set but that implies
-  // allocating, e.g. an extra nsSVGLength2, and isn't necessary at the moment
-  // since no SVG elements overload BeforeSetAttr. For now we just pass the
-  // current value.
+  // allocating, e.g. an extra SVGAnimatedLength, and isn't necessary at the
+  // moment since no SVG elements overload BeforeSetAttr. For now we just pass
+  // the current value.
   nsAttrValueOrString attrStringOrValue(attrValue ? *attrValue
                                                   : emptyOrOldAttrValue);
   DebugOnly<nsresult> rv = BeforeSetAttr(
       kNameSpaceID_None, aName, &attrStringOrValue, kNotifyDocumentObservers);
   // SVG elements aren't expected to overload BeforeSetAttr in such a way that
   // it may fail. So long as this is the case we don't need to check and pass on
   // the return value which simplifies the calling code significantly.
   MOZ_ASSERT(NS_SUCCEEDED(rv), "Unexpected failure from BeforeSetAttr");
@@ -1354,17 +1354,17 @@ SVGElement::LengthAttributesInfo SVGElem
 }
 
 void SVGElement::LengthAttributesInfo::Reset(uint8_t aAttrEnum) {
   mLengths[aAttrEnum].Init(mLengthInfo[aAttrEnum].mCtxType, aAttrEnum,
                            mLengthInfo[aAttrEnum].mDefaultValue,
                            mLengthInfo[aAttrEnum].mDefaultUnitType);
 }
 
-void SVGElement::SetLength(nsAtom* aName, const nsSVGLength2& aLength) {
+void SVGElement::SetLength(nsAtom* aName, const SVGAnimatedLength& aLength) {
   LengthAttributesInfo lengthInfo = GetLengthInfo();
 
   for (uint32_t i = 0; i < lengthInfo.mLengthCount; i++) {
     if (aName == lengthInfo.mLengthInfo[i].mName) {
       lengthInfo.mLengths[i] = aLength;
       DidAnimateLength(i);
       return;
     }
@@ -1398,17 +1398,17 @@ void SVGElement::DidAnimateLength(uint8_
   if (frame) {
     LengthAttributesInfo info = GetLengthInfo();
     frame->AttributeChanged(kNameSpaceID_None,
                             info.mLengthInfo[aAttrEnum].mName,
                             MutationEvent_Binding::SMIL);
   }
 }
 
-nsSVGLength2* SVGElement::GetAnimatedLength(const nsAtom* aAttrName) {
+SVGAnimatedLength* SVGElement::GetAnimatedLength(const nsAtom* aAttrName) {
   LengthAttributesInfo lengthInfo = GetLengthInfo();
 
   for (uint32_t i = 0; i < lengthInfo.mLengthCount; i++) {
     if (aAttrName == lengthInfo.mLengthInfo[i].mName) {
       return &lengthInfo.mLengths[i];
     }
   }
   MOZ_ASSERT(false, "no matching length found");
--- a/dom/svg/SVGElement.h
+++ b/dom/svg/SVGElement.h
@@ -22,31 +22,30 @@
 #include "nsAutoPtr.h"
 #include "nsChangeHint.h"
 #include "nsCycleCollectionParticipant.h"
 #include "nsError.h"
 #include "nsISupportsImpl.h"
 #include "nsStyledElement.h"
 #include "gfxMatrix.h"
 
-class nsSVGLength2;
-class nsSVGNumber2;
-
 nsresult NS_NewSVGElement(mozilla::dom::Element** aResult,
                           already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 namespace mozilla {
 class DeclarationBlock;
 
 class DOMSVGStringList;
 class SVGAnimatedBoolean;
 class SVGAnimatedEnumeration;
 class SVGAnimatedInteger;
 class SVGAnimatedIntegerPair;
+class SVGAnimatedLength;
 class SVGAnimatedLengthList;
+class SVGAnimatedNumber;
 class SVGAnimatedNumberList;
 class SVGAnimatedNumberPair;
 class SVGAnimatedOrient;
 class SVGAnimatedPathSegList;
 class SVGAnimatedPointList;
 class SVGAnimatedString;
 class SVGAnimatedPreserveAspectRatio;
 class SVGAnimatedTransformList;
@@ -159,17 +158,17 @@ class SVGElement : public SVGElementBase
 
   bool IsStringAnimatable(uint8_t aAttrEnum) {
     return GetStringInfo().mStringInfo[aAttrEnum].mIsAnimatable;
   }
   bool NumberAttrAllowsPercentage(uint8_t aAttrEnum) {
     return GetNumberInfo().mNumberInfo[aAttrEnum].mPercentagesAllowed;
   }
   virtual bool HasValidDimensions() const { return true; }
-  void SetLength(nsAtom* aName, const nsSVGLength2& aLength);
+  void SetLength(nsAtom* aName, const SVGAnimatedLength& aLength);
 
   nsAttrValue WillChangeLength(uint8_t aAttrEnum);
   nsAttrValue WillChangeNumberPair(uint8_t aAttrEnum);
   nsAttrValue WillChangeIntegerPair(uint8_t aAttrEnum);
   nsAttrValue WillChangeOrient();
   nsAttrValue WillChangeViewBox();
   nsAttrValue WillChangePreserveAspectRatio();
   nsAttrValue WillChangeNumberList(uint8_t aAttrEnum);
@@ -226,17 +225,17 @@ class SVGElement : public SVGElementBase
      * Flag to indicate to GetAnimatedXxx() methods that the object being
      * requested should be allocated if it hasn't already been allocated, and
      * that the method should not return null. Only applicable to methods that
      * need to allocate the object that they return.
      */
     DO_ALLOCATE = 0x1
   };
 
-  nsSVGLength2* GetAnimatedLength(const nsAtom* aAttrName);
+  SVGAnimatedLength* GetAnimatedLength(const nsAtom* aAttrName);
   void GetAnimatedLengthValues(float* aFirst, ...);
   void GetAnimatedNumberValues(float* aFirst, ...);
   void GetAnimatedIntegerValues(int32_t* aFirst, ...);
   SVGAnimatedNumberList* GetAnimatedNumberList(uint8_t aAttrEnum);
   SVGAnimatedNumberList* GetAnimatedNumberList(nsAtom* aAttrName);
   void GetAnimatedLengthListValues(SVGUserUnitList* aFirst, ...);
   SVGAnimatedLengthList* GetAnimatedLengthList(uint8_t aAttrEnum);
   virtual SVGAnimatedPointList* GetAnimatedPointList() { return nullptr; }
@@ -331,41 +330,41 @@ class SVGElement : public SVGElementBase
   struct LengthInfo {
     nsStaticAtom* const mName;
     const float mDefaultValue;
     const uint8_t mDefaultUnitType;
     const uint8_t mCtxType;
   };
 
   struct LengthAttributesInfo {
-    nsSVGLength2* const mLengths;
+    SVGAnimatedLength* const mLengths;
     const LengthInfo* const mLengthInfo;
     const uint32_t mLengthCount;
 
-    LengthAttributesInfo(nsSVGLength2* aLengths, LengthInfo* aLengthInfo,
+    LengthAttributesInfo(SVGAnimatedLength* aLengths, LengthInfo* aLengthInfo,
                          uint32_t aLengthCount)
         : mLengths(aLengths),
           mLengthInfo(aLengthInfo),
           mLengthCount(aLengthCount) {}
 
     void Reset(uint8_t aAttrEnum);
   };
 
   struct NumberInfo {
     nsStaticAtom* const mName;
     const float mDefaultValue;
     const bool mPercentagesAllowed;
   };
 
   struct NumberAttributesInfo {
-    nsSVGNumber2* const mNumbers;
+    SVGAnimatedNumber* const mNumbers;
     const NumberInfo* const mNumberInfo;
     const uint32_t mNumberCount;
 
-    NumberAttributesInfo(nsSVGNumber2* aNumbers, NumberInfo* aNumberInfo,
+    NumberAttributesInfo(SVGAnimatedNumber* aNumbers, NumberInfo* aNumberInfo,
                          uint32_t aNumberCount)
         : mNumbers(aNumbers),
           mNumberInfo(aNumberInfo),
           mNumberCount(aNumberCount) {}
 
     void Reset(uint8_t aAttrEnum);
   };
 
--- a/dom/svg/SVGEllipseElement.h
+++ b/dom/svg/SVGEllipseElement.h
@@ -2,18 +2,18 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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_SVGEllipseElement_h
 #define mozilla_dom_SVGEllipseElement_h
 
+#include "SVGAnimatedLength.h"
 #include "SVGGeometryElement.h"
-#include "nsSVGLength2.h"
 
 nsresult NS_NewSVGEllipseElement(
     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 namespace mozilla {
 namespace dom {
 
 typedef SVGGeometryElement SVGEllipseElementBase;
@@ -46,16 +46,16 @@ class SVGEllipseElement final : public S
   already_AddRefed<DOMSVGAnimatedLength> Cy();
   already_AddRefed<DOMSVGAnimatedLength> Rx();
   already_AddRefed<DOMSVGAnimatedLength> Ry();
 
  protected:
   virtual LengthAttributesInfo GetLengthInfo() override;
 
   enum { CX, CY, RX, RY };
-  nsSVGLength2 mLengthAttributes[4];
+  SVGAnimatedLength mLengthAttributes[4];
   static LengthInfo sLengthInfo[4];
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
 #endif  // mozilla_dom_SVGEllipseElement_h
--- a/dom/svg/SVGFECompositeElement.h
+++ b/dom/svg/SVGFECompositeElement.h
@@ -3,18 +3,18 @@
 /* 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_SVGFECompositeElement_h
 #define mozilla_dom_SVGFECompositeElement_h
 
 #include "SVGAnimatedEnumeration.h"
+#include "SVGAnimatedNumber.h"
 #include "SVGFilters.h"
-#include "nsSVGNumber2.h"
 
 nsresult NS_NewSVGFECompositeElement(
     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 namespace mozilla {
 namespace dom {
 
 typedef SVGFE SVGFECompositeElementBase;
@@ -56,17 +56,17 @@ class SVGFECompositeElement : public SVG
   void SetK(float k1, float k2, float k3, float k4);
 
  protected:
   virtual NumberAttributesInfo GetNumberInfo() override;
   virtual EnumAttributesInfo GetEnumInfo() override;
   virtual StringAttributesInfo GetStringInfo() override;
 
   enum { ATTR_K1, ATTR_K2, ATTR_K3, ATTR_K4 };
-  nsSVGNumber2 mNumberAttributes[4];
+  SVGAnimatedNumber mNumberAttributes[4];
   static NumberInfo sNumberInfo[4];
 
   enum { OPERATOR };
   SVGAnimatedEnumeration mEnumAttributes[1];
   static SVGEnumMapping sOperatorMap[];
   static EnumInfo sEnumInfo[1];
 
   enum { RESULT, IN1, IN2 };
--- a/dom/svg/SVGFEConvolveMatrixElement.h
+++ b/dom/svg/SVGFEConvolveMatrixElement.h
@@ -7,20 +7,19 @@
 #ifndef mozilla_dom_SVGFEConvolveMatrixElement_h
 #define mozilla_dom_SVGFEConvolveMatrixElement_h
 
 #include "DOMSVGAnimatedNumberList.h"
 #include "SVGAnimatedBoolean.h"
 #include "SVGAnimatedEnumeration.h"
 #include "SVGAnimatedInteger.h"
 #include "SVGAnimatedIntegerPair.h"
+#include "SVGAnimatedNumber.h"
 #include "SVGAnimatedNumberList.h"
-#include "nsSVGNumber2.h"
 #include "SVGAnimatedString.h"
-#include "SVGAnimatedNumberList.h"
 #include "SVGFilters.h"
 
 nsresult NS_NewSVGFEConvolveMatrixElement(
     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 namespace mozilla {
 
 namespace dom {
@@ -75,17 +74,17 @@ class SVGFEConvolveMatrixElement : publi
   virtual IntegerAttributesInfo GetIntegerInfo() override;
   virtual IntegerPairAttributesInfo GetIntegerPairInfo() override;
   virtual BooleanAttributesInfo GetBooleanInfo() override;
   virtual EnumAttributesInfo GetEnumInfo() override;
   virtual StringAttributesInfo GetStringInfo() override;
   virtual NumberListAttributesInfo GetNumberListInfo() override;
 
   enum { DIVISOR, BIAS };
-  nsSVGNumber2 mNumberAttributes[2];
+  SVGAnimatedNumber mNumberAttributes[2];
   static NumberInfo sNumberInfo[2];
 
   enum { KERNEL_UNIT_LENGTH };
   SVGAnimatedNumberPair mNumberPairAttributes[1];
   static NumberPairInfo sNumberPairInfo[1];
 
   enum { TARGET_X, TARGET_Y };
   SVGAnimatedInteger mIntegerAttributes[2];
--- a/dom/svg/SVGFEDisplacementMapElement.h
+++ b/dom/svg/SVGFEDisplacementMapElement.h
@@ -65,17 +65,17 @@ class SVGFEDisplacementMapElement : publ
     }
   }
 
   virtual NumberAttributesInfo GetNumberInfo() override;
   virtual EnumAttributesInfo GetEnumInfo() override;
   virtual StringAttributesInfo GetStringInfo() override;
 
   enum { SCALE };
-  nsSVGNumber2 mNumberAttributes[1];
+  SVGAnimatedNumber mNumberAttributes[1];
   static NumberInfo sNumberInfo[1];
 
   enum { CHANNEL_X, CHANNEL_Y };
   SVGAnimatedEnumeration mEnumAttributes[2];
   static SVGEnumMapping sChannelMap[];
   static EnumInfo sEnumInfo[2];
 
   enum { RESULT, IN1, IN2 };
--- a/dom/svg/SVGFEDistantLightElement.h
+++ b/dom/svg/SVGFEDistantLightElement.h
@@ -2,18 +2,18 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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_SVGFEDistantLightElement_h
 #define mozilla_dom_SVGFEDistantLightElement_h
 
+#include "SVGAnimatedNumber.h"
 #include "SVGFilters.h"
-#include "nsSVGNumber2.h"
 
 nsresult NS_NewSVGFEDistantLightElement(
     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 namespace mozilla {
 namespace dom {
 
 typedef SVGFELightElement SVGFEDistantLightElementBase;
@@ -42,16 +42,16 @@ class SVGFEDistantLightElement : public 
   // WebIDL
   already_AddRefed<DOMSVGAnimatedNumber> Azimuth();
   already_AddRefed<DOMSVGAnimatedNumber> Elevation();
 
  protected:
   virtual NumberAttributesInfo GetNumberInfo() override;
 
   enum { AZIMUTH, ELEVATION };
-  nsSVGNumber2 mNumberAttributes[2];
+  SVGAnimatedNumber mNumberAttributes[2];
   static NumberInfo sNumberInfo[2];
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
 #endif  // mozilla_dom_SVGFEDistantLightElement_h
--- a/dom/svg/SVGFEDropShadowElement.h
+++ b/dom/svg/SVGFEDropShadowElement.h
@@ -2,17 +2,17 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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_SVGFEDropShadowElement_h
 #define mozilla_dom_SVGFEDropShadowElement_h
 
-#include "nsSVGNumber2.h"
+#include "SVGAnimatedNumber.h"
 #include "SVGAnimatedNumberPair.h"
 #include "SVGAnimatedString.h"
 #include "SVGFilters.h"
 
 nsresult NS_NewSVGFEDropShadowElement(
     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 namespace mozilla {
@@ -58,17 +58,17 @@ class SVGFEDropShadowElement : public SV
   void SetStdDeviation(float stdDeviationX, float stdDeviationY);
 
  protected:
   virtual NumberAttributesInfo GetNumberInfo() override;
   virtual NumberPairAttributesInfo GetNumberPairInfo() override;
   virtual StringAttributesInfo GetStringInfo() override;
 
   enum { DX, DY };
-  nsSVGNumber2 mNumberAttributes[2];
+  SVGAnimatedNumber mNumberAttributes[2];
   static NumberInfo sNumberInfo[2];
 
   enum { STD_DEV };
   SVGAnimatedNumberPair mNumberPairAttributes[1];
   static NumberPairInfo sNumberPairInfo[1];
 
   enum { RESULT, IN1 };
   SVGAnimatedString mStringAttributes[2];
--- a/dom/svg/SVGFEOffsetElement.h
+++ b/dom/svg/SVGFEOffsetElement.h
@@ -2,17 +2,17 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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_SVGFEOffsetElement_h
 #define mozilla_dom_SVGFEOffsetElement_h
 
-#include "nsSVGNumber2.h"
+#include "SVGAnimatedNumber.h"
 #include "SVGAnimatedString.h"
 #include "SVGFilters.h"
 
 nsresult NS_NewSVGFEOffsetElement(
     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 namespace mozilla {
 namespace dom {
@@ -50,17 +50,17 @@ class SVGFEOffsetElement : public SVGFEO
   already_AddRefed<DOMSVGAnimatedNumber> Dx();
   already_AddRefed<DOMSVGAnimatedNumber> Dy();
 
  protected:
   virtual NumberAttributesInfo GetNumberInfo() override;
   virtual StringAttributesInfo GetStringInfo() override;
 
   enum { DX, DY };
-  nsSVGNumber2 mNumberAttributes[2];
+  SVGAnimatedNumber mNumberAttributes[2];
   static NumberInfo sNumberInfo[2];
 
   enum { RESULT, IN1 };
   SVGAnimatedString mStringAttributes[2];
   static StringInfo sStringInfo[2];
 };
 
 }  // namespace dom
--- a/dom/svg/SVGFEPointLightElement.h
+++ b/dom/svg/SVGFEPointLightElement.h
@@ -2,18 +2,18 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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_SVGFEPointLightElement_h
 #define mozilla_dom_SVGFEPointLightElement_h
 
+#include "SVGAnimatedNumber.h"
 #include "SVGFilters.h"
-#include "nsSVGNumber2.h"
 
 nsresult NS_NewSVGFEPointLightElement(
     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 namespace mozilla {
 namespace dom {
 
 typedef SVGFELightElement SVGFEPointLightElementBase;
@@ -43,16 +43,16 @@ class SVGFEPointLightElement : public SV
   already_AddRefed<DOMSVGAnimatedNumber> X();
   already_AddRefed<DOMSVGAnimatedNumber> Y();
   already_AddRefed<DOMSVGAnimatedNumber> Z();
 
  protected:
   virtual NumberAttributesInfo GetNumberInfo() override;
 
   enum { ATTR_X, ATTR_Y, ATTR_Z };
-  nsSVGNumber2 mNumberAttributes[3];
+  SVGAnimatedNumber mNumberAttributes[3];
   static NumberInfo sNumberInfo[3];
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
 #endif  // mozilla_dom_SVGFEPointLightElement_h
--- a/dom/svg/SVGFESpotLightElement.h
+++ b/dom/svg/SVGFESpotLightElement.h
@@ -2,18 +2,18 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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_SVGFESpotLightElement_h
 #define mozilla_dom_SVGFESpotLightElement_h
 
+#include "SVGAnimatedNumber.h"
 #include "SVGFilters.h"
-#include "nsSVGNumber2.h"
 
 nsresult NS_NewSVGFESpotLightElement(
     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 namespace mozilla {
 namespace dom {
 
 typedef SVGFELightElement SVGFESpotLightElementBase;
@@ -58,16 +58,16 @@ class SVGFESpotLightElement : public SVG
     ATTR_Y,
     ATTR_Z,
     POINTS_AT_X,
     POINTS_AT_Y,
     POINTS_AT_Z,
     SPECULAR_EXPONENT,
     LIMITING_CONE_ANGLE
   };
-  nsSVGNumber2 mNumberAttributes[8];
+  SVGAnimatedNumber mNumberAttributes[8];
   static NumberInfo sNumberInfo[8];
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
 #endif  // mozilla_dom_SVGFESpotLightElement_h
--- a/dom/svg/SVGFETurbulenceElement.h
+++ b/dom/svg/SVGFETurbulenceElement.h
@@ -4,17 +4,17 @@
  * 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_SVGFETurbulenceElement_h
 #define mozilla_dom_SVGFETurbulenceElement_h
 
 #include "SVGAnimatedEnumeration.h"
 #include "SVGAnimatedInteger.h"
-#include "nsSVGNumber2.h"
+#include "SVGAnimatedNumber.h"
 #include "SVGAnimatedString.h"
 #include "SVGFilters.h"
 
 nsresult NS_NewSVGFETurbulenceElement(
     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 namespace mozilla {
 namespace dom {
@@ -59,17 +59,17 @@ class SVGFETurbulenceElement : public SV
  protected:
   virtual NumberAttributesInfo GetNumberInfo() override;
   virtual NumberPairAttributesInfo GetNumberPairInfo() override;
   virtual IntegerAttributesInfo GetIntegerInfo() override;
   virtual EnumAttributesInfo GetEnumInfo() override;
   virtual StringAttributesInfo GetStringInfo() override;
 
   enum { SEED };  // floating point seed?!
-  nsSVGNumber2 mNumberAttributes[1];
+  SVGAnimatedNumber mNumberAttributes[1];
   static NumberInfo sNumberInfo[1];
 
   enum { BASE_FREQ };
   SVGAnimatedNumberPair mNumberPairAttributes[1];
   static NumberPairInfo sNumberPairInfo[1];
 
   enum { OCTAVES };
   SVGAnimatedInteger mIntegerAttributes[1];
--- a/dom/svg/SVGFilterElement.h
+++ b/dom/svg/SVGFilterElement.h
@@ -3,17 +3,17 @@
 /* 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_SVGFilterElement_h
 #define mozilla_dom_SVGFilterElement_h
 
 #include "SVGAnimatedEnumeration.h"
-#include "nsSVGLength2.h"
+#include "SVGAnimatedLength.h"
 #include "SVGAnimatedString.h"
 #include "mozilla/dom/SVGElement.h"
 
 class nsSVGFilterFrame;
 class nsSVGFilterInstance;
 
 nsresult NS_NewSVGFilterElement(
     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
@@ -55,17 +55,17 @@ class SVGFilterElement : public SVGFilte
   already_AddRefed<DOMSVGAnimatedString> Href();
 
  protected:
   virtual LengthAttributesInfo GetLengthInfo() override;
   virtual EnumAttributesInfo GetEnumInfo() override;
   virtual StringAttributesInfo GetStringInfo() override;
 
   enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT };
-  nsSVGLength2 mLengthAttributes[4];
+  SVGAnimatedLength mLengthAttributes[4];
   static LengthInfo sLengthInfo[4];
 
   enum { FILTERUNITS, PRIMITIVEUNITS };
   SVGAnimatedEnumeration mEnumAttributes[2];
   static EnumInfo sEnumInfo[2];
 
   enum { HREF, XLINK_HREF };
   SVGAnimatedString mStringAttributes[2];
--- a/dom/svg/SVGFilters.h
+++ b/dom/svg/SVGFilters.h
@@ -6,20 +6,20 @@
 
 #ifndef __NS_SVGFILTERSELEMENT_H__
 #define __NS_SVGFILTERSELEMENT_H__
 
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/SVGElement.h"
 #include "FilterSupport.h"
 #include "nsImageLoadingContent.h"
+#include "SVGAnimatedLength.h"
+#include "SVGAnimatedNumber.h"
+#include "SVGAnimatedNumberPair.h"
 #include "SVGAnimatedString.h"
-#include "nsSVGLength2.h"
-#include "nsSVGNumber2.h"
-#include "SVGAnimatedNumberPair.h"
 
 class nsSVGFilterInstance;
 
 namespace mozilla {
 namespace dom {
 
 struct SVGStringInfo {
   SVGStringInfo(const SVGAnimatedString* aString, SVGElement* aElement)
@@ -144,17 +144,17 @@ class SVGFE : public SVGFEBase {
 
   // SVGElement specializations:
   virtual LengthAttributesInfo GetLengthInfo() override;
 
   Size GetKernelUnitLength(nsSVGFilterInstance* aInstance,
                            SVGAnimatedNumberPair* aKernelUnitLength);
 
   enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT };
-  nsSVGLength2 mLengthAttributes[4];
+  SVGAnimatedLength mLengthAttributes[4];
   static LengthInfo sLengthInfo[4];
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(SVGFE, NS_SVG_FE_CID)
 
 typedef SVGElement SVGFEUnstyledElementBase;
 
 class SVGFEUnstyledElement : public SVGFEUnstyledElementBase {
@@ -216,17 +216,17 @@ class SVGFELightingElement : public SVGF
       nsSVGFilterInstance* aInstance);
 
   enum {
     SURFACE_SCALE,
     DIFFUSE_CONSTANT,
     SPECULAR_CONSTANT,
     SPECULAR_EXPONENT
   };
-  nsSVGNumber2 mNumberAttributes[4];
+  SVGAnimatedNumber mNumberAttributes[4];
   static NumberInfo sNumberInfo[4];
 
   enum { KERNEL_UNIT_LENGTH };
   SVGAnimatedNumberPair mNumberPairAttributes[1];
   static NumberPairInfo sNumberPairInfo[1];
 
   enum { RESULT, IN1 };
   SVGAnimatedString mStringAttributes[2];
--- a/dom/svg/SVGForeignObjectElement.h
+++ b/dom/svg/SVGForeignObjectElement.h
@@ -3,17 +3,17 @@
 /* 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 "nsSVGLength2.h"
+#include "SVGAnimatedLength.h"
 
 nsresult NS_NewSVGForeignObjectElement(
     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 class nsSVGForeignObjectFrame;
 
 namespace mozilla {
 namespace dom {
@@ -47,16 +47,16 @@ class SVGForeignObjectElement final : pu
   already_AddRefed<DOMSVGAnimatedLength> Y();
   already_AddRefed<DOMSVGAnimatedLength> Width();
   already_AddRefed<DOMSVGAnimatedLength> Height();
 
  protected:
   virtual LengthAttributesInfo GetLengthInfo() override;
 
   enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT };
-  nsSVGLength2 mLengthAttributes[4];
+  SVGAnimatedLength mLengthAttributes[4];
   static LengthInfo sLengthInfo[4];
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
 #endif  // mozilla_dom_SVGForeignObjectElement_h
--- a/dom/svg/SVGGeometryElement.cpp
+++ b/dom/svg/SVGGeometryElement.cpp
@@ -5,17 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "SVGGeometryElement.h"
 
 #include "DOMSVGPoint.h"
 #include "gfxPlatform.h"
 #include "nsCOMPtr.h"
 #include "nsComputedDOMStyle.h"
-#include "nsSVGLength2.h"
+#include "SVGAnimatedLength.h"
 #include "nsSVGUtils.h"
 #include "mozilla/dom/SVGLengthBinding.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/SVGContentUtils.h"
 
 using namespace mozilla;
 using namespace mozilla::gfx;
@@ -52,29 +52,29 @@ bool SVGGeometryElement::IsNodeOfType(ui
   return !(aFlags & ~eSHAPE);
 }
 
 bool SVGGeometryElement::AttributeDefinesGeometry(const nsAtom* aName) {
   if (aName == nsGkAtoms::pathLength) {
     return true;
   }
 
-  // Check for nsSVGLength2 attribute
+  // Check for SVGAnimatedLength attribute
   LengthAttributesInfo info = GetLengthInfo();
   for (uint32_t i = 0; i < info.mLengthCount; i++) {
     if (aName == info.mLengthInfo[i].mName) {
       return true;
     }
   }
 
   return false;
 }
 
 bool SVGGeometryElement::GeometryDependsOnCoordCtx() {
-  // Check the nsSVGLength2 attribute
+  // Check the SVGAnimatedLength attribute
   LengthAttributesInfo info =
       const_cast<SVGGeometryElement*>(this)->GetLengthInfo();
   for (uint32_t i = 0; i < info.mLengthCount; i++) {
     if (info.mLengths[i].GetSpecifiedUnitType() ==
         SVGLength_Binding::SVG_LENGTHTYPE_PERCENTAGE) {
       return true;
     }
   }
--- a/dom/svg/SVGGeometryElement.h
+++ b/dom/svg/SVGGeometryElement.h
@@ -2,20 +2,20 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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_SVGGeometryElement_h
 #define mozilla_dom_SVGGeometryElement_h
 
+#include "mozilla/dom/SVGGraphicsElement.h"
 #include "mozilla/gfx/2D.h"
-#include "SVGGraphicsElement.h"
+#include "SVGAnimatedNumber.h"
 #include "nsISVGPoint.h"
-#include "nsSVGNumber2.h"
 
 namespace mozilla {
 
 struct SVGMark {
   enum Type {
     eStart,
     eMid,
     eEnd,
@@ -212,17 +212,17 @@ class SVGGeometryElement : public SVGGeo
   float GetTotalLength();
   already_AddRefed<nsISVGPoint> GetPointAtLength(float distance,
                                                  ErrorResult& rv);
 
  protected:
   // SVGElement method
   virtual NumberAttributesInfo GetNumberInfo() override;
 
-  nsSVGNumber2 mPathLength;
+  SVGAnimatedNumber mPathLength;
   static NumberInfo sNumberInfo;
   mutable RefPtr<Path> mCachedPath;
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
 #endif  // mozilla_dom_SVGGeometryElement_h
--- a/dom/svg/SVGGradientElement.h
+++ b/dom/svg/SVGGradientElement.h
@@ -4,17 +4,17 @@
  * 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_SVGGRADIENTELEMENT_H__
 #define __NS_SVGGRADIENTELEMENT_H__
 
 #include "nsAutoPtr.h"
 #include "SVGAnimatedEnumeration.h"
-#include "nsSVGLength2.h"
+#include "SVGAnimatedLength.h"
 #include "SVGAnimatedString.h"
 #include "SVGAnimatedTransformList.h"
 #include "mozilla/dom/SVGElement.h"
 
 class nsSVGGradientFrame;
 class nsSVGLinearGradientFrame;
 class nsSVGRadialGradientFrame;
 
@@ -100,17 +100,17 @@ class SVGLinearGradientElement : public 
   already_AddRefed<DOMSVGAnimatedLength> Y1();
   already_AddRefed<DOMSVGAnimatedLength> X2();
   already_AddRefed<DOMSVGAnimatedLength> Y2();
 
  protected:
   virtual LengthAttributesInfo GetLengthInfo() override;
 
   enum { ATTR_X1, ATTR_Y1, ATTR_X2, ATTR_Y2 };
-  nsSVGLength2 mLengthAttributes[4];
+  SVGAnimatedLength mLengthAttributes[4];
   static LengthInfo sLengthInfo[4];
 };
 
 //-------------------------- Radial Gradients ----------------------------
 
 typedef SVGGradientElement SVGRadialGradientElementBase;
 
 class SVGRadialGradientElement : public SVGRadialGradientElementBase {
@@ -135,16 +135,16 @@ class SVGRadialGradientElement : public 
   already_AddRefed<DOMSVGAnimatedLength> Fx();
   already_AddRefed<DOMSVGAnimatedLength> Fy();
   already_AddRefed<DOMSVGAnimatedLength> Fr();
 
  protected:
   virtual LengthAttributesInfo GetLengthInfo() override;
 
   enum { ATTR_CX, ATTR_CY, ATTR_R, ATTR_FX, ATTR_FY, ATTR_FR };
-  nsSVGLength2 mLengthAttributes[6];
+  SVGAnimatedLength mLengthAttributes[6];
   static LengthInfo sLengthInfo[6];
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
 #endif
--- a/dom/svg/SVGImageElement.h
+++ b/dom/svg/SVGImageElement.h
@@ -3,17 +3,17 @@
 /* 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_SVGImageElement_h
 #define mozilla_dom_SVGImageElement_h
 
 #include "nsImageLoadingContent.h"
-#include "nsSVGLength2.h"
+#include "SVGAnimatedLength.h"
 #include "SVGAnimatedString.h"
 #include "SVGGeometryElement.h"
 #include "SVGAnimatedPreserveAspectRatio.h"
 
 nsresult NS_NewSVGImageElement(
     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 class nsSVGImageFrame;
@@ -101,17 +101,17 @@ class SVGImageElement : public SVGImageE
   virtual LengthAttributesInfo GetLengthInfo() override;
   virtual SVGAnimatedPreserveAspectRatio* GetPreserveAspectRatio() override;
   virtual StringAttributesInfo GetStringInfo() override;
 
   // Override for nsImageLoadingContent.
   nsIContent* AsContent() override { return this; }
 
   enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT };
-  nsSVGLength2 mLengthAttributes[4];
+  SVGAnimatedLength mLengthAttributes[4];
   static LengthInfo sLengthInfo[4];
 
   SVGAnimatedPreserveAspectRatio mPreserveAspectRatio;
 
   enum { HREF, XLINK_HREF };
   SVGAnimatedString mStringAttributes[2];
   static StringInfo sStringInfo[2];
 };
--- a/dom/svg/SVGLength.h
+++ b/dom/svg/SVGLength.h
@@ -15,17 +15,18 @@
 namespace mozilla {
 
 namespace dom {
 class SVGElement;
 }
 
 /**
  * This SVGLength class is currently used for SVGLength *list* attributes only.
- * The class that is currently used for <length> attributes is nsSVGLength2.
+ * The class that is currently used for <length> attributes is
+ * SVGAnimatedLength.
  *
  * The member mUnit should always be valid, but the member mValue may be
  * numeric_limits<float>::quiet_NaN() under one circumstances (see the comment
  * in SetValueAndUnit below). Even if mValue is valid, some methods may return
  * numeric_limits<float>::quiet_NaN() if they involve a unit conversion that
  * fails - see comments below.
  *
  * The DOM wrapper class for this class is DOMSVGLength.
--- a/dom/svg/SVGLineElement.h
+++ b/dom/svg/SVGLineElement.h
@@ -2,18 +2,18 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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_SVGLineElement_h
 #define mozilla_dom_SVGLineElement_h
 
+#include "SVGAnimatedLength.h"
 #include "SVGGeometryElement.h"
-#include "nsSVGLength2.h"
 
 nsresult NS_NewSVGLineElement(
     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 namespace mozilla {
 namespace dom {
 
 typedef SVGGeometryElement SVGLineElementBase;
@@ -52,16 +52,16 @@ class SVGLineElement final : public SVGL
   already_AddRefed<DOMSVGAnimatedLength> Y1();
   already_AddRefed<DOMSVGAnimatedLength> X2();
   already_AddRefed<DOMSVGAnimatedLength> Y2();
 
  protected:
   virtual LengthAttributesInfo GetLengthInfo() override;
 
   enum { ATTR_X1, ATTR_Y1, ATTR_X2, ATTR_Y2 };
-  nsSVGLength2 mLengthAttributes[4];
+  SVGAnimatedLength mLengthAttributes[4];
   static LengthInfo sLengthInfo[4];
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
 #endif  // mozilla_dom_SVGLineElement_h
--- a/dom/svg/SVGMarkerElement.h
+++ b/dom/svg/SVGMarkerElement.h
@@ -6,17 +6,17 @@
 
 #ifndef mozilla_dom_SVGMarkerElement_h
 #define mozilla_dom_SVGMarkerElement_h
 
 #include "DOMSVGAnimatedAngle.h"
 #include "DOMSVGAnimatedEnumeration.h"
 #include "nsAutoPtr.h"
 #include "SVGAnimatedEnumeration.h"
-#include "nsSVGLength2.h"
+#include "SVGAnimatedLength.h"
 #include "SVGAnimatedOrient.h"
 #include "SVGAnimatedPreserveAspectRatio.h"
 #include "SVGAnimatedViewBox.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/SVGElement.h"
 #include "mozilla/dom/SVGMarkerElementBinding.h"
 
 class nsSVGMarkerFrame;
@@ -79,17 +79,17 @@ class SVGMarkerElement : public SVGMarke
 
   virtual LengthAttributesInfo GetLengthInfo() override;
   virtual EnumAttributesInfo GetEnumInfo() override;
   virtual SVGAnimatedOrient* GetOrient() override;
   virtual SVGAnimatedPreserveAspectRatio* GetPreserveAspectRatio() override;
   virtual SVGAnimatedViewBox* GetViewBox() override;
 
   enum { REFX, REFY, MARKERWIDTH, MARKERHEIGHT };
-  nsSVGLength2 mLengthAttributes[4];
+  SVGAnimatedLength mLengthAttributes[4];
   static LengthInfo sLengthInfo[4];
 
   enum { MARKERUNITS };
   SVGAnimatedEnumeration mEnumAttributes[1];
   static SVGEnumMapping sUnitsMap[];
   static EnumInfo sEnumInfo[1];
 
   SVGAnimatedOrient mOrient;
--- a/dom/svg/SVGMaskElement.h
+++ b/dom/svg/SVGMaskElement.h
@@ -3,17 +3,17 @@
 /* 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_SVGMaskElement_h
 #define mozilla_dom_SVGMaskElement_h
 
 #include "SVGAnimatedEnumeration.h"
-#include "nsSVGLength2.h"
+#include "SVGAnimatedLength.h"
 #include "mozilla/dom/SVGElement.h"
 
 class nsSVGMaskFrame;
 
 nsresult NS_NewSVGMaskElement(
     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 namespace mozilla {
@@ -50,17 +50,17 @@ class SVGMaskElement final : public SVGM
   already_AddRefed<DOMSVGAnimatedLength> Width();
   already_AddRefed<DOMSVGAnimatedLength> Height();
 
  protected:
   virtual LengthAttributesInfo GetLengthInfo() override;
   virtual EnumAttributesInfo GetEnumInfo() override;
 
   enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT };
-  nsSVGLength2 mLengthAttributes[4];
+  SVGAnimatedLength mLengthAttributes[4];
   static LengthInfo sLengthInfo[4];
 
   enum { MASKUNITS, MASKCONTENTUNITS };
   SVGAnimatedEnumeration mEnumAttributes[2];
   static EnumInfo sEnumInfo[2];
 };
 
 }  // namespace dom
--- a/dom/svg/SVGPatternElement.h
+++ b/dom/svg/SVGPatternElement.h
@@ -4,17 +4,17 @@
  * 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_SVGPatternElement_h
 #define mozilla_dom_SVGPatternElement_h
 
 #include "nsAutoPtr.h"
 #include "SVGAnimatedEnumeration.h"
-#include "nsSVGLength2.h"
+#include "SVGAnimatedLength.h"
 #include "SVGAnimatedPreserveAspectRatio.h"
 #include "SVGAnimatedString.h"
 #include "SVGAnimatedTransformList.h"
 #include "SVGAnimatedViewBox.h"
 #include "mozilla/dom/SVGElement.h"
 
 class nsSVGPatternFrame;
 
@@ -72,17 +72,17 @@ class SVGPatternElement final : public S
  protected:
   virtual LengthAttributesInfo GetLengthInfo() override;
   virtual EnumAttributesInfo GetEnumInfo() override;
   virtual StringAttributesInfo GetStringInfo() override;
   virtual SVGAnimatedPreserveAspectRatio* GetPreserveAspectRatio() override;
   virtual SVGAnimatedViewBox* GetViewBox() override;
 
   enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT };
-  nsSVGLength2 mLengthAttributes[4];
+  SVGAnimatedLength mLengthAttributes[4];
   static LengthInfo sLengthInfo[4];
 
   enum { PATTERNUNITS, PATTERNCONTENTUNITS };
   SVGAnimatedEnumeration mEnumAttributes[2];
   static EnumInfo sEnumInfo[2];
 
   nsAutoPtr<mozilla::SVGAnimatedTransformList> mPatternTransform;
 
--- a/dom/svg/SVGRectElement.h
+++ b/dom/svg/SVGRectElement.h
@@ -2,17 +2,17 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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_SVGRectElement_h
 #define mozilla_dom_SVGRectElement_h
 
-#include "nsSVGLength2.h"
+#include "SVGAnimatedLength.h"
 #include "SVGGeometryElement.h"
 
 nsresult NS_NewSVGRectElement(
     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 namespace mozilla {
 namespace dom {
 
@@ -49,16 +49,16 @@ class SVGRectElement final : public SVGR
   already_AddRefed<DOMSVGAnimatedLength> Width();
   already_AddRefed<DOMSVGAnimatedLength> Rx();
   already_AddRefed<DOMSVGAnimatedLength> Ry();
 
  protected:
   virtual LengthAttributesInfo GetLengthInfo() override;
 
   enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT, ATTR_RX, ATTR_RY };
-  nsSVGLength2 mLengthAttributes[6];
+  SVGAnimatedLength mLengthAttributes[6];
   static LengthInfo sLengthInfo[6];
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
 #endif  // mozilla_dom_SVGRectElement_h
--- a/dom/svg/SVGStopElement.h
+++ b/dom/svg/SVGStopElement.h
@@ -2,18 +2,18 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* 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_SVGStopElement_h
 #define mozilla_dom_SVGStopElement_h
 
-#include "SVGElement.h"
-#include "nsSVGNumber2.h"
+#include "mozilla/dom/SVGElement.h"
+#include "SVGAnimatedNumber.h"
 
 nsresult NS_NewSVGStopElement(
     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
 
 namespace mozilla {
 namespace dom {
 
 typedef SVGElement SVGStopElementBase;
@@ -33,16 +33,16 @@ class SVGStopElement final : public SVGS
 
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 
   // WebIDL
   already_AddRefed<DOMSVGAnimatedNumber> Offset();
 
  protected:
   virtual NumberAttributesInfo GetNumberInfo() override;
-  nsSVGNumber2 mOffset;
+  SVGAnimatedNumber mOffset;
   static NumberInfo sNumberInfo;
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
 #endif  // mozilla_dom_SVGStopElement_h
--- a/dom/svg/SVGTSpanElement.h
+++ b/dom/svg/SVGTSpanElement.h
@@ -37,18 +37,18 @@ class SVGTSpanElement final : public SVG
   virtual EnumAttributesInfo GetEnumInfo() override;
   virtual LengthAttributesInfo GetLengthInfo() override;
 
   SVGAnimatedEnumeration mEnumAttributes[1];
   virtual SVGAnimatedEnumeration* EnumAttributes() override {
     return mEnumAttributes;
   }
 
-  nsSVGLength2 mLengthAttributes[1];
-  virtual nsSVGLength2* LengthAttributes() override {
+  SVGAnimatedLength mLengthAttributes[1];
+  virtual SVGAnimatedLength* LengthAttributes() override {
     return mLengthAttributes;
   }
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
 #endif  // mozilla_dom_SVGTSpanElement_h
--- a/dom/svg/SVGTextContentElement.h
+++ b/dom/svg/SVGTextContentElement.h
@@ -5,17 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_SVGTextContentElement_h
 #define mozilla_dom_SVGTextContentElement_h
 
 #include "mozilla/dom/SVGGraphicsElement.h"
 #include "DOMSVGAnimatedEnumeration.h"
 #include "SVGAnimatedEnumeration.h"
-#include "nsSVGLength2.h"
+#include "SVGAnimatedLength.h"
 
 class SVGTextFrame;
 
 namespace mozilla {
 class nsISVGPoint;
 
 namespace dom {
 
@@ -60,16 +60,16 @@ class SVGTextContentElement : public SVG
   GetNonLayoutDependentNumberOfChars();
 
   enum { LENGTHADJUST };
   virtual SVGAnimatedEnumeration* EnumAttributes() = 0;
   static SVGEnumMapping sLengthAdjustMap[];
   static EnumInfo sEnumInfo[1];
 
   enum { TEXTLENGTH };
-  virtual nsSVGLength2* LengthAttributes() = 0;
+  virtual SVGAnimatedLength* LengthAttributes() = 0;
   static LengthInfo sLengthInfo[1];
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
 #endif  // mozilla_dom_SVGTextContentElement_h
--- a/dom/svg/SVGTextElement.h
+++ b/dom/svg/SVGTextElement.h
@@ -37,18 +37,18 @@ class SVGTextElement final : public SVGT
   virtual EnumAttributesInfo GetEnumInfo() override;
   virtual LengthAttributesInfo GetLengthInfo() override;
 
   SVGAnimatedEnumeration mEnumAttributes[1];
   virtual SVGAnimatedEnumeration* EnumAttributes() override {
     return mEnumAttributes;
   }
 
-  nsSVGLength2 mLengthAttributes[1];
-  virtual nsSVGLength2* LengthAttributes() override {
+  SVGAnimatedLength mLengthAttributes[1];
+  virtual SVGAnimatedLength* LengthAttributes() override {
     return mLengthAttributes;
   }
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
 #endif  // mozilla_dom_SVGTextElement_h
--- a/dom/svg/SVGTextPathElement.h
+++ b/dom/svg/SVGTextPathElement.h
@@ -3,17 +3,17 @@
 /* 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_SVGTextPathElement_h
 #define mozilla_dom_SVGTextPathElement_h
 
 #include "SVGAnimatedEnumeration.h"
-#include "nsSVGLength2.h"
+#include "SVGAnimatedLength.h"
 #include "SVGAnimatedPathSegList.h"
 #include "SVGAnimatedString.h"
 #include "mozilla/dom/SVGTextContentElement.h"
 
 class nsAtom;
 class nsIContent;
 
 nsresult NS_NewSVGTextPathElement(
@@ -60,18 +60,18 @@ class SVGTextPathElement final : public 
   void HrefAsString(nsAString& aHref);
 
  protected:
   virtual LengthAttributesInfo GetLengthInfo() override;
   virtual EnumAttributesInfo GetEnumInfo() override;
   virtual StringAttributesInfo GetStringInfo() override;
 
   enum { /* TEXTLENGTH, */ STARTOFFSET = 1 };
-  nsSVGLength2 mLengthAttributes[2];
-  virtual nsSVGLength2* LengthAttributes() override {
+  SVGAnimatedLength mLengthAttributes[2];
+  virtual SVGAnimatedLength* LengthAttributes() override {
     return mLengthAttributes;
   }
   static LengthInfo sLengthInfo[2];
 
   enum { /* LENGTHADJUST, */ METHOD = 1, SPACING, SIDE };
   SVGAnimatedEnumeration mEnumAttributes[4];
   virtual SVGAnimatedEnumeration* EnumAttributes() override {
     return mEnumAttributes;
--- a/dom/svg/SVGUseElement.cpp
+++ b/dom/svg/SVGUseElement.cpp
@@ -387,17 +387,17 @@ void SVGUseElement::SyncWidthOrHeight(ns
     // Our width/height attribute is now no longer explicitly set, so we
     // need to revert the clone's width/height to the width/height of the
     // content that's being cloned.
     TriggerReclone();
     return;
   }
   // Our width/height attribute is now no longer explicitly set, so we
   // need to set the value to 100%
-  nsSVGLength2 length;
+  SVGAnimatedLength length;
   length.Init(SVGContentUtils::XY, 0xff, 100,
               SVGLength_Binding::SVG_LENGTHTYPE_PERCENTAGE);
   target->SetLength(aName, length);
 }
 
 void SVGUseElement::LookupHref() {
   nsAutoString href;
   if (mStringAttributes[HREF].IsExplicitlySet()) {
--- a/dom/svg/SVGUseElement.h
+++ b/dom/svg/SVGUseElement.h
@@ -8,17 +8,17 @@
 #define mozilla_dom_SVGUseElement_h
 
 #include "mozilla/dom/FromParser.h"
 #include "mozilla/dom/IDTracker.h"
 #include "mozilla/dom/SVGGraphicsElement.h"
 #include "mozilla/RefPtr.h"
 #include "nsCOMPtr.h"
 #include "nsStubMutationObserver.h"
-#include "nsSVGLength2.h"
+#include "SVGAnimatedLength.h"
 #include "SVGAnimatedString.h"
 #include "nsTArray.h"
 
 class nsIContent;
 class nsSVGUseFrame;
 
 nsresult NS_NewSVGSVGElement(
     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
@@ -135,17 +135,17 @@ class SVGUseElement final : public SVGUs
    */
   bool OurWidthAndHeightAreUsed() const;
   void SyncWidthOrHeight(nsAtom* aName);
   void LookupHref();
   void TriggerReclone();
   void UnlinkSource();
 
   enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT };
-  nsSVGLength2 mLengthAttributes[4];
+  SVGAnimatedLength mLengthAttributes[4];
   static LengthInfo sLengthInfo[4];
 
   enum { HREF, XLINK_HREF };
   SVGAnimatedString mStringAttributes[2];
   static StringInfo sStringInfo[2];
 
   RefPtr<SVGUseElement> mOriginal;  // if we've been cloned, our "real" copy
   ElementTracker mReferencedElementTracker;
--- a/dom/svg/SVGViewportElement.cpp
+++ b/dom/svg/SVGViewportElement.cpp
@@ -113,17 +113,17 @@ SVGViewportElement::IsAttributeMapped(co
 // Helper for GetViewBoxTransform on root <svg> node
 // * aLength: internal value for our <svg> width or height attribute.
 // * aViewportLength: length of the corresponding dimension of the viewport.
 // * aSelf: the outermost <svg> node itself.
 // NOTE: aSelf is not an ancestor viewport element, so it can't be used to
 // resolve percentage lengths. (It can only be used to resolve
 // 'em'/'ex'-valued units).
 inline float ComputeSynthesizedViewBoxDimension(
-    const nsSVGLength2& aLength, float aViewportLength,
+    const SVGAnimatedLength& aLength, float aViewportLength,
     const SVGViewportElement* aSelf) {
   if (aLength.IsPercentage()) {
     return aViewportLength * aLength.GetAnimValInSpecifiedUnits() / 100.0f;
   }
 
   return aLength.GetAnimValue(const_cast<SVGViewportElement*>(aSelf));
 }
 
--- a/dom/svg/SVGViewportElement.h
+++ b/dom/svg/SVGViewportElement.h
@@ -7,17 +7,17 @@
 #ifndef mozilla_dom_SVGViewportElement_h
 #define mozilla_dom_SVGViewportElement_h
 
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/FromParser.h"
 #include "nsAutoPtr.h"
 #include "nsIContentInlines.h"
 #include "SVGAnimatedEnumeration.h"
-#include "nsSVGLength2.h"
+#include "SVGAnimatedLength.h"
 #include "SVGAnimatedPreserveAspectRatio.h"
 #include "SVGAnimatedViewBox.h"
 #include "SVGGraphicsElement.h"
 #include "SVGImageContext.h"
 #include "nsISVGPoint.h"
 #include "SVGPreserveAspectRatio.h"
 
 class nsSVGOuterSVGFrame;
@@ -167,17 +167,17 @@ class SVGViewportElement : public SVGGra
 
   /**
    * Retrieve the value of currentScale and currentTranslate.
    */
   virtual SVGPoint GetCurrentTranslate() const { return SVGPoint(0.0f, 0.0f); }
   virtual float GetCurrentScale() const { return 1.0f; }
 
   enum { ATTR_X, ATTR_Y, ATTR_WIDTH, ATTR_HEIGHT };
-  nsSVGLength2 mLengthAttributes[4];
+  SVGAnimatedLength mLengthAttributes[4];
   static LengthInfo sLengthInfo[4];
   virtual LengthAttributesInfo GetLengthInfo() override;
 
   virtual SVGAnimatedPreserveAspectRatio* GetPreserveAspectRatio() override;
 
   virtual const SVGAnimatedViewBox& GetViewBoxInternal() const {
     return mViewBox;
   }
--- a/dom/svg/moz.build
+++ b/dom/svg/moz.build
@@ -115,25 +115,25 @@ UNIFIED_SOURCES += [
     'DOMSVGPathSeg.cpp',
     'DOMSVGPathSegList.cpp',
     'DOMSVGPoint.cpp',
     'DOMSVGPointList.cpp',
     'DOMSVGStringList.cpp',
     'DOMSVGTransform.cpp',
     'DOMSVGTransformList.cpp',
     'nsISVGPoint.cpp',
-    'nsSVGLength2.cpp',
-    'nsSVGNumber2.cpp',
     'SVGAElement.cpp',
     'SVGAnimatedBoolean.cpp',
     'SVGAnimatedClass.cpp',
     'SVGAnimatedEnumeration.cpp',
     'SVGAnimatedInteger.cpp',
     'SVGAnimatedIntegerPair.cpp',
+    'SVGAnimatedLength.cpp',
     'SVGAnimatedLengthList.cpp',
+    'SVGAnimatedNumber.cpp',
     'SVGAnimatedNumberList.cpp',
     'SVGAnimatedNumberPair.cpp',
     'SVGAnimatedOrient.cpp',
     'SVGAnimatedPathSegList.cpp',
     'SVGAnimatedPointList.cpp',
     'SVGAnimatedPreserveAspectRatio.cpp',
     'SVGAnimatedRect.cpp',
     'SVGAnimatedString.cpp',
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -4648,17 +4648,17 @@ gfxFloat SVGTextFrame::GetOffsetScale(ns
     return 1.0;
   }
   return geomElement->GetPathLengthScale(SVGGeometryElement::eForTextPath);
 }
 
 gfxFloat SVGTextFrame::GetStartOffset(nsIFrame* aTextPathFrame) {
   SVGTextPathElement* tp =
       static_cast<SVGTextPathElement*>(aTextPathFrame->GetContent());
-  nsSVGLength2* length =
+  SVGAnimatedLength* length =
       &tp->mLengthAttributes[SVGTextPathElement::STARTOFFSET];
 
   if (length->IsPercentage()) {
     RefPtr<Path> data = GetTextPath(aTextPathFrame);
     return data ? length->GetAnimValInSpecifiedUnits() * data->ComputeLength() /
                       100.0
                 : 0.0;
   }
@@ -4825,17 +4825,17 @@ void SVGTextFrame::DoGlyphPositioning() 
     // No characters, so nothing to do.
     return;
   }
 
   // If the textLength="" attribute was specified, then we need ResolvePositions
   // to record that a new run starts with each glyph.
   SVGTextContentElement* element =
       static_cast<SVGTextContentElement*>(GetContent());
-  nsSVGLength2* textLengthAttr =
+  SVGAnimatedLength* textLengthAttr =
       element->GetAnimatedLength(nsGkAtoms::textLength);
   uint16_t lengthAdjust =
       element->EnumAttributes()[SVGTextContentElement::LENGTHADJUST]
           .GetAnimValue();
   bool adjustingTextLength = textLengthAttr->IsExplicitlySet();
   float expectedTextLength = textLengthAttr->GetAnimValue(element);
 
   if (adjustingTextLength &&
--- a/layout/svg/nsSVGFilterFrame.cpp
+++ b/layout/svg/nsSVGFilterFrame.cpp
@@ -53,19 +53,19 @@ uint16_t nsSVGFilterFrame::GetEnumValue(
   nsSVGFilterFrame* next = GetReferencedFilter();
 
   return next ? next->GetEnumValue(aIndex, aDefault)
               : static_cast<SVGFilterElement*>(aDefault)
                     ->mEnumAttributes[aIndex]
                     .GetAnimValue();
 }
 
-const nsSVGLength2* nsSVGFilterFrame::GetLengthValue(uint32_t aIndex,
-                                                     nsIContent* aDefault) {
-  const nsSVGLength2* thisLength =
+const SVGAnimatedLength* nsSVGFilterFrame::GetLengthValue(
+    uint32_t aIndex, nsIContent* aDefault) {
+  const SVGAnimatedLength* thisLength =
       &static_cast<SVGFilterElement*>(GetContent())->mLengthAttributes[aIndex];
 
   if (thisLength->IsExplicitlySet()) {
     return thisLength;
   }
 
   // Before we recurse, make sure we'll break reference loops and over long
   // reference chains:
--- a/layout/svg/nsSVGFilterFrame.h
+++ b/layout/svg/nsSVGFilterFrame.h
@@ -12,21 +12,21 @@
 #include "nsQueryFrame.h"
 #include "nsSVGContainerFrame.h"
 #include "nsSVGUtils.h"
 
 class nsAtom;
 class nsIContent;
 class nsIFrame;
 class nsIPresShell;
-class nsSVGLength2;
 
 struct nsRect;
 
 namespace mozilla {
+class SVGAnimatedLength;
 namespace dom {
 class SVGFilterElement;
 }  // namespace dom
 }  // namespace mozilla
 
 class nsSVGFilterFrame final : public nsSVGContainerFrame {
   friend nsIFrame* NS_NewSVGFilterFrame(nsIPresShell* aPresShell,
                                         ComputedStyle* aStyle);
@@ -63,18 +63,19 @@ class nsSVGFilterFrame final : public ns
    */
   nsSVGFilterFrame* GetReferencedFilter();
 
   // Accessors to lookup filter attributes
   uint16_t GetEnumValue(uint32_t aIndex, nsIContent* aDefault);
   uint16_t GetEnumValue(uint32_t aIndex) {
     return GetEnumValue(aIndex, mContent);
   }
-  const nsSVGLength2* GetLengthValue(uint32_t aIndex, nsIContent* aDefault);
-  const nsSVGLength2* GetLengthValue(uint32_t aIndex) {
+  const mozilla::SVGAnimatedLength* GetLengthValue(uint32_t aIndex,
+                                                   nsIContent* aDefault);
+  const mozilla::SVGAnimatedLength* GetLengthValue(uint32_t aIndex) {
     return GetLengthValue(aIndex, mContent);
   }
   const mozilla::dom::SVGFilterElement* GetFilterContent(nsIContent* aDefault);
   const mozilla::dom::SVGFilterElement* GetFilterContent() {
     return GetFilterContent(mContent);
   }
 
   // This flag is used to detect loops in xlink:href processing
--- a/layout/svg/nsSVGFilterInstance.cpp
+++ b/layout/svg/nsSVGFilterInstance.cpp
@@ -69,17 +69,17 @@ bool nsSVGFilterInstance::ComputeBounds(
   // being *massive* below (because we ignore the units and interpret the number
   // as a factor of the bbox width/height). We should also send a warning if the
   // user uses a number without units (a future SVG spec should really
   // deprecate that, since it's too confusing for a bare number to be sometimes
   // interpreted as a fraction of the bounding box and sometimes as user-space
   // units). So really only percentage values should be used in this case.
 
   // Set the user space bounds (i.e. the filter region in user space).
-  nsSVGLength2 XYWH[4];
+  SVGAnimatedLength XYWH[4];
   static_assert(sizeof(mFilterElement->mLengthAttributes) == sizeof(XYWH),
                 "XYWH size incorrect");
   memcpy(XYWH, mFilterElement->mLengthAttributes,
          sizeof(mFilterElement->mLengthAttributes));
   XYWH[0] = *mFilterFrame->GetLengthValue(SVGFilterElement::ATTR_X);
   XYWH[1] = *mFilterFrame->GetLengthValue(SVGFilterElement::ATTR_Y);
   XYWH[2] = *mFilterFrame->GetLengthValue(SVGFilterElement::ATTR_WIDTH);
   XYWH[3] = *mFilterFrame->GetLengthValue(SVGFilterElement::ATTR_HEIGHT);
@@ -163,17 +163,17 @@ nsSVGFilterFrame* nsSVGFilterInstance::G
     return nullptr;
   }
 
   return static_cast<nsSVGFilterFrame*>(frame);
 }
 
 float nsSVGFilterInstance::GetPrimitiveNumber(uint8_t aCtxType,
                                               float aValue) const {
-  nsSVGLength2 val;
+  SVGAnimatedLength val;
   val.Init(aCtxType, 0xff, aValue, SVGLength_Binding::SVG_LENGTHTYPE_NUMBER);
 
   float value;
   if (mPrimitiveUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
     value = nsSVGUtils::ObjectSpace(mTargetBBox, &val);
   } else {
     value = nsSVGUtils::UserSpace(mMetrics, &val);
   }
@@ -187,17 +187,17 @@ float nsSVGFilterInstance::GetPrimitiveN
     default:
       return value * SVGContentUtils::ComputeNormalizedHypotenuse(
                          mUserSpaceToFilterSpaceScale.width,
                          mUserSpaceToFilterSpaceScale.height);
   }
 }
 
 Point3D nsSVGFilterInstance::ConvertLocation(const Point3D& aPoint) const {
-  nsSVGLength2 val[4];
+  SVGAnimatedLength val[4];
   val[0].Init(SVGContentUtils::X, 0xff, aPoint.x,
               SVGLength_Binding::SVG_LENGTHTYPE_NUMBER);
   val[1].Init(SVGContentUtils::Y, 0xff, aPoint.y,
               SVGLength_Binding::SVG_LENGTHTYPE_NUMBER);
   // Dummy width/height values
   val[2].Init(SVGContentUtils::X, 0xff, 0,
               SVGLength_Binding::SVG_LENGTHTYPE_NUMBER);
   val[3].Init(SVGContentUtils::Y, 0xff, 0,
--- a/layout/svg/nsSVGFilterInstance.h
+++ b/layout/svg/nsSVGFilterInstance.h
@@ -4,17 +4,17 @@
  * 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_SVGFILTERINSTANCE_H__
 #define __NS_SVGFILTERINSTANCE_H__
 
 #include "gfxMatrix.h"
 #include "gfxRect.h"
-#include "nsSVGNumber2.h"
+#include "SVGAnimatedNumber.h"
 #include "SVGAnimatedNumberPair.h"
 #include "SVGFilters.h"
 #include "nsTArray.h"
 
 class nsSVGFilterFrame;
 struct nsStyleFilter;
 
 namespace mozilla {
@@ -60,16 +60,17 @@ class SVGFilterElement;
  * div element's border box.
  *
  * Now, let's transform the point from user space to filter space:
  *   "filter space point" = "user space point" * "device pixels per CSS pixel"
  *   "filter space point" = (10, 10) * 2
  *   "filter space point" = (20, 20)
  */
 class nsSVGFilterInstance {
+  typedef mozilla::SVGAnimatedNumber SVGAnimatedNumber;
   typedef mozilla::SVGAnimatedNumberPair SVGAnimatedNumberPair;
   typedef mozilla::gfx::Point3D Point3D;
   typedef mozilla::gfx::IntRect IntRect;
   typedef mozilla::gfx::SourceSurface SourceSurface;
   typedef mozilla::gfx::FilterPrimitiveDescription FilterPrimitiveDescription;
   typedef mozilla::dom::SVGFE SVGFE;
   typedef mozilla::dom::UserSpaceMetrics UserSpaceMetrics;
 
@@ -106,17 +107,17 @@ class nsSVGFilterInstance {
    * aPrimitiveDescrs, or the SourceGraphic input if this is the first filter in
    * the filter chain.
    */
   nsresult BuildPrimitives(
       nsTArray<FilterPrimitiveDescription>& aPrimitiveDescrs,
       nsTArray<RefPtr<SourceSurface>>& aInputImages, bool aInputIsTainted);
 
   float GetPrimitiveNumber(uint8_t aCtxType,
-                           const nsSVGNumber2* aNumber) const {
+                           const SVGAnimatedNumber* aNumber) const {
     return GetPrimitiveNumber(aCtxType, aNumber->GetAnimValue());
   }
   float GetPrimitiveNumber(uint8_t aCtxType,
                            const SVGAnimatedNumberPair* aNumberPair,
                            SVGAnimatedNumberPair::PairIndex aIndex) const {
     return GetPrimitiveNumber(aCtxType, aNumberPair->GetAnimValue(aIndex));
   }
 
--- a/layout/svg/nsSVGGradientFrame.cpp
+++ b/layout/svg/nsSVGGradientFrame.cpp
@@ -414,17 +414,17 @@ nsresult nsSVGLinearGradientFrame::Attri
 
 float nsSVGLinearGradientFrame::GetLengthValue(uint32_t aIndex) {
   dom::SVGLinearGradientElement* lengthElement = GetLinearGradientWithLength(
       aIndex, static_cast<dom::SVGLinearGradientElement*>(GetContent()));
   // We passed in mContent as a fallback, so, assuming mContent is non-null, the
   // return value should also be non-null.
   MOZ_ASSERT(lengthElement,
              "Got unexpected null element from GetLinearGradientWithLength");
-  const nsSVGLength2& length = lengthElement->mLengthAttributes[aIndex];
+  const SVGAnimatedLength& length = lengthElement->mLengthAttributes[aIndex];
 
   // Object bounding box units are handled by setting the appropriate
   // transform in GetGradientTransform, but we need to handle user
   // space units as part of the individual Get* routines.  Fixes 323669.
 
   uint16_t gradientUnits = GetGradientUnits();
   if (gradientUnits == SVG_UNIT_TYPE_USERSPACEONUSE) {
     return nsSVGUtils::UserSpace(mSource, &length);
@@ -436,17 +436,17 @@ float nsSVGLinearGradientFrame::GetLengt
   return length.GetAnimValue(static_cast<SVGViewportElement*>(nullptr));
 }
 
 dom::SVGLinearGradientElement*
 nsSVGLinearGradientFrame::GetLinearGradientWithLength(
     uint32_t aIndex, dom::SVGLinearGradientElement* aDefault) {
   dom::SVGLinearGradientElement* thisElement =
       static_cast<dom::SVGLinearGradientElement*>(GetContent());
-  const nsSVGLength2& length = thisElement->mLengthAttributes[aIndex];
+  const SVGAnimatedLength& length = thisElement->mLengthAttributes[aIndex];
 
   if (length.IsExplicitlySet()) {
     return thisElement;
   }
 
   return nsSVGGradientFrame::GetLinearGradientWithLength(aIndex, aDefault);
 }
 
@@ -516,17 +516,17 @@ float nsSVGRadialGradientFrame::GetLengt
       GetRadialGradientWithLength(aIndex, nullptr);
 
   return lengthElement ? GetLengthValueFromElement(aIndex, *lengthElement)
                        : aDefaultValue;
 }
 
 float nsSVGRadialGradientFrame::GetLengthValueFromElement(
     uint32_t aIndex, dom::SVGRadialGradientElement& aElement) {
-  const nsSVGLength2& length = aElement.mLengthAttributes[aIndex];
+  const SVGAnimatedLength& length = aElement.mLengthAttributes[aIndex];
 
   // Object bounding box units are handled by setting the appropriate
   // transform in GetGradientTransform, but we need to handle user
   // space units as part of the individual Get* routines.  Fixes 323669.
 
   uint16_t gradientUnits = GetGradientUnits();
   if (gradientUnits == SVG_UNIT_TYPE_USERSPACEONUSE) {
     return nsSVGUtils::UserSpace(mSource, &length);
@@ -538,17 +538,17 @@ float nsSVGRadialGradientFrame::GetLengt
   return length.GetAnimValue(static_cast<SVGViewportElement*>(nullptr));
 }
 
 dom::SVGRadialGradientElement*
 nsSVGRadialGradientFrame::GetRadialGradientWithLength(
     uint32_t aIndex, dom::SVGRadialGradientElement* aDefault) {
   dom::SVGRadialGradientElement* thisElement =
       static_cast<dom::SVGRadialGradientElement*>(GetContent());
-  const nsSVGLength2& length = thisElement->mLengthAttributes[aIndex];
+  const SVGAnimatedLength& length = thisElement->mLengthAttributes[aIndex];
 
   if (length.IsExplicitlySet()) {
     return thisElement;
   }
 
   return nsSVGGradientFrame::GetRadialGradientWithLength(aIndex, aDefault);
 }
 
--- a/layout/svg/nsSVGOuterSVGFrame.cpp
+++ b/layout/svg/nsSVGOuterSVGFrame.cpp
@@ -159,17 +159,17 @@ nscoord nsSVGOuterSVGFrame::GetMinISize(
 
 /* virtual */
 nscoord nsSVGOuterSVGFrame::GetPrefISize(gfxContext* aRenderingContext) {
   nscoord result;
   DISPLAY_PREF_INLINE_SIZE(this, result);
 
   SVGSVGElement* svg = static_cast<SVGSVGElement*>(GetContent());
   WritingMode wm = GetWritingMode();
-  const nsSVGLength2& isize =
+  const SVGAnimatedLength& isize =
       wm.IsVertical() ? svg->mLengthAttributes[SVGSVGElement::ATTR_HEIGHT]
                       : svg->mLengthAttributes[SVGSVGElement::ATTR_WIDTH];
 
   if (isize.IsPercentage()) {
     // It looks like our containing block's isize may depend on our isize. In
     // that case our behavior is undefined according to CSS 2.1 section 10.3.2.
     // As a last resort, we'll fall back to returning zero.
     result = nscoord(0);
@@ -201,19 +201,19 @@ nscoord nsSVGOuterSVGFrame::GetPrefISize
 /* virtual */
 IntrinsicSize nsSVGOuterSVGFrame::GetIntrinsicSize() {
   // XXXjwatt Note that here we want to return the CSS width/height if they're
   // specified and we're embedded inside an nsIObjectLoadingContent.
 
   IntrinsicSize intrinsicSize;
 
   SVGSVGElement* content = static_cast<SVGSVGElement*>(GetContent());
-  const nsSVGLength2& width =
+  const SVGAnimatedLength& width =
       content->mLengthAttributes[SVGSVGElement::ATTR_WIDTH];
-  const nsSVGLength2& height =
+  const SVGAnimatedLength& height =
       content->mLengthAttributes[SVGSVGElement::ATTR_HEIGHT];
 
   if (!width.IsPercentage()) {
     nscoord val =
         nsPresContext::CSSPixelsToAppUnits(width.GetAnimValue(content));
     if (val < 0) val = 0;
     intrinsicSize.width.SetCoordValue(val);
   }
@@ -233,19 +233,19 @@ nsSize nsSVGOuterSVGFrame::GetIntrinsicR
   // We only have an intrinsic size/ratio if our width and height attributes
   // are both specified and set to non-percentage values, or we have a viewBox
   // rect: http://www.w3.org/TR/SVGMobile12/coords.html#IntrinsicSizing
   // Unfortunately we have to return the ratio as two nscoords whereas what
   // we have are two floats. Using app units allows for some floating point
   // values to work but really small or large numbers will fail.
 
   SVGSVGElement* content = static_cast<SVGSVGElement*>(GetContent());
-  const nsSVGLength2& width =
+  const SVGAnimatedLength& width =
       content->mLengthAttributes[SVGSVGElement::ATTR_WIDTH];
-  const nsSVGLength2& height =
+  const SVGAnimatedLength& height =
       content->mLengthAttributes[SVGSVGElement::ATTR_HEIGHT];
 
   if (!width.IsPercentage() && !height.IsPercentage()) {
     nsSize ratio(
         nsPresContext::CSSPixelsToAppUnits(width.GetAnimValue(content)),
         nsPresContext::CSSPixelsToAppUnits(height.GetAnimValue(content)));
     if (ratio.width < 0) {
       ratio.width = 0;
@@ -314,27 +314,27 @@ LogicalSize nsSVGOuterSVGFrame::ComputeS
     // We also need to honour the width and height attributes' default values
     // of 100% when we're the root of a browsing context.  (GetIntrinsicSize()
     // doesn't report these since there's no such thing as a percentage
     // intrinsic size.  Also note that explicit percentage values are mapped
     // into style, so the following isn't for them.)
 
     SVGSVGElement* content = static_cast<SVGSVGElement*>(GetContent());
 
-    const nsSVGLength2& width =
+    const SVGAnimatedLength& width =
         content->mLengthAttributes[SVGSVGElement::ATTR_WIDTH];
     if (width.IsPercentage()) {
       MOZ_ASSERT(intrinsicSize.width.GetUnit() == eStyleUnit_None,
                  "GetIntrinsicSize should have reported no intrinsic width");
       float val = width.GetAnimValInSpecifiedUnits() / 100.0f;
       if (val < 0.0f) val = 0.0f;
       intrinsicSize.width.SetCoordValue(val * cbSize.Width(aWM));
     }
 
-    const nsSVGLength2& height =
+    const SVGAnimatedLength& height =
         content->mLengthAttributes[SVGSVGElement::ATTR_HEIGHT];
     NS_ASSERTION(aCBSize.BSize(aWM) != NS_AUTOHEIGHT,
                  "root should not have auto-height containing block");
     if (height.IsPercentage()) {
       MOZ_ASSERT(intrinsicSize.height.GetUnit() == eStyleUnit_None,
                  "GetIntrinsicSize should have reported no intrinsic height");
       float val = height.GetAnimValInSpecifiedUnits() / 100.0f;
       if (val < 0.0f) val = 0.0f;
@@ -912,17 +912,17 @@ bool nsSVGOuterSVGFrame::IsRootOfImage()
       return true;
     }
   }
 
   return false;
 }
 
 bool nsSVGOuterSVGFrame::VerticalScrollbarNotNeeded() const {
-  const nsSVGLength2& height =
+  const SVGAnimatedLength& height =
       static_cast<SVGSVGElement*>(GetContent())
           ->mLengthAttributes[SVGSVGElement::ATTR_HEIGHT];
   return height.IsPercentage() && height.GetBaseValInSpecifiedUnits() <= 100;
 }
 
 void nsSVGOuterSVGFrame::AppendDirectlyOwnedAnonBoxes(
     nsTArray<OwnedAnonBox>& aResult) {
   nsIFrame* anonKid = PrincipalChildList().FirstChild();
--- a/layout/svg/nsSVGPatternFrame.cpp
+++ b/layout/svg/nsSVGPatternFrame.cpp
@@ -516,19 +516,19 @@ const SVGAnimatedPreserveAspectRatio &ns
   }
 
   nsSVGPatternFrame *next = GetReferencedPattern();
   return next
              ? next->GetPreserveAspectRatio(aDefault)
              : static_cast<SVGPatternElement *>(aDefault)->mPreserveAspectRatio;
 }
 
-const nsSVGLength2 *nsSVGPatternFrame::GetLengthValue(uint32_t aIndex,
-                                                      nsIContent *aDefault) {
-  const nsSVGLength2 *thisLength =
+const SVGAnimatedLength *nsSVGPatternFrame::GetLengthValue(
+    uint32_t aIndex, nsIContent *aDefault) {
+  const SVGAnimatedLength *thisLength =
       &static_cast<SVGPatternElement *>(GetContent())
            ->mLengthAttributes[aIndex];
 
   if (thisLength->IsExplicitlySet()) {
     return thisLength;
   }
 
   // Before we recurse, make sure we'll break reference loops and over long
@@ -585,17 +585,17 @@ nsSVGPatternFrame *nsSVGPatternFrame::Ge
 gfxRect nsSVGPatternFrame::GetPatternRect(uint16_t aPatternUnits,
                                           const gfxRect &aTargetBBox,
                                           const Matrix &aTargetCTM,
                                           nsIFrame *aTarget) {
   // We need to initialize our box
   float x, y, width, height;
 
   // Get the pattern x,y,width, and height
-  const nsSVGLength2 *tmpX, *tmpY, *tmpHeight, *tmpWidth;
+  const SVGAnimatedLength *tmpX, *tmpY, *tmpHeight, *tmpWidth;
   tmpX = GetLengthValue(SVGPatternElement::ATTR_X);
   tmpY = GetLengthValue(SVGPatternElement::ATTR_Y);
   tmpHeight = GetLengthValue(SVGPatternElement::ATTR_HEIGHT);
   tmpWidth = GetLengthValue(SVGPatternElement::ATTR_WIDTH);
 
   if (aPatternUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
     x = nsSVGUtils::ObjectSpace(aTargetBBox, tmpX);
     y = nsSVGUtils::ObjectSpace(aTargetBBox, tmpY);
--- a/layout/svg/nsSVGPatternFrame.h
+++ b/layout/svg/nsSVGPatternFrame.h
@@ -10,19 +10,19 @@
 #include "mozilla/Attributes.h"
 #include "gfxMatrix.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/RefPtr.h"
 #include "nsAutoPtr.h"
 #include "nsSVGPaintServerFrame.h"
 
 class nsIFrame;
-class nsSVGLength2;
 
 namespace mozilla {
+class SVGAnimatedLength;
 class SVGAnimatedPreserveAspectRatio;
 class SVGAnimatedTransformList;
 class SVGAnimatedViewBox;
 class SVGGeometryFrame;
 }  // namespace mozilla
 
 class nsSVGPatternFrame final : public nsSVGPaintServerFrame {
   typedef mozilla::gfx::SourceSurface SourceSurface;
@@ -82,18 +82,19 @@ class nsSVGPatternFrame final : public n
   gfxMatrix GetPatternTransform();
   const SVGAnimatedViewBox& GetViewBox(nsIContent* aDefault);
   const SVGAnimatedViewBox& GetViewBox() { return GetViewBox(mContent); }
   const SVGAnimatedPreserveAspectRatio& GetPreserveAspectRatio(
       nsIContent* aDefault);
   const SVGAnimatedPreserveAspectRatio& GetPreserveAspectRatio() {
     return GetPreserveAspectRatio(mContent);
   }
-  const nsSVGLength2* GetLengthValue(uint32_t aIndex, nsIContent* aDefault);
-  const nsSVGLength2* GetLengthValue(uint32_t aIndex) {
+  const SVGAnimatedLength* GetLengthValue(uint32_t aIndex,
+                                          nsIContent* aDefault);
+  const SVGAnimatedLength* GetLengthValue(uint32_t aIndex) {
     return GetLengthValue(aIndex, mContent);
   }
 
   already_AddRefed<SourceSurface> PaintPattern(
       const DrawTarget* aDrawTarget, Matrix* patternMatrix,
       const Matrix& aContextMatrix, nsIFrame* aSource,
       nsStyleSVGPaint nsStyleSVG::*aFillOrStroke, float aGraphicOpacity,
       const gfxRect* aOverrideBounds, imgDrawingParams& aImgParams);
--- a/layout/svg/nsSVGUtils.cpp
+++ b/layout/svg/nsSVGUtils.cpp
@@ -11,56 +11,55 @@
 
 // Keep others in (case-insensitive) order:
 #include "gfx2DGlue.h"
 #include "gfxContext.h"
 #include "gfxMatrix.h"
 #include "gfxPlatform.h"
 #include "gfxRect.h"
 #include "gfxUtils.h"
-#include "mozilla/gfx/2D.h"
-#include "mozilla/gfx/PatternHelpers.h"
-#include "mozilla/Preferences.h"
-#include "mozilla/PresShell.h"
-#include "mozilla/SVGContextPaint.h"
 #include "nsCSSClipPathInstance.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsDisplayList.h"
 #include "nsFilterInstance.h"
 #include "nsFrameList.h"
 #include "nsGkAtoms.h"
 #include "nsIContent.h"
-#include "mozilla/dom/Document.h"
 #include "nsIFrame.h"
-#include "nsSVGDisplayableFrame.h"
 #include "nsLayoutUtils.h"
 #include "nsPresContext.h"
 #include "nsStyleCoord.h"
 #include "nsStyleStruct.h"
+#include "SVGAnimatedLength.h"
 #include "nsSVGClipPathFrame.h"
 #include "nsSVGContainerFrame.h"
-#include "SVGObserverUtils.h"
+#include "SVGContentUtils.h"
+#include "nsSVGDisplayableFrame.h"
 #include "nsSVGFilterPaintCallback.h"
 #include "nsSVGForeignObjectFrame.h"
+#include "SVGGeometryFrame.h"
 #include "nsSVGInnerSVGFrame.h"
 #include "nsSVGIntegrationUtils.h"
-#include "nsSVGLength2.h"
 #include "nsSVGMaskFrame.h"
+#include "SVGObserverUtils.h"
 #include "nsSVGOuterSVGFrame.h"
+#include "nsSVGPaintServerFrame.h"
+#include "SVGTextFrame.h"
+#include "nsTextFrame.h"
+#include "mozilla/Preferences.h"
+#include "mozilla/SVGContextPaint.h"
+#include "mozilla/Unused.h"
+#include "mozilla/gfx/2D.h"
+#include "mozilla/gfx/PatternHelpers.h"
+#include "mozilla/dom/Document.h"
 #include "mozilla/dom/SVGClipPathElement.h"
+#include "mozilla/dom/SVGGeometryElement.h"
 #include "mozilla/dom/SVGPathElement.h"
 #include "mozilla/dom/SVGUnitTypesBinding.h"
-#include "SVGGeometryElement.h"
-#include "SVGGeometryFrame.h"
-#include "nsSVGPaintServerFrame.h"
 #include "mozilla/dom/SVGViewportElement.h"
-#include "nsTextFrame.h"
-#include "SVGContentUtils.h"
-#include "SVGTextFrame.h"
-#include "mozilla/Unused.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::dom::SVGUnitTypes_Binding;
 using namespace mozilla::gfx;
 using namespace mozilla::image;
 
 static bool sSVGDisplayListHitTestingEnabled;
@@ -246,17 +245,17 @@ Size nsSVGUtils::GetContextSize(const ns
   if (ctx) {
     size.width = ctx->GetLength(SVGContentUtils::X);
     size.height = ctx->GetLength(SVGContentUtils::Y);
   }
   return size;
 }
 
 float nsSVGUtils::ObjectSpace(const gfxRect& aRect,
-                              const nsSVGLength2* aLength) {
+                              const SVGAnimatedLength* aLength) {
   float axis;
 
   switch (aLength->GetCtxType()) {
     case SVGContentUtils::X:
       axis = aRect.Width();
       break;
     case SVGContentUtils::Y:
       axis = aRect.Height();
@@ -274,27 +273,27 @@ float nsSVGUtils::ObjectSpace(const gfxR
     // Multiply first to avoid precision errors:
     return axis * aLength->GetAnimValInSpecifiedUnits() / 100;
   }
   return aLength->GetAnimValue(static_cast<SVGViewportElement*>(nullptr)) *
          axis;
 }
 
 float nsSVGUtils::UserSpace(SVGElement* aSVGElement,
-                            const nsSVGLength2* aLength) {
+                            const SVGAnimatedLength* aLength) {
   return aLength->GetAnimValue(aSVGElement);
 }
 
 float nsSVGUtils::UserSpace(nsIFrame* aNonSVGContext,
-                            const nsSVGLength2* aLength) {
+                            const SVGAnimatedLength* aLength) {
   return aLength->GetAnimValue(aNonSVGContext);
 }
 
 float nsSVGUtils::UserSpace(const UserSpaceMetrics& aMetrics,
-                            const nsSVGLength2* aLength) {
+                            const SVGAnimatedLength* aLength) {
   return aLength->GetAnimValue(aMetrics);
 }
 
 nsSVGOuterSVGFrame* nsSVGUtils::GetOuterSVGFrame(nsIFrame* aFrame) {
   while (aFrame) {
     if (aFrame->IsSVGOuterSVGFrame()) {
       return static_cast<nsSVGOuterSVGFrame*>(aFrame);
     }
@@ -1144,36 +1143,38 @@ gfxPoint nsSVGUtils::FrameSpaceInCSSPxTo
     NS_ASSERTION(!transform.HasNonTranslation(),
                  "we're relying on this being an offset-only transform");
     return transform.GetTranslation();
   }
 
   return gfxPoint();
 }
 
-static gfxRect GetBoundingBoxRelativeRect(const nsSVGLength2* aXYWH,
+static gfxRect GetBoundingBoxRelativeRect(const SVGAnimatedLength* aXYWH,
                                           const gfxRect& aBBox) {
   return gfxRect(aBBox.x + nsSVGUtils::ObjectSpace(aBBox, &aXYWH[0]),
                  aBBox.y + nsSVGUtils::ObjectSpace(aBBox, &aXYWH[1]),
                  nsSVGUtils::ObjectSpace(aBBox, &aXYWH[2]),
                  nsSVGUtils::ObjectSpace(aBBox, &aXYWH[3]));
 }
 
-gfxRect nsSVGUtils::GetRelativeRect(uint16_t aUnits, const nsSVGLength2* aXYWH,
+gfxRect nsSVGUtils::GetRelativeRect(uint16_t aUnits,
+                                    const SVGAnimatedLength* aXYWH,
                                     const gfxRect& aBBox,
                                     const UserSpaceMetrics& aMetrics) {
   if (aUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
     return GetBoundingBoxRelativeRect(aXYWH, aBBox);
   }
   return gfxRect(UserSpace(aMetrics, &aXYWH[0]), UserSpace(aMetrics, &aXYWH[1]),
                  UserSpace(aMetrics, &aXYWH[2]),
                  UserSpace(aMetrics, &aXYWH[3]));
 }
 
-gfxRect nsSVGUtils::GetRelativeRect(uint16_t aUnits, const nsSVGLength2* aXYWH,
+gfxRect nsSVGUtils::GetRelativeRect(uint16_t aUnits,
+                                    const SVGAnimatedLength* aXYWH,
                                     const gfxRect& aBBox, nsIFrame* aFrame) {
   if (aUnits == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
     return GetBoundingBoxRelativeRect(aXYWH, aBBox);
   }
   nsIContent* content = aFrame->GetContent();
   if (content->IsSVGElement()) {
     SVGElement* svgElement = static_cast<SVGElement*>(content);
     return GetRelativeRect(aUnits, aXYWH, aBBox, SVGElementMetrics(svgElement));
--- a/layout/svg/nsSVGUtils.h
+++ b/layout/svg/nsSVGUtils.h
@@ -31,25 +31,25 @@
 class gfxContext;
 class nsFrameList;
 class nsIContent;
 
 class nsIFrame;
 class nsPresContext;
 class nsStyleSVGPaint;
 class nsSVGDisplayContainerFrame;
-class nsSVGLength2;
 class nsSVGOuterSVGFrame;
 class nsTextFrame;
 
 struct nsStyleSVG;
 struct nsRect;
 
 namespace mozilla {
 class SVGAnimatedEnumeration;
+class SVGAnimatedLength;
 class SVGContextPaint;
 struct SVGContextPaintImpl;
 class SVGGeometryFrame;
 namespace dom {
 class Element;
 class SVGElement;
 class UserSpaceMetrics;
 }  // namespace dom
@@ -155,16 +155,17 @@ class nsSVGUtils {
  public:
   typedef mozilla::dom::Element Element;
   typedef mozilla::dom::SVGElement SVGElement;
   typedef mozilla::gfx::AntialiasMode AntialiasMode;
   typedef mozilla::gfx::DrawTarget DrawTarget;
   typedef mozilla::gfx::FillRule FillRule;
   typedef mozilla::gfx::GeneralPattern GeneralPattern;
   typedef mozilla::gfx::Size Size;
+  typedef mozilla::SVGAnimatedLength SVGAnimatedLength;
   typedef mozilla::SVGContextPaint SVGContextPaint;
   typedef mozilla::SVGContextPaintImpl SVGContextPaintImpl;
   typedef mozilla::SVGGeometryFrame SVGGeometryFrame;
   typedef mozilla::image::imgDrawingParams imgDrawingParams;
 
   static void Init();
 
   NS_DECLARE_FRAME_PROPERTY_DELETABLE(ObjectBoundingBoxProperty, gfxRect)
@@ -220,26 +221,28 @@ class nsSVGUtils {
    * resolved.
    */
   static Size GetContextSize(const nsIFrame* aFrame);
 
   /* Computes the input length in terms of object space coordinates.
      Input: rect - bounding box
             length - length to be converted
   */
-  static float ObjectSpace(const gfxRect& aRect, const nsSVGLength2* aLength);
+  static float ObjectSpace(const gfxRect& aRect,
+                           const SVGAnimatedLength* aLength);
 
   /* Computes the input length in terms of user space coordinates.
      Input: content - object to be used for determining user space
      Input: length - length to be converted
   */
-  static float UserSpace(SVGElement* aSVGElement, const nsSVGLength2* aLength);
-  static float UserSpace(nsIFrame* aFrame, const nsSVGLength2* aLength);
+  static float UserSpace(SVGElement* aSVGElement,
+                         const SVGAnimatedLength* aLength);
+  static float UserSpace(nsIFrame* aFrame, const SVGAnimatedLength* aLength);
   static float UserSpace(const mozilla::dom::UserSpaceMetrics& aMetrics,
-                         const nsSVGLength2* aLength);
+                         const SVGAnimatedLength* aLength);
 
   /* Find the outermost SVG frame of the passed frame */
   static nsSVGOuterSVGFrame* GetOuterSVGFrame(nsIFrame* aFrame);
 
   /**
    * Get the covered region for a frame. Return null if it's not an SVG frame.
    * @param aRect gets a rectangle in app units
    * @return the outer SVG frame which aRect is relative to
@@ -396,30 +399,32 @@ class nsSVGUtils {
    * continuations.
    * This function returns the offset one needs to add to something in frame
    * space in order to get its coordinates in user space.
    */
   static gfxPoint FrameSpaceInCSSPxToUserSpaceOffset(nsIFrame* aFrame);
 
   /**
    * Convert a userSpaceOnUse/objectBoundingBoxUnits rectangle that's specified
-   * using four nsSVGLength2 values into a user unit rectangle in user space.
+   * using four SVGAnimatedLength values into a user unit rectangle in user
+   * space.
    *
-   * @param aXYWH pointer to 4 consecutive nsSVGLength2 objects containing
+   * @param aXYWH pointer to 4 consecutive SVGAnimatedLength objects containing
    * the x, y, width and height values in that order
    * @param aBBox the bounding box of the object the rect is relative to;
    * may be null if aUnits is not SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
    * @param aFrame the object in which to interpret user-space units;
    * may be null if aUnits is SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
    */
-  static gfxRect GetRelativeRect(uint16_t aUnits, const nsSVGLength2* aXYWH,
+  static gfxRect GetRelativeRect(uint16_t aUnits,
+                                 const SVGAnimatedLength* aXYWH,
                                  const gfxRect& aBBox, nsIFrame* aFrame);
 
   static gfxRect GetRelativeRect(
-      uint16_t aUnits, const nsSVGLength2* aXYWH, const gfxRect& aBBox,
+      uint16_t aUnits, const SVGAnimatedLength* aXYWH, const gfxRect& aBBox,
       const mozilla::dom::UserSpaceMetrics& aMetrics);
 
   /**
    * Find the first frame, starting with aStartFrame and going up its
    * parent chain, that is not an svgAFrame.
    */
   static nsIFrame* GetFirstNonAAncestorFrame(nsIFrame* aStartFrame);