Merge inbound to mozilla-central. a=merge
authorCsoregi Natalia <ncsoregi@mozilla.com>
Wed, 10 Apr 2019 12:59:51 +0300
changeset 468734 a1eb490ba4480b756fcc4f92f8dbc753c66d7900
parent 468733 d272180eb2fbb8be571f6ea40a626857c62db303 (current diff)
parent 468646 0d9193a6224f7ac96209fa3d0824cf4a94fe8812 (diff)
child 468735 06ea3fe18fda8ef6f63cd1ee4b05d53bde35a179
child 468737 43c4699b1770e430e57a1b77604d7bbb36936b6b
child 468781 155b5f870890931b3eab8cb819249bfbd6671f9c
push id112747
push userncsoregi@mozilla.com
push dateWed, 10 Apr 2019 13:22:28 +0000
treeherdermozilla-inbound@06ea3fe18fda [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone68.0a1
first release with
nightly linux32
a1eb490ba448 / 68.0a1 / 20190410100020 / files
nightly linux64
a1eb490ba448 / 68.0a1 / 20190410100020 / files
nightly mac
a1eb490ba448 / 68.0a1 / 20190410100020 / files
nightly win32
a1eb490ba448 / 68.0a1 / 20190410100020 / files
nightly win64
a1eb490ba448 / 68.0a1 / 20190410100020 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge inbound to mozilla-central. a=merge
dom/svg/nsSVGLength2.cpp
dom/svg/nsSVGLength2.h
dom/svg/nsSVGNumber2.cpp
dom/svg/nsSVGNumber2.h
--- a/devtools/client/debugger/test/mochitest/browser_dbg-pause-exceptions.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-pause-exceptions.js
@@ -12,30 +12,39 @@ function caughtException() {
 /*
   Tests Pausing on exception
   1. skip an uncaught exception
   2. pause on an uncaught exception
   3. pause on a caught error
   4. skip a caught error
 */
 add_task(async function() {
-  const dbg = await initDebugger("doc-exceptions.html");
+  const dbg = await initDebugger("doc-exceptions.html", "exceptions.js");
+  const source = findSource(dbg, "exceptions.js");
 
   log("1. test skipping an uncaught exception");
   await uncaughtException();
   ok(!isPaused(dbg));
 
   log("2. Test pausing on an uncaught exception");
   await togglePauseOnExceptions(dbg, true, true);
   uncaughtException();
   await waitForPaused(dbg);
   assertPausedLocation(dbg);
   await resume(dbg);
   await waitForActive(dbg);
 
+  log("2.b Test throwing the same uncaught exception pauses again");
+  await togglePauseOnExceptions(dbg, true, true);
+  uncaughtException();
+  await waitForPaused(dbg);
+  assertPausedLocation(dbg);
+  await resume(dbg);
+  await waitForActive(dbg);
+
   log("3. Test pausing on a caught Error");
   caughtException();
   await waitForPaused(dbg);
   assertPausedLocation(dbg);
 
   log("3.b Test pausing in the catch statement");
   await resume(dbg);
   await waitForPaused(dbg);
@@ -45,9 +54,56 @@ add_task(async function() {
   log("4. Test skipping a caught error");
   await togglePauseOnExceptions(dbg, true, false);
   caughtException();
 
   log("4.b Test pausing in the catch statement");
   await waitForPaused(dbg);
   assertPausedLocation(dbg);
   await resume(dbg);
+
+  await togglePauseOnExceptions(dbg, true, true);
+
+  log("5. Only pause once when throwing deep in the stack");
+  invokeInTab("deepError");
+  await waitForPaused(dbg);
+  assertPausedAtSourceAndLine(dbg, source.id, 16);
+  await resume(dbg);
+  await waitForPaused(dbg);
+  assertPausedAtSourceAndLine(dbg, source.id, 22);
+  await resume(dbg);
+
+  log("6. Only pause once on an exception when pausing in a finally block");
+  invokeInTab("deepErrorFinally");
+  await waitForPaused(dbg);
+  assertPausedAtSourceAndLine(dbg, source.id, 34);
+  await resume(dbg);
+  await waitForPaused(dbg);
+  assertPausedAtSourceAndLine(dbg, source.id, 31);
+  await resume(dbg);
+  await waitForPaused(dbg);
+  assertPausedAtSourceAndLine(dbg, source.id, 40);
+  await resume(dbg);
+
+  log("7. Only pause once on an exception when it is rethrown from a catch");
+  invokeInTab("deepErrorCatch");
+  await waitForPaused(dbg);
+  assertPausedAtSourceAndLine(dbg, source.id, 53);
+  await resume(dbg);
+  await waitForPaused(dbg);
+  assertPausedAtSourceAndLine(dbg, source.id, 49);
+  await resume(dbg);
+  await waitForPaused(dbg);
+  assertPausedAtSourceAndLine(dbg, source.id, 59);
+  await resume(dbg);
+
+  log("8. Pause on each exception thrown while unwinding");
+  invokeInTab("deepErrorThrowDifferent");
+  await waitForPaused(dbg);
+  assertPausedAtSourceAndLine(dbg, source.id, 71);
+  await resume(dbg);
+  await waitForPaused(dbg);
+  assertPausedAtSourceAndLine(dbg, source.id, 68);
+  await resume(dbg);
+  await waitForPaused(dbg);
+  assertPausedAtSourceAndLine(dbg, source.id, 77);
+  await resume(dbg);
 });
--- a/devtools/client/debugger/test/mochitest/browser_dbg-returnvalues.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-returnvalues.js
@@ -44,18 +44,16 @@ async function testThrowValue(dbg, val) 
   is(getLabel(dbg, 1), "callee", "check for callee");
   is(getLabel(dbg, 2), "<exception>", "check for <exception>");
   // The "uneval" call here gives us the way one would write `val` as
   // a JavaScript expression, similar to the way the debugger
   // displays values, so this test works when `val` is a string.
   is(getValue(dbg, 2), uneval(val), `check exception is ${uneval(val)}`);
 
   await resume(dbg);
-  await waitForPaused(dbg);
-  await resume(dbg);
   assertNotPaused(dbg);
 }
 
 add_task(async function() {
   const dbg = await initDebugger("doc-return-values.html");
   await togglePauseOnExceptions(dbg, true, true);
 
   await testReturnValue(dbg, "to sender");
--- a/devtools/client/debugger/test/mochitest/examples/exceptions.js
+++ b/devtools/client/debugger/test/mochitest/examples/exceptions.js
@@ -1,19 +1,78 @@
 function uncaughtException() {
   throw "unreachable"
 }
 
-function caughtError() {
-  try {
-    throw new Error("error");
-  } catch (e) {
-    debugger;
-  }
-}
-
 function caughtException() {
   try {
     throw "reachable";
   } catch (e) {
     debugger;
   }
 }
+
+function deepError() {
+  function a() { b(); }
+  function b() { c(); }
+  function c() { throw new Error(); }
+
+  try {
+    a();
+  } catch (e) {}
+
+  debugger;
+}
+
+function deepErrorFinally() {
+  function a() { b(); }
+  function b() {
+    try {
+      c();
+    } finally {
+      debugger;
+    }
+  }
+  function c() { throw new Error(); }
+
+  try {
+    a();
+  } catch (e) {}
+
+  debugger;
+}
+
+function deepErrorCatch() {
+  function a() { b(); }
+  function b() {
+    try {
+      c();
+    } catch (e) {
+      debugger;
+      throw e;
+    }
+  }
+  function c() { throw new Error(); }
+
+  try {
+    a();
+  } catch (e) {}
+
+  debugger;
+}
+
+function deepErrorThrowDifferent() {
+  function a() { b(); }
+  function b() {
+    try {
+      c();
+    } catch (e) {
+      throw new Error();
+    }
+  }
+  function c() { throw new Error(); }
+
+  try {
+    a();
+  } catch (e) {}
+
+  debugger;
+}
--- a/devtools/server/actors/thread.js
+++ b/devtools/server/actors/thread.js
@@ -71,16 +71,22 @@ const ThreadActor = ActorClassWithSpec(t
     this.breakpointActorMap = new BreakpointActorMap(this);
 
     this._debuggerSourcesSeen = null;
 
     // A Set of URLs string to watch for when new sources are found by
     // the debugger instance.
     this._onLoadBreakpointURLs = new Set();
 
+    // A WeakMap from Debugger.Frame to an exception value which will be ignored
+    // when deciding to pause if the value is thrown by the frame. When we are
+    // pausing on exceptions then we only want to pause when the youngest frame
+    // throws a particular exception, instead of for all older frames as well.
+    this._handledFrameExceptions = new WeakMap();
+
     this.global = global;
 
     this.onNewSourceEvent = this.onNewSourceEvent.bind(this);
     this.onUpdatedSourceEvent = this.onUpdatedSourceEvent.bind(this);
 
     this.uncaughtExceptionHook = this.uncaughtExceptionHook.bind(this);
     this.createCompletionGrip = this.createCompletionGrip.bind(this);
     this.onDebuggerStatement = this.onDebuggerStatement.bind(this);
@@ -1560,16 +1566,21 @@ const ThreadActor = ActorClassWithSpec(t
         break;
       }
     }
 
     if (willBeCaught && this._options.ignoreCaughtExceptions) {
       return undefined;
     }
 
+    if (this._handledFrameExceptions.has(youngestFrame) &&
+        this._handledFrameExceptions.get(youngestFrame) === value) {
+      return undefined;
+    }
+
     // NS_ERROR_NO_INTERFACE exceptions are a special case in browser code,
     // since they're almost always thrown by QueryInterface functions, and
     // handled cleanly by native code.
     if (value == Cr.NS_ERROR_NO_INTERFACE) {
       return undefined;
     }
 
     const { generatedSourceActor } = this.sources.getFrameLocation(youngestFrame);
@@ -1580,16 +1591,22 @@ const ThreadActor = ActorClassWithSpec(t
     if (this.insideClientEvaluation) {
       return undefined;
     }
 
     if (this.skipBreakpoints || this.sources.isBlackBoxed(url)) {
       return undefined;
     }
 
+    // Now that we've decided to pause, ignore this exception if it's thrown by
+    // any older frames.
+    for (let frame = youngestFrame.older; frame != null; frame = frame.older) {
+      this._handledFrameExceptions.set(frame, value);
+    }
+
     try {
       const packet = this._paused(youngestFrame);
       if (!packet) {
         return undefined;
       }
 
       packet.why = { type: "exception",
                      exception: createValueGrip(value, this._pausePool,
--- a/devtools/server/tests/unit/test_ignore_no_interface_exceptions.js
+++ b/devtools/server/tests/unit/test_ignore_no_interface_exceptions.js
@@ -5,22 +5,19 @@
 
 /**
  * Test that the debugger automatically ignores NS_ERROR_NO_INTERFACE
  * exceptions, but not normal ones.
  */
 
 add_task(threadClientTest(async ({ threadClient, debuggee, client }) => {
   await threadClient.pauseOnExceptions(true, false);
-  await executeOnNextTickAndWaitForPause(() => evaluateTestCode(debuggee), client);
-
-  await resume(threadClient);
-  const paused = await waitForPause(client);
-  Assert.equal(paused.why.type, "exception");
-  equal(paused.frame.where.line, 12, "paused at throw");
+  const paused =
+    await executeOnNextTickAndWaitForPause(() => evaluateTestCode(debuggee), client);
+  equal(paused.frame.where.line, 6, "paused at throw");
 
   await resume(threadClient);
 }, {
   // Bug 1508289, exception tests fails in worker scope
   doNotRunWorker: true,
 }));
 
 function evaluateTestCode(debuggee) {
--- 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/SVGAnimatedViewBox.cpp
+++ b/dom/svg/SVGAnimatedViewBox.cpp
@@ -14,29 +14,28 @@
 #include "nsTextFormatter.h"
 
 using namespace mozilla::dom;
 
 namespace mozilla {
 
 #define NUM_VIEWBOX_COMPONENTS 4
 
-/* Implementation of SVGViewBoxRect methods */
+/* Implementation of SVGViewBox methods */
 
-bool SVGViewBoxRect::operator==(const SVGViewBoxRect& aOther) const {
+bool SVGViewBox::operator==(const SVGViewBox& aOther) const {
   if (&aOther == this) return true;
 
   return (none && aOther.none) ||
          (!none && !aOther.none && x == aOther.x && y == aOther.y &&
           width == aOther.width && height == aOther.height);
 }
 
 /* static */
-nsresult SVGViewBoxRect::FromString(const nsAString& aStr,
-                                    SVGViewBoxRect* aViewBox) {
+nsresult SVGViewBox::FromString(const nsAString& aStr, SVGViewBox* aViewBox) {
   if (aStr.EqualsLiteral("none")) {
     aViewBox->none = true;
     return NS_OK;
   }
 
   nsCharSeparatedTokenizerTemplate<nsContentUtils::IsHTMLWhitespace> tokenizer(
       aStr, ',', nsCharSeparatedTokenizer::SEPARATOR_OPTIONAL);
   float vals[NUM_VIEWBOX_COMPONENTS];
@@ -102,43 +101,43 @@ void SVGAnimatedViewBox::Init() {
   mBaseVal.none = true;
 
   mAnimVal = nullptr;
 }
 
 bool SVGAnimatedViewBox::HasRect() const {
   // Check mAnimVal if we have one; otherwise, check mBaseVal if we have one;
   // otherwise, just return false (we clearly do not have a rect).
-  const SVGViewBoxRect* rect = mAnimVal;
+  const SVGViewBox* rect = mAnimVal;
   if (!rect) {
     if (!mHasBaseVal) {
       // no anim val, no base val --> no viewbox rect
       return false;
     }
     rect = &mBaseVal;
   }
 
   return !rect->none && rect->width >= 0 && rect->height >= 0;
 }
 
-void SVGAnimatedViewBox::SetAnimValue(const SVGViewBoxRect& aRect,
+void SVGAnimatedViewBox::SetAnimValue(const SVGViewBox& aRect,
                                       SVGElement* aSVGElement) {
   if (!mAnimVal) {
     // it's okay if allocation fails - and no point in reporting that
-    mAnimVal = new SVGViewBoxRect(aRect);
+    mAnimVal = new SVGViewBox(aRect);
   } else {
     if (aRect == *mAnimVal) {
       return;
     }
     *mAnimVal = aRect;
   }
   aSVGElement->DidAnimateViewBox();
 }
 
-void SVGAnimatedViewBox::SetBaseValue(const SVGViewBoxRect& aRect,
+void SVGAnimatedViewBox::SetBaseValue(const SVGViewBox& aRect,
                                       SVGElement* aSVGElement) {
   if (!mHasBaseVal || mBaseVal == aRect) {
     // This method is used to set a single x, y, width
     // or height value. It can't create a base value
     // as the other components may be undefined. We record
     // the new value though, so as not to lose data.
     mBaseVal = aRect;
     return;
@@ -153,19 +152,19 @@ void SVGAnimatedViewBox::SetBaseValue(co
   if (mAnimVal) {
     aSVGElement->AnimationNeedsResample();
   }
 }
 
 nsresult SVGAnimatedViewBox::SetBaseValueString(const nsAString& aValue,
                                                 SVGElement* aSVGElement,
                                                 bool aDoSetAttr) {
-  SVGViewBoxRect viewBox;
+  SVGViewBox viewBox;
 
-  nsresult rv = SVGViewBoxRect::FromString(aValue, &viewBox);
+  nsresult rv = SVGViewBox::FromString(aValue, &viewBox);
   if (NS_FAILED(rv)) {
     return rv;
   }
   // Comparison against mBaseVal is only valid if we currently have a base val.
   if (mHasBaseVal && viewBox == mBaseVal) {
     return NS_OK;
   }
 
@@ -242,77 +241,77 @@ already_AddRefed<SVGIRect> SVGAnimatedVi
   return domAnimVal.forget();
 }
 
 SVGAnimatedViewBox::DOMAnimVal::~DOMAnimVal() {
   sAnimSVGViewBoxTearoffTable.RemoveTearoff(mVal);
 }
 
 void SVGAnimatedViewBox::DOMBaseVal::SetX(float aX, ErrorResult& aRv) {
-  SVGViewBoxRect rect = mVal->GetBaseValue();
+  SVGViewBox rect = mVal->GetBaseValue();
   rect.x = aX;
   mVal->SetBaseValue(rect, mSVGElement);
 }
 
 void SVGAnimatedViewBox::DOMBaseVal::SetY(float aY, ErrorResult& aRv) {
-  SVGViewBoxRect rect = mVal->GetBaseValue();
+  SVGViewBox rect = mVal->GetBaseValue();
   rect.y = aY;
   mVal->SetBaseValue(rect, mSVGElement);
 }
 
 void SVGAnimatedViewBox::DOMBaseVal::SetWidth(float aWidth, ErrorResult& aRv) {
-  SVGViewBoxRect rect = mVal->GetBaseValue();
+  SVGViewBox rect = mVal->GetBaseValue();
   rect.width = aWidth;
   mVal->SetBaseValue(rect, mSVGElement);
 }
 
 void SVGAnimatedViewBox::DOMBaseVal::SetHeight(float aHeight,
                                                ErrorResult& aRv) {
-  SVGViewBoxRect rect = mVal->GetBaseValue();
+  SVGViewBox rect = mVal->GetBaseValue();
   rect.height = aHeight;
   mVal->SetBaseValue(rect, mSVGElement);
 }
 
 UniquePtr<SMILAttr> SVGAnimatedViewBox::ToSMILAttr(SVGElement* aSVGElement) {
   return MakeUnique<SMILViewBox>(this, aSVGElement);
 }
 
 nsresult SVGAnimatedViewBox::SMILViewBox ::ValueFromString(
     const nsAString& aStr, const SVGAnimationElement* /*aSrcElement*/,
     SMILValue& aValue, bool& aPreventCachingOfSandwich) const {
-  SVGViewBoxRect viewBox;
-  nsresult res = SVGViewBoxRect::FromString(aStr, &viewBox);
+  SVGViewBox viewBox;
+  nsresult res = SVGViewBox::FromString(aStr, &viewBox);
   if (NS_FAILED(res)) {
     return res;
   }
   SMILValue val(&SVGViewBoxSMILType::sSingleton);
-  *static_cast<SVGViewBoxRect*>(val.mU.mPtr) = viewBox;
+  *static_cast<SVGViewBox*>(val.mU.mPtr) = viewBox;
   aValue = std::move(val);
   aPreventCachingOfSandwich = false;
 
   return NS_OK;
 }
 
 SMILValue SVGAnimatedViewBox::SMILViewBox::GetBaseValue() const {
   SMILValue val(&SVGViewBoxSMILType::sSingleton);
-  *static_cast<SVGViewBoxRect*>(val.mU.mPtr) = mVal->mBaseVal;
+  *static_cast<SVGViewBox*>(val.mU.mPtr) = mVal->mBaseVal;
   return val;
 }
 
 void SVGAnimatedViewBox::SMILViewBox::ClearAnimValue() {
   if (mVal->mAnimVal) {
     mVal->mAnimVal = nullptr;
     mSVGElement->DidAnimateViewBox();
   }
 }
 
 nsresult SVGAnimatedViewBox::SMILViewBox::SetAnimValue(
     const SMILValue& aValue) {
   NS_ASSERTION(aValue.mType == &SVGViewBoxSMILType::sSingleton,
                "Unexpected type to assign animated value");
   if (aValue.mType == &SVGViewBoxSMILType::sSingleton) {
-    SVGViewBoxRect& vb = *static_cast<SVGViewBoxRect*>(aValue.mU.mPtr);
+    SVGViewBox& vb = *static_cast<SVGViewBox*>(aValue.mU.mPtr);
     mVal->SetAnimValue(vb, mSVGElement);
   }
   return NS_OK;
 }
 
 }  // namespace mozilla
--- a/dom/svg/SVGAnimatedViewBox.h
+++ b/dom/svg/SVGAnimatedViewBox.h
@@ -21,33 +21,33 @@ namespace mozilla {
 
 class SMILValue;
 
 namespace dom {
 class SVGAnimationElement;
 class SVGElement;
 }  // namespace dom
 
-struct SVGViewBoxRect {
+struct SVGViewBox {
   float x, y;
   float width, height;
   bool none;
 
-  SVGViewBoxRect() : x(0.0), y(0.0), width(0.0), height(0.0), none(true) {}
-  SVGViewBoxRect(float aX, float aY, float aWidth, float aHeight)
+  SVGViewBox() : x(0.0), y(0.0), width(0.0), height(0.0), none(true) {}
+  SVGViewBox(float aX, float aY, float aWidth, float aHeight)
       : x(aX), y(aY), width(aWidth), height(aHeight), none(false) {}
-  SVGViewBoxRect(const SVGViewBoxRect& rhs)
+  SVGViewBox(const SVGViewBox& rhs)
       : x(rhs.x),
         y(rhs.y),
         width(rhs.width),
         height(rhs.height),
         none(rhs.none) {}
-  bool operator==(const SVGViewBoxRect& aOther) const;
+  bool operator==(const SVGViewBox& aOther) const;
 
-  static nsresult FromString(const nsAString& aStr, SVGViewBoxRect* aViewBox);
+  static nsresult FromString(const nsAString& aStr, SVGViewBox* aViewBox);
 };
 
 class SVGAnimatedViewBox {
  public:
   typedef mozilla::dom::SVGElement SVGElement;
 
   void Init();
 
@@ -61,28 +61,28 @@ class SVGAnimatedViewBox {
   bool HasRect() const;
 
   /**
    * Returns true if the corresponding "viewBox" attribute either defined a
    * rectangle with finite values or the special "none" value.
    */
   bool IsExplicitlySet() const {
     if (mAnimVal || mHasBaseVal) {
-      const SVGViewBoxRect& rect = GetAnimValue();
+      const SVGViewBox& rect = GetAnimValue();
       return rect.none || (rect.width >= 0 && rect.height >= 0);
     }
     return false;
   }
 
-  const SVGViewBoxRect& GetBaseValue() const { return mBaseVal; }
-  void SetBaseValue(const SVGViewBoxRect& aRect, SVGElement* aSVGElement);
-  const SVGViewBoxRect& GetAnimValue() const {
+  const SVGViewBox& GetBaseValue() const { return mBaseVal; }
+  void SetBaseValue(const SVGViewBox& aRect, SVGElement* aSVGElement);
+  const SVGViewBox& GetAnimValue() const {
     return mAnimVal ? *mAnimVal : mBaseVal;
   }
-  void SetAnimValue(const SVGViewBoxRect& aRect, SVGElement* aSVGElement);
+  void SetAnimValue(const SVGViewBox& aRect, SVGElement* aSVGElement);
 
   nsresult SetBaseValueString(const nsAString& aValue, SVGElement* aSVGElement,
                               bool aDoSetAttr);
   void GetBaseValueString(nsAString& aValue) const;
 
   already_AddRefed<mozilla::dom::SVGAnimatedRect> ToSVGAnimatedRect(
       SVGElement* aSVGElement);
 
@@ -90,18 +90,18 @@ class SVGAnimatedViewBox {
       SVGElement* aSVGElement);
 
   already_AddRefed<mozilla::dom::SVGIRect> ToDOMAnimVal(
       SVGElement* aSVGElement);
 
   mozilla::UniquePtr<SMILAttr> ToSMILAttr(SVGElement* aSVGElement);
 
  private:
-  SVGViewBoxRect mBaseVal;
-  nsAutoPtr<SVGViewBoxRect> mAnimVal;
+  SVGViewBox mBaseVal;
+  nsAutoPtr<SVGViewBox> mAnimVal;
   bool mHasBaseVal;
 
  public:
   struct DOMBaseVal final : public mozilla::dom::SVGIRect {
     NS_DECL_CYCLE_COLLECTING_ISUPPORTS
     NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(DOMBaseVal)
 
     DOMBaseVal(SVGAnimatedViewBox* aVal, SVGElement* aSVGElement)
--- 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
@@ -168,30 +168,30 @@ nsresult SVGElement::Init() {
   }
 
   EnumAttributesInfo enumInfo = GetEnumInfo();
 
   for (i = 0; i < enumInfo.mEnumCount; i++) {
     enumInfo.Reset(i);
   }
 
-  SVGAnimatedOrient* orient = GetOrient();
+  SVGAnimatedOrient* orient = GetAnimatedOrient();
 
   if (orient) {
     orient->Init();
   }
 
-  SVGAnimatedViewBox* viewBox = GetViewBox();
+  SVGAnimatedViewBox* viewBox = GetAnimatedViewBox();
 
   if (viewBox) {
     viewBox->Init();
   }
 
   SVGAnimatedPreserveAspectRatio* preserveAspectRatio =
-      GetPreserveAspectRatio();
+      GetAnimatedPreserveAspectRatio();
 
   if (preserveAspectRatio) {
     preserveAspectRatio->Init();
   }
 
   LengthListAttributesInfo lengthListInfo = GetLengthListInfo();
 
   for (i = 0; i < lengthListInfo.mLengthListCount; i++) {
@@ -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);
@@ -527,44 +527,44 @@ bool SVGElement::ParseAttribute(int32_t 
           break;
         }
       }
     }
 
     if (!foundMatch) {
       // Check for orient attribute
       if (aAttribute == nsGkAtoms::orient) {
-        SVGAnimatedOrient* orient = GetOrient();
+        SVGAnimatedOrient* orient = GetAnimatedOrient();
         if (orient) {
           rv = orient->SetBaseValueString(aValue, this, false);
           if (NS_FAILED(rv)) {
             orient->Init();
           } else {
             aResult.SetTo(*orient, &aValue);
             didSetResult = true;
           }
           foundMatch = true;
         }
         // Check for viewBox attribute
       } else if (aAttribute == nsGkAtoms::viewBox) {
-        SVGAnimatedViewBox* viewBox = GetViewBox();
+        SVGAnimatedViewBox* viewBox = GetAnimatedViewBox();
         if (viewBox) {
           rv = viewBox->SetBaseValueString(aValue, this, false);
           if (NS_FAILED(rv)) {
             viewBox->Init();
           } else {
             aResult.SetTo(*viewBox, &aValue);
             didSetResult = true;
           }
           foundMatch = true;
         }
         // Check for preserveAspectRatio attribute
       } else if (aAttribute == nsGkAtoms::preserveAspectRatio) {
         SVGAnimatedPreserveAspectRatio* preserveAspectRatio =
-            GetPreserveAspectRatio();
+            GetAnimatedPreserveAspectRatio();
         if (preserveAspectRatio) {
           rv = preserveAspectRatio->SetBaseValueString(aValue, this, false);
           if (NS_FAILED(rv)) {
             preserveAspectRatio->Init();
           } else {
             aResult.SetTo(*preserveAspectRatio, &aValue);
             didSetResult = true;
           }
@@ -763,38 +763,38 @@ void SVGElement::UnsetAttrInternal(int32
       if (aName == enumInfo.mEnumInfo[i].mName) {
         enumInfo.Reset(i);
         return;
       }
     }
 
     // Check if this is an orient attribute going away
     if (aName == nsGkAtoms::orient) {
-      SVGAnimatedOrient* orient = GetOrient();
+      SVGAnimatedOrient* orient = GetAnimatedOrient();
       if (orient) {
         MaybeSerializeAttrBeforeRemoval(aName, aNotify);
         orient->Init();
         return;
       }
     }
 
     // Check if this is a viewBox attribute going away
     if (aName == nsGkAtoms::viewBox) {
-      SVGAnimatedViewBox* viewBox = GetViewBox();
+      SVGAnimatedViewBox* viewBox = GetAnimatedViewBox();
       if (viewBox) {
         MaybeSerializeAttrBeforeRemoval(aName, aNotify);
         viewBox->Init();
         return;
       }
     }
 
     // Check if this is a preserveAspectRatio attribute going away
     if (aName == nsGkAtoms::preserveAspectRatio) {
       SVGAnimatedPreserveAspectRatio* preserveAspectRatio =
-          GetPreserveAspectRatio();
+          GetAnimatedPreserveAspectRatio();
       if (preserveAspectRatio) {
         MaybeSerializeAttrBeforeRemoval(aName, aNotify);
         preserveAspectRatio->Init();
         return;
       }
     }
 
     // Check if this is a transform list attribute going away
@@ -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");
@@ -1880,24 +1880,24 @@ void SVGElement::DidAnimateEnum(uint8_t 
 
   if (frame) {
     EnumAttributesInfo info = GetEnumInfo();
     frame->AttributeChanged(kNameSpaceID_None, info.mEnumInfo[aAttrEnum].mName,
                             MutationEvent_Binding::SMIL);
   }
 }
 
-SVGAnimatedOrient* SVGElement::GetOrient() { return nullptr; }
+SVGAnimatedOrient* SVGElement::GetAnimatedOrient() { return nullptr; }
 
 nsAttrValue SVGElement::WillChangeOrient() {
   return WillChangeValue(nsGkAtoms::orient);
 }
 
 void SVGElement::DidChangeOrient(const nsAttrValue& aEmptyOrOldValue) {
-  SVGAnimatedOrient* orient = GetOrient();
+  SVGAnimatedOrient* orient = GetAnimatedOrient();
 
   NS_ASSERTION(orient, "DidChangeOrient on element with no orient attrib");
 
   nsAttrValue newValue;
   newValue.SetTo(*orient, nullptr);
 
   DidChangeValue(nsGkAtoms::orient, aEmptyOrOldValue, newValue);
 }
@@ -1906,24 +1906,24 @@ void SVGElement::DidAnimateOrient() {
   nsIFrame* frame = GetPrimaryFrame();
 
   if (frame) {
     frame->AttributeChanged(kNameSpaceID_None, nsGkAtoms::orient,
                             MutationEvent_Binding::SMIL);
   }
 }
 
-SVGAnimatedViewBox* SVGElement::GetViewBox() { return nullptr; }
+SVGAnimatedViewBox* SVGElement::GetAnimatedViewBox() { return nullptr; }
 
 nsAttrValue SVGElement::WillChangeViewBox() {
   return WillChangeValue(nsGkAtoms::viewBox);
 }
 
 void SVGElement::DidChangeViewBox(const nsAttrValue& aEmptyOrOldValue) {
-  SVGAnimatedViewBox* viewBox = GetViewBox();
+  SVGAnimatedViewBox* viewBox = GetAnimatedViewBox();
 
   NS_ASSERTION(viewBox, "DidChangeViewBox on element with no viewBox attrib");
 
   nsAttrValue newValue;
   newValue.SetTo(*viewBox, nullptr);
 
   DidChangeValue(nsGkAtoms::viewBox, aEmptyOrOldValue, newValue);
 }
@@ -1932,28 +1932,28 @@ void SVGElement::DidAnimateViewBox() {
   nsIFrame* frame = GetPrimaryFrame();
 
   if (frame) {
     frame->AttributeChanged(kNameSpaceID_None, nsGkAtoms::viewBox,
                             MutationEvent_Binding::SMIL);
   }
 }
 
-SVGAnimatedPreserveAspectRatio* SVGElement::GetPreserveAspectRatio() {
+SVGAnimatedPreserveAspectRatio* SVGElement::GetAnimatedPreserveAspectRatio() {
   return nullptr;
 }
 
 nsAttrValue SVGElement::WillChangePreserveAspectRatio() {
   return WillChangeValue(nsGkAtoms::preserveAspectRatio);
 }
 
 void SVGElement::DidChangePreserveAspectRatio(
     const nsAttrValue& aEmptyOrOldValue) {
   SVGAnimatedPreserveAspectRatio* preserveAspectRatio =
-      GetPreserveAspectRatio();
+      GetAnimatedPreserveAspectRatio();
 
   NS_ASSERTION(preserveAspectRatio,
                "DidChangePreserveAspectRatio on element with no "
                "preserveAspectRatio attrib");
 
   nsAttrValue newValue;
   newValue.SetTo(*preserveAspectRatio, nullptr);
 
@@ -2217,30 +2217,30 @@ UniquePtr<SMILAttr> SVGElement::GetAnima
         if (aName == info.mBooleanInfo[i].mName) {
           return info.mBooleans[i].ToSMILAttr(this);
         }
       }
     }
 
     // orient:
     if (aName == nsGkAtoms::orient) {
-      SVGAnimatedOrient* orient = GetOrient();
+      SVGAnimatedOrient* orient = GetAnimatedOrient();
       return orient ? orient->ToSMILAttr(this) : nullptr;
     }
 
     // viewBox:
     if (aName == nsGkAtoms::viewBox) {
-      SVGAnimatedViewBox* viewBox = GetViewBox();
+      SVGAnimatedViewBox* viewBox = GetAnimatedViewBox();
       return viewBox ? viewBox->ToSMILAttr(this) : nullptr;
     }
 
     // preserveAspectRatio:
     if (aName == nsGkAtoms::preserveAspectRatio) {
       SVGAnimatedPreserveAspectRatio* preserveAspectRatio =
-          GetPreserveAspectRatio();
+          GetAnimatedPreserveAspectRatio();
       return preserveAspectRatio ? preserveAspectRatio->ToSMILAttr(this)
                                  : nullptr;
     }
 
     // NumberLists:
     {
       NumberListAttributesInfo info = GetNumberListInfo();
       for (uint32_t i = 0; i < info.mNumberListCount; i++) {
--- 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);
   };
 
@@ -563,19 +562,19 @@ class SVGElement : public SVGElementBase
   virtual NumberAttributesInfo GetNumberInfo();
   virtual NumberPairAttributesInfo GetNumberPairInfo();
   virtual IntegerAttributesInfo GetIntegerInfo();
   virtual IntegerPairAttributesInfo GetIntegerPairInfo();
   virtual BooleanAttributesInfo GetBooleanInfo();
   virtual EnumAttributesInfo GetEnumInfo();
   // We assume all orients, viewboxes and preserveAspectRatios are alike
   // so we don't need to wrap the class
-  virtual SVGAnimatedOrient* GetOrient();
-  virtual SVGAnimatedPreserveAspectRatio* GetPreserveAspectRatio();
-  virtual SVGAnimatedViewBox* GetViewBox();
+  virtual SVGAnimatedOrient* GetAnimatedOrient();
+  virtual SVGAnimatedPreserveAspectRatio* GetAnimatedPreserveAspectRatio();
+  virtual SVGAnimatedViewBox* GetAnimatedViewBox();
   virtual NumberListAttributesInfo GetNumberListInfo();
   virtual LengthListAttributesInfo GetLengthListInfo();
   virtual StringAttributesInfo GetStringInfo();
   virtual StringListAttributesInfo GetStringListInfo();
 
   static SVGEnumMapping sSVGUnitTypesMap[];
 
  private:
--- 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/SVGFEImageElement.cpp
+++ b/dom/svg/SVGFEImageElement.cpp
@@ -279,17 +279,18 @@ bool SVGFEImageElement::OutputIsTainted(
 //----------------------------------------------------------------------
 // SVGElement methods
 
 already_AddRefed<DOMSVGAnimatedPreserveAspectRatio>
 SVGFEImageElement::PreserveAspectRatio() {
   return mPreserveAspectRatio.ToDOMAnimatedPreserveAspectRatio(this);
 }
 
-SVGAnimatedPreserveAspectRatio* SVGFEImageElement::GetPreserveAspectRatio() {
+SVGAnimatedPreserveAspectRatio*
+SVGFEImageElement::GetAnimatedPreserveAspectRatio() {
   return &mPreserveAspectRatio;
 }
 
 SVGElement::StringAttributesInfo SVGFEImageElement::GetStringInfo() {
   return StringAttributesInfo(mStringAttributes, sStringInfo,
                               ArrayLength(sStringInfo));
 }
 
--- a/dom/svg/SVGFEImageElement.h
+++ b/dom/svg/SVGFEImageElement.h
@@ -83,17 +83,18 @@ class SVGFEImageElement final : public S
   already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
 
  private:
   nsresult LoadSVGImage(bool aForce, bool aNotify);
 
  protected:
   virtual bool ProducesSRGB() override { return true; }
 
-  virtual SVGAnimatedPreserveAspectRatio* GetPreserveAspectRatio() override;
+  virtual SVGAnimatedPreserveAspectRatio* GetAnimatedPreserveAspectRatio()
+      override;
   virtual StringAttributesInfo GetStringInfo() override;
 
   // Override for nsImageLoadingContent.
   nsIContent* AsContent() override { return this; }
 
   enum { RESULT, HREF, XLINK_HREF };
   SVGAnimatedString mStringAttributes[3];
   static StringInfo sStringInfo[3];
--- 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.cpp
+++ b/dom/svg/SVGImageElement.cpp
@@ -274,17 +274,18 @@ bool SVGImageElement::HasValidDimensions
          mLengthAttributes[ATTR_HEIGHT].GetAnimValInSpecifiedUnits() > 0;
 }
 
 SVGElement::LengthAttributesInfo SVGImageElement::GetLengthInfo() {
   return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
                               ArrayLength(sLengthInfo));
 }
 
-SVGAnimatedPreserveAspectRatio* SVGImageElement::GetPreserveAspectRatio() {
+SVGAnimatedPreserveAspectRatio*
+SVGImageElement::GetAnimatedPreserveAspectRatio() {
   return &mPreserveAspectRatio;
 }
 
 SVGElement::StringAttributesInfo SVGImageElement::GetStringInfo() {
   return StringAttributesInfo(mStringAttributes, sStringInfo,
                               ArrayLength(sStringInfo));
 }
 
--- 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;
@@ -94,24 +94,25 @@ class SVGImageElement : public SVGImageE
   void GetDecoding(nsAString& aValue);
 
   already_AddRefed<Promise> Decode(ErrorResult& aRv);
 
  protected:
   nsresult LoadSVGImage(bool aForce, bool aNotify);
 
   virtual LengthAttributesInfo GetLengthInfo() override;
-  virtual SVGAnimatedPreserveAspectRatio* GetPreserveAspectRatio() override;
+  virtual SVGAnimatedPreserveAspectRatio* GetAnimatedPreserveAspectRatio()
+      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.cpp
+++ b/dom/svg/SVGMarkerElement.cpp
@@ -160,21 +160,22 @@ SVGElement::LengthAttributesInfo SVGMark
   return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
                               ArrayLength(sLengthInfo));
 }
 
 SVGElement::EnumAttributesInfo SVGMarkerElement::GetEnumInfo() {
   return EnumAttributesInfo(mEnumAttributes, sEnumInfo, ArrayLength(sEnumInfo));
 }
 
-SVGAnimatedOrient* SVGMarkerElement::GetOrient() { return &mOrient; }
+SVGAnimatedOrient* SVGMarkerElement::GetAnimatedOrient() { return &mOrient; }
 
-SVGAnimatedViewBox* SVGMarkerElement::GetViewBox() { return &mViewBox; }
+SVGAnimatedViewBox* SVGMarkerElement::GetAnimatedViewBox() { return &mViewBox; }
 
-SVGAnimatedPreserveAspectRatio* SVGMarkerElement::GetPreserveAspectRatio() {
+SVGAnimatedPreserveAspectRatio*
+SVGMarkerElement::GetAnimatedPreserveAspectRatio() {
   return &mPreserveAspectRatio;
 }
 
 //----------------------------------------------------------------------
 // public helpers
 
 gfx::Matrix SVGMarkerElement::GetMarkerTransform(float aStrokeWidth,
                                                  const SVGMark& aMark) {
@@ -195,33 +196,33 @@ gfx::Matrix SVGMarkerElement::GetMarkerT
       angle = mOrient.GetAnimValue() * M_PI / 180.0f;
       break;
   }
 
   return gfx::Matrix(cos(angle) * scale, sin(angle) * scale,
                      -sin(angle) * scale, cos(angle) * scale, aMark.x, aMark.y);
 }
 
-SVGViewBoxRect SVGMarkerElement::GetViewBoxRect() {
+SVGViewBox SVGMarkerElement::GetViewBox() {
   if (mViewBox.HasRect()) {
     return mViewBox.GetAnimValue();
   }
-  return SVGViewBoxRect(
-      0, 0, mLengthAttributes[MARKERWIDTH].GetAnimValue(mCoordCtx),
-      mLengthAttributes[MARKERHEIGHT].GetAnimValue(mCoordCtx));
+  return SVGViewBox(0, 0,
+                    mLengthAttributes[MARKERWIDTH].GetAnimValue(mCoordCtx),
+                    mLengthAttributes[MARKERHEIGHT].GetAnimValue(mCoordCtx));
 }
 
 gfx::Matrix SVGMarkerElement::GetViewBoxTransform() {
   if (!mViewBoxToViewportTransform) {
     float viewportWidth =
         mLengthAttributes[MARKERWIDTH].GetAnimValue(mCoordCtx);
     float viewportHeight =
         mLengthAttributes[MARKERHEIGHT].GetAnimValue(mCoordCtx);
 
-    SVGViewBoxRect viewbox = GetViewBoxRect();
+    SVGViewBox viewbox = GetViewBox();
 
     MOZ_ASSERT(viewbox.width > 0.0f && viewbox.height > 0.0f,
                "Rendering should be disabled");
 
     gfx::Matrix viewBoxTM = SVGContentUtils::GetViewBoxTransform(
         viewportWidth, viewportHeight, viewbox.x, viewbox.y, viewbox.width,
         viewbox.height, mPreserveAspectRatio);
 
--- 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;
@@ -51,17 +51,17 @@ class SVGMarkerElement : public SVGMarke
   // nsIContent interface
   NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* name) const override;
 
   // nsSVGSVGElement methods:
   virtual bool HasValidDimensions() const override;
 
   // public helpers
   gfx::Matrix GetMarkerTransform(float aStrokeWidth, const SVGMark& aMark);
-  SVGViewBoxRect GetViewBoxRect();
+  SVGViewBox GetViewBox();
   gfx::Matrix GetViewBoxTransform();
 
   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
 
   // WebIDL
   already_AddRefed<SVGAnimatedRect> ViewBox();
   already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
   already_AddRefed<DOMSVGAnimatedLength> RefX();
@@ -74,22 +74,23 @@ class SVGMarkerElement : public SVGMarke
   void SetOrientToAuto();
   void SetOrientToAngle(DOMSVGAngle& angle, ErrorResult& rv);
 
  protected:
   void SetParentCoordCtxProvider(SVGViewportElement* aContext);
 
   virtual LengthAttributesInfo GetLengthInfo() override;
   virtual EnumAttributesInfo GetEnumInfo() override;
-  virtual SVGAnimatedOrient* GetOrient() override;
-  virtual SVGAnimatedPreserveAspectRatio* GetPreserveAspectRatio() override;
-  virtual SVGAnimatedViewBox* GetViewBox() override;
+  virtual SVGAnimatedOrient* GetAnimatedOrient() override;
+  virtual SVGAnimatedPreserveAspectRatio* GetAnimatedPreserveAspectRatio()
+      override;
+  virtual SVGAnimatedViewBox* GetAnimatedViewBox() 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.cpp
+++ b/dom/svg/SVGPatternElement.cpp
@@ -157,19 +157,22 @@ SVGElement::LengthAttributesInfo SVGPatt
   return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
                               ArrayLength(sLengthInfo));
 }
 
 SVGElement::EnumAttributesInfo SVGPatternElement::GetEnumInfo() {
   return EnumAttributesInfo(mEnumAttributes, sEnumInfo, ArrayLength(sEnumInfo));
 }
 
-SVGAnimatedViewBox* SVGPatternElement::GetViewBox() { return &mViewBox; }
+SVGAnimatedViewBox* SVGPatternElement::GetAnimatedViewBox() {
+  return &mViewBox;
+}
 
-SVGAnimatedPreserveAspectRatio* SVGPatternElement::GetPreserveAspectRatio() {
+SVGAnimatedPreserveAspectRatio*
+SVGPatternElement::GetAnimatedPreserveAspectRatio() {
   return &mPreserveAspectRatio;
 }
 
 SVGElement::StringAttributesInfo SVGPatternElement::GetStringInfo() {
   return StringAttributesInfo(mStringAttributes, sStringInfo,
                               ArrayLength(sStringInfo));
 }
 
--- 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;
 
@@ -68,21 +68,22 @@ class SVGPatternElement final : public S
   already_AddRefed<DOMSVGAnimatedLength> Width();
   already_AddRefed<DOMSVGAnimatedLength> Height();
   already_AddRefed<DOMSVGAnimatedString> Href();
 
  protected:
   virtual LengthAttributesInfo GetLengthInfo() override;
   virtual EnumAttributesInfo GetEnumInfo() override;
   virtual StringAttributesInfo GetStringInfo() override;
-  virtual SVGAnimatedPreserveAspectRatio* GetPreserveAspectRatio() override;
-  virtual SVGAnimatedViewBox* GetViewBox() override;
+  virtual SVGAnimatedPreserveAspectRatio* GetAnimatedPreserveAspectRatio()
+      override;
+  virtual SVGAnimatedViewBox* GetAnimatedViewBox() 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/SVGSVGElement.cpp
+++ b/dom/svg/SVGSVGElement.cpp
@@ -519,38 +519,38 @@ SVGElement::EnumAttributesInfo SVGSVGEle
   return EnumAttributesInfo(mEnumAttributes, sEnumInfo, ArrayLength(sEnumInfo));
 }
 
 void SVGSVGElement::SetImageOverridePreserveAspectRatio(
     const SVGPreserveAspectRatio& aPAR) {
   MOZ_ASSERT(OwnerDoc()->IsBeingUsedAsImage(),
              "should only override preserveAspectRatio in images");
 
-  bool hasViewBoxRect = HasViewBoxRect();
-  if (!hasViewBoxRect && ShouldSynthesizeViewBox()) {
+  bool hasViewBox = HasViewBox();
+  if (!hasViewBox && ShouldSynthesizeViewBox()) {
     // My non-<svg:image> clients will have been painting me with a synthesized
     // viewBox, but my <svg:image> client that's about to paint me now does NOT
     // want that.  Need to tell ourselves to flush our transform.
     mImageNeedsTransformInvalidation = true;
   }
 
-  if (!hasViewBoxRect) {
+  if (!hasViewBox) {
     return;  // preserveAspectRatio irrelevant (only matters if we have viewBox)
   }
 
   if (SetPreserveAspectRatioProperty(aPAR)) {
     mImageNeedsTransformInvalidation = true;
   }
 }
 
 void SVGSVGElement::ClearImageOverridePreserveAspectRatio() {
   MOZ_ASSERT(OwnerDoc()->IsBeingUsedAsImage(),
              "should only override image preserveAspectRatio in images");
 
-  if (!HasViewBoxRect() && ShouldSynthesizeViewBox()) {
+  if (!HasViewBox() && ShouldSynthesizeViewBox()) {
     // My non-<svg:image> clients will want to paint me with a synthesized
     // viewBox, but my <svg:image> client that just painted me did NOT
     // use that.  Need to tell ourselves to flush our transform.
     mImageNeedsTransformInvalidation = true;
   }
 
   if (ClearPreserveAspectRatioProperty()) {
     mImageNeedsTransformInvalidation = true;
@@ -598,19 +598,19 @@ SVGPreserveAspectRatio SVGSVGElement::Ge
         GetPreserveAspectRatioProperty();
     if (pAROverridePtr) {
       return *pAROverridePtr;
     }
   }
 
   SVGViewElement* viewElement = GetCurrentViewElement();
 
-  // This check is equivalent to "!HasViewBoxRect() &&
+  // This check is equivalent to "!HasViewBox() &&
   // ShouldSynthesizeViewBox()". We're just holding onto the viewElement that
-  // HasViewBoxRect() would look up, so that we don't have to look it up again
+  // HasViewBox() would look up, so that we don't have to look it up again
   // later.
   if (!((viewElement && viewElement->mViewBox.HasRect()) ||
         (mSVGView && mSVGView->mViewBox.HasRect()) || mViewBox.HasRect()) &&
       ShouldSynthesizeViewBox()) {
     // If we're synthesizing a viewBox, use preserveAspectRatio="none";
     return SVGPreserveAspectRatio(SVG_PRESERVEASPECTRATIO_NONE,
                                   SVG_MEETORSLICE_SLICE);
   }
--- 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/SVGViewBoxSMILType.cpp
+++ b/dom/svg/SVGViewBoxSMILType.cpp
@@ -14,46 +14,45 @@
 namespace mozilla {
 
 /*static*/
 SVGViewBoxSMILType SVGViewBoxSMILType::sSingleton;
 
 void SVGViewBoxSMILType::Init(SMILValue& aValue) const {
   MOZ_ASSERT(aValue.IsNull(), "Unexpected value type");
 
-  aValue.mU.mPtr = new SVGViewBoxRect();
+  aValue.mU.mPtr = new SVGViewBox();
   aValue.mType = this;
 }
 
 void SVGViewBoxSMILType::Destroy(SMILValue& aValue) const {
   MOZ_ASSERT(aValue.mType == this, "Unexpected SMIL value");
-  delete static_cast<SVGViewBoxRect*>(aValue.mU.mPtr);
+  delete static_cast<SVGViewBox*>(aValue.mU.mPtr);
   aValue.mU.mPtr = nullptr;
   aValue.mType = SMILNullType::Singleton();
 }
 
 nsresult SVGViewBoxSMILType::Assign(SMILValue& aDest,
                                     const SMILValue& aSrc) const {
   MOZ_ASSERT(aDest.mType == aSrc.mType, "Incompatible SMIL types");
   MOZ_ASSERT(aDest.mType == this, "Unexpected SMIL value");
 
-  const SVGViewBoxRect* src = static_cast<const SVGViewBoxRect*>(aSrc.mU.mPtr);
-  SVGViewBoxRect* dst = static_cast<SVGViewBoxRect*>(aDest.mU.mPtr);
+  const SVGViewBox* src = static_cast<const SVGViewBox*>(aSrc.mU.mPtr);
+  SVGViewBox* dst = static_cast<SVGViewBox*>(aDest.mU.mPtr);
   *dst = *src;
   return NS_OK;
 }
 
 bool SVGViewBoxSMILType::IsEqual(const SMILValue& aLeft,
                                  const SMILValue& aRight) const {
   MOZ_ASSERT(aLeft.mType == aRight.mType, "Incompatible SMIL types");
   MOZ_ASSERT(aLeft.mType == this, "Unexpected type for SMIL value");
 
-  const SVGViewBoxRect* leftBox =
-      static_cast<const SVGViewBoxRect*>(aLeft.mU.mPtr);
-  const SVGViewBoxRect* rightBox = static_cast<SVGViewBoxRect*>(aRight.mU.mPtr);
+  const SVGViewBox* leftBox = static_cast<const SVGViewBox*>(aLeft.mU.mPtr);
+  const SVGViewBox* rightBox = static_cast<SVGViewBox*>(aRight.mU.mPtr);
   return *leftBox == *rightBox;
 }
 
 nsresult SVGViewBoxSMILType::Add(SMILValue& aDest, const SMILValue& aValueToAdd,
                                  uint32_t aCount) const {
   MOZ_ASSERT(aValueToAdd.mType == aDest.mType, "Trying to add invalid types");
   MOZ_ASSERT(aValueToAdd.mType == this, "Unexpected source type");
 
@@ -65,19 +64,18 @@ nsresult SVGViewBoxSMILType::Add(SMILVal
 }
 
 nsresult SVGViewBoxSMILType::ComputeDistance(const SMILValue& aFrom,
                                              const SMILValue& aTo,
                                              double& aDistance) const {
   MOZ_ASSERT(aFrom.mType == aTo.mType, "Trying to compare different types");
   MOZ_ASSERT(aFrom.mType == this, "Unexpected source type");
 
-  const SVGViewBoxRect* from =
-      static_cast<const SVGViewBoxRect*>(aFrom.mU.mPtr);
-  const SVGViewBoxRect* to = static_cast<const SVGViewBoxRect*>(aTo.mU.mPtr);
+  const SVGViewBox* from = static_cast<const SVGViewBox*>(aFrom.mU.mPtr);
+  const SVGViewBox* to = static_cast<const SVGViewBox*>(aTo.mU.mPtr);
 
   if (from->none || to->none) {
     return NS_ERROR_FAILURE;
   }
 
   // We use the distances between the edges rather than the difference between
   // the x, y, width and height for the "distance". This is necessary in
   // order for the "distance" result that we calculate to be the same for a
@@ -99,31 +97,29 @@ nsresult SVGViewBoxSMILType::Interpolate
                                          const SMILValue& aEndVal,
                                          double aUnitDistance,
                                          SMILValue& aResult) const {
   MOZ_ASSERT(aStartVal.mType == aEndVal.mType,
              "Trying to interpolate different types");
   MOZ_ASSERT(aStartVal.mType == this, "Unexpected types for interpolation");
   MOZ_ASSERT(aResult.mType == this, "Unexpected result type");
 
-  const SVGViewBoxRect* start =
-      static_cast<const SVGViewBoxRect*>(aStartVal.mU.mPtr);
-  const SVGViewBoxRect* end =
-      static_cast<const SVGViewBoxRect*>(aEndVal.mU.mPtr);
+  const SVGViewBox* start = static_cast<const SVGViewBox*>(aStartVal.mU.mPtr);
+  const SVGViewBox* end = static_cast<const SVGViewBox*>(aEndVal.mU.mPtr);
 
   if (start->none || end->none) {
     return NS_ERROR_FAILURE;
   }
 
-  SVGViewBoxRect* current = static_cast<SVGViewBoxRect*>(aResult.mU.mPtr);
+  SVGViewBox* current = static_cast<SVGViewBox*>(aResult.mU.mPtr);
 
   float x = (start->x + (end->x - start->x) * aUnitDistance);
   float y = (start->y + (end->y - start->y) * aUnitDistance);
   float width = (start->width + (end->width - start->width) * aUnitDistance);
   float height =
       (start->height + (end->height - start->height) * aUnitDistance);
 
-  *current = SVGViewBoxRect(x, y, width, height);
+  *current = SVGViewBox(x, y, width, height);
 
   return NS_OK;
 }
 
 }  // namespace mozilla
--- a/dom/svg/SVGViewElement.cpp
+++ b/dom/svg/SVGViewElement.cpp
@@ -62,16 +62,17 @@ SVGViewElement::PreserveAspectRatio() {
 
 //----------------------------------------------------------------------
 // SVGElement methods
 
 SVGElement::EnumAttributesInfo SVGViewElement::GetEnumInfo() {
   return EnumAttributesInfo(mEnumAttributes, sEnumInfo, ArrayLength(sEnumInfo));
 }
 
-SVGAnimatedViewBox* SVGViewElement::GetViewBox() { return &mViewBox; }
+SVGAnimatedViewBox* SVGViewElement::GetAnimatedViewBox() { return &mViewBox; }
 
-SVGAnimatedPreserveAspectRatio* SVGViewElement::GetPreserveAspectRatio() {
+SVGAnimatedPreserveAspectRatio*
+SVGViewElement::GetAnimatedPreserveAspectRatio() {
   return &mPreserveAspectRatio;
 }
 
 }  // namespace dom
 }  // namespace mozilla
--- a/dom/svg/SVGViewElement.h
+++ b/dom/svg/SVGViewElement.h
@@ -53,18 +53,19 @@ class SVGViewElement : public SVGViewEle
 
   virtual EnumAttributesInfo GetEnumInfo() override;
 
   enum { ZOOMANDPAN };
   SVGAnimatedEnumeration mEnumAttributes[1];
   static SVGEnumMapping sZoomAndPanMap[];
   static EnumInfo sEnumInfo[1];
 
-  virtual SVGAnimatedViewBox* GetViewBox() override;
-  virtual SVGAnimatedPreserveAspectRatio* GetPreserveAspectRatio() override;
+  virtual SVGAnimatedViewBox* GetAnimatedViewBox() override;
+  virtual SVGAnimatedPreserveAspectRatio* GetAnimatedPreserveAspectRatio()
+      override;
 
   SVGAnimatedViewBox mViewBox;
   SVGAnimatedPreserveAspectRatio mPreserveAspectRatio;
 };
 
 }  // namespace dom
 }  // namespace mozilla
 
--- 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));
 }
 
@@ -180,34 +180,33 @@ gfx::Matrix SVGViewportElement::GetViewB
     viewportWidth = mViewportWidth;
     viewportHeight = mViewportHeight;
   }
 
   if (viewportWidth <= 0.0f || viewportHeight <= 0.0f) {
     return gfx::Matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);  // singular
   }
 
-  SVGViewBoxRect viewBox =
-      GetViewBoxWithSynthesis(viewportWidth, viewportHeight);
+  SVGViewBox viewBox = GetViewBoxWithSynthesis(viewportWidth, viewportHeight);
 
   if (viewBox.width <= 0.0f || viewBox.height <= 0.0f) {
     return gfx::Matrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);  // singular
   }
 
   return SVGContentUtils::GetViewBoxTransform(
       viewportWidth, viewportHeight, viewBox.x, viewBox.y, viewBox.width,
       viewBox.height, GetPreserveAspectRatioWithOverride());
 }
 //----------------------------------------------------------------------
 // SVGViewportElement
 
 float SVGViewportElement::GetLength(uint8_t aCtxType) {
-  const SVGViewBoxRect* viewbox = GetViewBoxInternal().HasRect()
-                                      ? &GetViewBoxInternal().GetAnimValue()
-                                      : nullptr;
+  const SVGViewBox* viewbox = GetViewBoxInternal().HasRect()
+                                  ? &GetViewBoxInternal().GetAnimValue()
+                                  : nullptr;
 
   float h = 0.0f, w = 0.0f;
   bool shouldComputeWidth =
            (aCtxType == SVGContentUtils::X || aCtxType == SVGContentUtils::XY),
        shouldComputeHeight =
            (aCtxType == SVGContentUtils::Y || aCtxType == SVGContentUtils::XY);
 
   if (viewbox) {
@@ -305,51 +304,54 @@ gfxMatrix SVGViewportElement::PrependLoc
 bool SVGViewportElement::HasValidDimensions() const {
   return !IsInner() ||
          ((!mLengthAttributes[ATTR_WIDTH].IsExplicitlySet() ||
            mLengthAttributes[ATTR_WIDTH].GetAnimValInSpecifiedUnits() > 0) &&
           (!mLengthAttributes[ATTR_HEIGHT].IsExplicitlySet() ||
            mLengthAttributes[ATTR_HEIGHT].GetAnimValInSpecifiedUnits() > 0));
 }
 
-SVGAnimatedViewBox* SVGViewportElement::GetViewBox() { return &mViewBox; }
+SVGAnimatedViewBox* SVGViewportElement::GetAnimatedViewBox() {
+  return &mViewBox;
+}
 
-SVGAnimatedPreserveAspectRatio* SVGViewportElement::GetPreserveAspectRatio() {
+SVGAnimatedPreserveAspectRatio*
+SVGViewportElement::GetAnimatedPreserveAspectRatio() {
   return &mPreserveAspectRatio;
 }
 
 bool SVGViewportElement::ShouldSynthesizeViewBox() const {
-  MOZ_ASSERT(!HasViewBoxRect(), "Should only be called if we lack a viewBox");
+  MOZ_ASSERT(!HasViewBox(), "Should only be called if we lack a viewBox");
 
   return IsRoot() && OwnerDoc()->IsBeingUsedAsImage();
 }
 
 //----------------------------------------------------------------------
 // implementation helpers
 
-SVGViewBoxRect SVGViewportElement::GetViewBoxWithSynthesis(
+SVGViewBox SVGViewportElement::GetViewBoxWithSynthesis(
     float aViewportWidth, float aViewportHeight) const {
   if (GetViewBoxInternal().HasRect()) {
     return GetViewBoxInternal().GetAnimValue();
   }
 
   if (ShouldSynthesizeViewBox()) {
     // Special case -- fake a viewBox, using height & width attrs.
     // (Use |this| as context, since if we get here, we're outermost <svg>.)
-    return SVGViewBoxRect(
+    return SVGViewBox(
         0, 0,
         ComputeSynthesizedViewBoxDimension(mLengthAttributes[ATTR_WIDTH],
                                            mViewportWidth, this),
         ComputeSynthesizedViewBoxDimension(mLengthAttributes[ATTR_HEIGHT],
                                            mViewportHeight, this));
   }
 
   // No viewBox attribute, so we shouldn't auto-scale. This is equivalent
   // to having a viewBox that exactly matches our viewport size.
-  return SVGViewBoxRect(0, 0, aViewportWidth, aViewportHeight);
+  return SVGViewBox(0, 0, aViewportWidth, aViewportHeight);
 }
 
 SVGElement::LengthAttributesInfo SVGViewportElement::GetLengthInfo() {
   return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
                               ArrayLength(sLengthInfo));
 }
 
 }  // namespace dom
--- 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;
@@ -74,29 +74,29 @@ class SVGViewportElement : public SVGGra
    * has a valid viewBox.
    *
    * Note that this does not check whether we need to synthesize a viewBox,
    * so you must call ShouldSynthesizeViewBox() if you need to chck that too.
    *
    * Note also that this method does not pay attention to whether the width or
    * height values of the viewBox rect are positive!
    */
-  bool HasViewBoxRect() const { return GetViewBoxInternal().HasRect(); }
+  bool HasViewBox() const { return GetViewBoxInternal().HasRect(); }
 
   /**
    * Returns true if we should synthesize a viewBox for ourselves (that is, if
    * we're the root element in an image document, and we're not currently being
    * painted for an <svg:image> element).
    *
-   * Only call this method if HasViewBoxRect() returns false.
+   * Only call this method if HasViewBox() returns false.
    */
   bool ShouldSynthesizeViewBox() const;
 
   bool HasViewBoxOrSyntheticViewBox() const {
-    return HasViewBoxRect() || ShouldSynthesizeViewBox();
+    return HasViewBox() || ShouldSynthesizeViewBox();
   }
 
   bool HasChildrenOnlyTransform() const { return mHasChildrenOnlyTransform; }
 
   void UpdateHasChildrenOnlyTransform();
 
   enum ChildrenOnlyTransformChangedFlags { eDuringReflow = 1 };
 
@@ -121,17 +121,17 @@ class SVGViewportElement : public SVGGra
   void SetViewportSize(const svgFloatSize& aSize) {
     mViewportWidth = aSize.width;
     mViewportHeight = aSize.height;
   }
 
   // WebIDL
   already_AddRefed<SVGAnimatedRect> ViewBox();
   already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
-  virtual SVGAnimatedViewBox* GetViewBox() override;
+  virtual SVGAnimatedViewBox* GetAnimatedViewBox() override;
 
  protected:
   // implementation helpers:
 
   bool IsRoot() const {
     NS_ASSERTION((IsInUncomposedDoc() && !GetParent()) ==
                      (OwnerDoc()->GetRootElement() == this),
                  "Can't determine if we're root");
@@ -157,31 +157,32 @@ class SVGViewportElement : public SVGGra
     return mPreserveAspectRatio.GetAnimValue();
   }
 
   /**
    * Returns the explicit viewBox rect, if specified, or else a synthesized
    * viewBox, if appropriate, or else a viewBox matching the dimensions of the
    * SVG viewport.
    */
-  SVGViewBoxRect GetViewBoxWithSynthesis(float aViewportWidth,
-                                         float aViewportHeight) const;
+  SVGViewBox GetViewBoxWithSynthesis(float aViewportWidth,
+                                     float aViewportHeight) const;
 
   /**
    * 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 SVGAnimatedPreserveAspectRatio* GetAnimatedPreserveAspectRatio()
+      override;
 
   virtual const SVGAnimatedViewBox& GetViewBoxInternal() const {
     return mViewBox;
   }
   virtual SVGAnimatedTransformList* GetTransformInternal() const {
     return mTransforms;
   }
   SVGAnimatedViewBox 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/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -9584,24 +9584,25 @@ static nsRect ComputeSVGReferenceRect(ns
       break;
     }
     case StyleGeometryBox::ViewBox: {
       nsIContent* content = aFrame->GetContent();
       SVGElement* element = static_cast<SVGElement*>(content);
       SVGViewportElement* svgElement = element->GetCtx();
       MOZ_ASSERT(svgElement);
 
-      if (svgElement && svgElement->HasViewBoxRect()) {
+      if (svgElement && svgElement->HasViewBox()) {
         // If a `viewBox` attribute is specified for the SVG viewport creating
         // element:
         // 1. The reference box is positioned at the origin of the coordinate
         //    system established by the `viewBox` attribute.
         // 2. The dimension of the reference box is set to the width and height
         //    values of the `viewBox` attribute.
-        const SVGViewBoxRect& value = svgElement->GetViewBox()->GetAnimValue();
+        const SVGViewBox& value =
+            svgElement->GetAnimatedViewBox()->GetAnimValue();
         r = nsRect(nsPresContext::CSSPixelsToAppUnits(value.x),
                    nsPresContext::CSSPixelsToAppUnits(value.y),
                    nsPresContext::CSSPixelsToAppUnits(value.width),
                    nsPresContext::CSSPixelsToAppUnits(value.height));
       } else {
         // No viewBox is specified, uses the nearest SVG viewport as reference
         // box.
         svgFloatSize viewportSize = svgElement->GetViewportSize();
--- 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/nsSVGMarkerFrame.cpp
+++ b/layout/svg/nsSVGMarkerFrame.cpp
@@ -100,17 +100,17 @@ void nsSVGMarkerFrame::PaintMark(gfxCont
 
   AutoMarkerReferencer markerRef(this, aMarkedFrame);
 
   SVGMarkerElement* marker = static_cast<SVGMarkerElement*>(GetContent());
   if (!marker->HasValidDimensions()) {
     return;
   }
 
-  const SVGViewBoxRect viewBox = marker->GetViewBoxRect();
+  const SVGViewBox viewBox = marker->GetViewBox();
 
   if (viewBox.width <= 0.0f || viewBox.height <= 0.0f) {
     // We must disable rendering if the viewBox width or height are zero.
     return;
   }
 
   Matrix viewBoxTM = marker->GetViewBoxTransform();
 
@@ -149,17 +149,17 @@ SVGBBox nsSVGMarkerFrame::GetMarkBBoxCon
 
   AutoMarkerReferencer markerRef(this, aMarkedFrame);
 
   SVGMarkerElement* content = static_cast<SVGMarkerElement*>(GetContent());
   if (!content->HasValidDimensions()) {
     return bbox;
   }
 
-  const SVGViewBoxRect viewBox = content->GetViewBoxRect();
+  const SVGViewBox viewBox = content->GetViewBox();
 
   if (viewBox.width <= 0.0f || viewBox.height <= 0.0f) {
     return bbox;
   }
 
   mMarkerTM = content->GetMarkerTransform(aStrokeWidth, aMark);
   Matrix viewBoxTM = content->GetViewBoxTransform();
 
--- 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,36 +233,36 @@ 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;
     }
     if (ratio.height < 0) {
       ratio.height = 0;
     }
     return ratio;
   }
 
   SVGViewElement* viewElement = content->GetCurrentViewElement();
-  const SVGViewBoxRect* viewbox = nullptr;
+  const SVGViewBox* viewbox = nullptr;
 
   // The logic here should match HasViewBox().
   if (viewElement && viewElement->mViewBox.HasRect()) {
     viewbox = &viewElement->mViewBox.GetAnimValue();
   } else if (content->mViewBox.HasRect()) {
     viewbox = &content->mViewBox.GetAnimValue();
   }
 
@@ -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;
@@ -776,17 +776,17 @@ void nsSVGOuterSVGFrame::NotifyViewportO
   // No point in doing anything when were not init'ed yet:
   if (!mViewportInitialized) {
     return;
   }
 
   SVGSVGElement* content = static_cast<SVGSVGElement*>(GetContent());
 
   if (aFlags & COORD_CONTEXT_CHANGED) {
-    if (content->HasViewBoxRect()) {
+    if (content->HasViewBox()) {
       // Percentage lengths on children resolve against the viewBox rect so we
       // don't need to notify them of the viewport change, but the viewBox
       // transform will have changed, so we need to notify them of that instead.
       aFlags = TRANSFORM_CHANGED;
     } else if (content->ShouldSynthesizeViewBox()) {
       // In the case of a synthesized viewBox, the synthetic viewBox's rect
       // changes as the viewport changes. As a result we need to maintain the
       // COORD_CONTEXT_CHANGED flag.
@@ -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);
@@ -631,19 +631,19 @@ gfxMatrix nsSVGPatternFrame::ConstructCT
       ctx = static_cast<SVGElement *>(targetContent)->GetCtx();
     }
     scaleX = scaleY = MaxExpansion(callerCTM);
   }
 
   if (!aViewBox.IsExplicitlySet()) {
     return gfxMatrix(scaleX, 0.0, 0.0, scaleY, 0.0, 0.0);
   }
-  const SVGViewBoxRect viewBoxRect = aViewBox.GetAnimValue();
+  const SVGViewBox viewBox = aViewBox.GetAnimValue();
 
-  if (viewBoxRect.height <= 0.0f || viewBoxRect.width <= 0.0f) {
+  if (viewBox.height <= 0.0f || viewBox.width <= 0.0f) {
     return gfxMatrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);  // singular
   }
 
   float viewportWidth, viewportHeight;
   if (targetContent->IsSVGElement()) {
     // If we're dealing with an SVG target only retrieve the context once.
     // Calling the nsIFrame* variant of GetAnimValue would look it up on
     // every call.
@@ -659,19 +659,18 @@ gfxMatrix nsSVGPatternFrame::ConstructCT
         GetLengthValue(SVGPatternElement::ATTR_HEIGHT)->GetAnimValue(aTarget);
   }
 
   if (viewportWidth <= 0.0f || viewportHeight <= 0.0f) {
     return gfxMatrix(0.0, 0.0, 0.0, 0.0, 0.0, 0.0);  // singular
   }
 
   Matrix tm = SVGContentUtils::GetViewBoxTransform(
-      viewportWidth * scaleX, viewportHeight * scaleY, viewBoxRect.x,
-      viewBoxRect.y, viewBoxRect.width, viewBoxRect.height,
-      GetPreserveAspectRatio());
+      viewportWidth * scaleX, viewportHeight * scaleY, viewBox.x, viewBox.y,
+      viewBox.width, viewBox.height, GetPreserveAspectRatio());
 
   return ThebesMatrix(tm);
 }
 
 //----------------------------------------------------------------------
 // nsSVGPaintServerFrame methods:
 already_AddRefed<gfxPattern> nsSVGPatternFrame::GetPaintServerPattern(
     nsIFrame *aSource, const DrawTarget *aDrawTarget,
--- 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);
 
--- a/layout/svg/nsSVGViewportFrame.cpp
+++ b/layout/svg/nsSVGViewportFrame.cpp
@@ -97,21 +97,21 @@ void nsSVGViewportFrame::NotifySVGChange
     }
 
     // Coordinate context changes affect mCanvasTM if we have a
     // percentage 'x' or 'y', or if we have a percentage 'width' or 'height' AND
     // a 'viewBox'.
 
     if (!(aFlags & TRANSFORM_CHANGED) &&
         (xOrYIsPercentage ||
-         (widthOrHeightIsPercentage && svg->HasViewBoxRect()))) {
+         (widthOrHeightIsPercentage && svg->HasViewBox()))) {
       aFlags |= TRANSFORM_CHANGED;
     }
 
-    if (svg->HasViewBoxRect() || !widthOrHeightIsPercentage) {
+    if (svg->HasViewBox() || !widthOrHeightIsPercentage) {
       // Remove COORD_CONTEXT_CHANGED, since we establish the coordinate
       // context for our descendants and this notification won't change its
       // dimensions:
       aFlags &= ~COORD_CONTEXT_CHANGED;
 
       if (!aFlags) {
         return;  // No notification flags left
       }
--- a/servo/components/style/style_adjuster.rs
+++ b/servo/components/style/style_adjuster.rs
@@ -735,19 +735,17 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
         use crate::values::CustomIdent;
 
         if self.style.get_box().clone_display() != Display::ListItem {
             return;
         }
         if self.style.pseudo.is_some() {
             return;
         }
-        // Note that we map <li value=INTEGER> to 'counter-set: list-item INTEGER;
-        // counter-increment: list-item 0;' so we'll return here unless the author
-        // explicitly specified something else.
+
         let increments = self.style.get_counters().clone_counter_increment();
         if increments.iter().any(|i| i.name.0 == atom!("list-item")) {
             return;
         }
 
         let reversed = self.style.get_list().clone__moz_list_reversed() == MozListReversed::True;
         let increment = if reversed { -1 } else { 1 };
         let list_increment = CounterPair {