Bug 1517108 - Move nsSMILTimeContainer, nsSMILMilestone and nsSMILTargetIdentifier to the mozilla namespace r=bbirtles
authorlongsonr <longsonr@gmail.com>
Wed, 02 Jan 2019 07:21:13 +0000
changeset 509351 cff5ac4f1d70ed500011f025aee86dfa6b4ff2c5
parent 509350 1d586f7cf0c599b0152964b7bfd23f866547b4de
child 509352 5826b2352ac08248205d3b0e29587ab8ad415bfe
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbirtles
bugs1517108
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1517108 - Move nsSMILTimeContainer, nsSMILMilestone and nsSMILTargetIdentifier to the mozilla namespace r=bbirtles
dom/base/nsDocument.cpp
dom/smil/SMILAnimationController.cpp
dom/smil/SMILAnimationController.h
dom/smil/SMILAnimationFunction.cpp
dom/smil/SMILAnimationFunction.h
dom/smil/SMILCompositor.h
dom/smil/SMILMilestone.h
dom/smil/SMILTargetIdentifier.h
dom/smil/SMILTimeContainer.cpp
dom/smil/SMILTimeContainer.h
dom/smil/SMILTimedElement.cpp
dom/smil/SMILTimedElement.h
dom/smil/moz.build
dom/smil/nsSMILInstanceTime.cpp
dom/smil/nsSMILInstanceTime.h
dom/smil/nsSMILMilestone.h
dom/smil/nsSMILTargetIdentifier.h
dom/smil/nsSMILTimeContainer.cpp
dom/smil/nsSMILTimeContainer.h
dom/smil/nsSMILTimeValueSpec.cpp
dom/smil/nsSMILTimeValueSpec.h
dom/svg/SVGAnimationElement.cpp
dom/svg/SVGAnimationElement.h
dom/svg/SVGSVGElement.cpp
dom/svg/SVGSVGElement.h
gfx/thebes/gfxSVGGlyphs.cpp
image/SVGDocumentWrapper.cpp
layout/base/nsPresContext.cpp
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -4366,18 +4366,18 @@ void nsIDocument::SetContainer(nsDocShel
 nsISupports* nsIDocument::GetContainer() const {
   return static_cast<nsIDocShell*>(mDocumentContainer);
 }
 
 void nsIDocument::SetScriptGlobalObject(
     nsIScriptGlobalObject* aScriptGlobalObject) {
   MOZ_ASSERT(aScriptGlobalObject || !mAnimationController ||
                  mAnimationController->IsPausedByType(
-                     nsSMILTimeContainer::PAUSE_PAGEHIDE |
-                     nsSMILTimeContainer::PAUSE_BEGIN),
+                     SMILTimeContainer::PAUSE_PAGEHIDE |
+                     SMILTimeContainer::PAUSE_BEGIN),
              "Clearing window pointer while animations are unpaused");
 
   if (mScriptGlobalObject && !aScriptGlobalObject) {
     // We're detaching from the window.  We need to grab a pointer to
     // our layout history state now.
     mLayoutHistoryState = GetLayoutHistoryState();
 
     // Also make sure to remove our onload blocker now if we haven't done it yet
@@ -6144,17 +6144,17 @@ SMILAnimationController* nsIDocument::Ge
 
   mAnimationController = new SMILAnimationController(this);
 
   // If there's a presContext then check the animation mode and pause if
   // necessary.
   nsPresContext* context = GetPresContext();
   if (mAnimationController && context &&
       context->ImageAnimationMode() == imgIContainer::kDontAnimMode) {
-    mAnimationController->Pause(nsSMILTimeContainer::PAUSE_USERPREF);
+    mAnimationController->Pause(SMILTimeContainer::PAUSE_USERPREF);
   }
 
   // If we're hidden (or being hidden), notify the newly-created animation
   // controller. (Skip this check for SVG-as-an-image documents, though,
   // because they don't get OnPageShow / OnPageHide calls).
   if (!mIsShowing && !mIsBeingUsedAsImage) {
     mAnimationController->OnPageHide();
   }
--- a/dom/smil/SMILAnimationController.cpp
+++ b/dom/smil/SMILAnimationController.cpp
@@ -60,43 +60,43 @@ SMILAnimationController::~SMILAnimationC
   NS_ASSERTION(!mRegisteredWithRefreshDriver,
                "Leaving stale entry in refresh driver's observer list");
 }
 
 void SMILAnimationController::Disconnect() {
   MOZ_ASSERT(mDocument, "disconnecting when we weren't connected...?");
   MOZ_ASSERT(mRefCnt.get() == 1,
              "Expecting to disconnect when doc is sole remaining owner");
-  NS_ASSERTION(mPauseState & nsSMILTimeContainer::PAUSE_PAGEHIDE,
+  NS_ASSERTION(mPauseState & SMILTimeContainer::PAUSE_PAGEHIDE,
                "Expecting to be paused for pagehide before disconnect");
 
   StopSampling(GetRefreshDriver());
 
   mDocument = nullptr;  // (raw pointer)
 }
 
 //----------------------------------------------------------------------
-// nsSMILTimeContainer methods:
+// SMILTimeContainer methods:
 
 void SMILAnimationController::Pause(uint32_t aType) {
-  nsSMILTimeContainer::Pause(aType);
+  SMILTimeContainer::Pause(aType);
 
   if (mPauseState) {
     mDeferredStartSampling = false;
     StopSampling(GetRefreshDriver());
   }
 }
 
 void SMILAnimationController::Resume(uint32_t aType) {
   bool wasPaused = (mPauseState != 0);
   // Update mCurrentSampleTime so that calls to GetParentTime--used for
   // calculating parent offsets--are accurate
   mCurrentSampleTime = mozilla::TimeStamp::Now();
 
-  nsSMILTimeContainer::Resume(aType);
+  SMILTimeContainer::Resume(aType);
 
   if (wasPaused && !mPauseState && mChildContainerTable.Count()) {
     MaybeStartSampling(GetRefreshDriver());
     Sample();  // Run the first sample manually
   }
 }
 
 nsSMILTime SMILAnimationController::GetParentTime() const {
@@ -179,21 +179,21 @@ void SMILAnimationController::Unregister
     SVGAnimationElement* aAnimationElement) {
   mAnimationElementTable.RemoveEntry(aAnimationElement);
 }
 
 //----------------------------------------------------------------------
 // Page show/hide
 
 void SMILAnimationController::OnPageShow() {
-  Resume(nsSMILTimeContainer::PAUSE_PAGEHIDE);
+  Resume(SMILTimeContainer::PAUSE_PAGEHIDE);
 }
 
 void SMILAnimationController::OnPageHide() {
-  Pause(nsSMILTimeContainer::PAUSE_PAGEHIDE);
+  Pause(SMILTimeContainer::PAUSE_PAGEHIDE);
 }
 
 //----------------------------------------------------------------------
 // Cycle-collection support
 
 void SMILAnimationController::Traverse(
     nsCycleCollectionTraversalCallback* aCallback) {
   // Traverse last compositor table
@@ -304,22 +304,22 @@ void SMILAnimationController::DoSample(b
   DoMilestoneSamples();
 
   // STEP 2: Sample the child time containers
   //
   // When we sample the child time containers they will simply record the sample
   // time in document time.
   TimeContainerHashtable activeContainers(mChildContainerTable.Count());
   for (auto iter = mChildContainerTable.Iter(); !iter.Done(); iter.Next()) {
-    nsSMILTimeContainer* container = iter.Get()->GetKey();
+    SMILTimeContainer* container = iter.Get()->GetKey();
     if (!container) {
       continue;
     }
 
-    if (!container->IsPausedByType(nsSMILTimeContainer::PAUSE_BEGIN) &&
+    if (!container->IsPausedByType(SMILTimeContainer::PAUSE_BEGIN) &&
         (container->NeedsSample() || !aSkipUnchangedContainers)) {
       container->ClearMilestones();
       container->Sample();
       container->MarkSeekFinished();
       activeContainers.PutEntry(container);
     }
   }
 
@@ -419,28 +419,28 @@ void SMILAnimationController::DoSample(b
   mMightHavePendingStyleUpdates = mightHavePendingStyleUpdates;
 
   NS_ASSERTION(!mResampleNeeded, "Resample dirty flag set during sample!");
 }
 
 void SMILAnimationController::RewindElements() {
   bool rewindNeeded = false;
   for (auto iter = mChildContainerTable.Iter(); !iter.Done(); iter.Next()) {
-    nsSMILTimeContainer* container = iter.Get()->GetKey();
+    SMILTimeContainer* container = iter.Get()->GetKey();
     if (container->NeedsRewind()) {
       rewindNeeded = true;
       break;
     }
   }
 
   if (!rewindNeeded) return;
 
   for (auto iter = mAnimationElementTable.Iter(); !iter.Done(); iter.Next()) {
     SVGAnimationElement* animElem = iter.Get()->GetKey();
-    nsSMILTimeContainer* timeContainer = animElem->GetTimeContainer();
+    SMILTimeContainer* timeContainer = animElem->GetTimeContainer();
     if (timeContainer && timeContainer->NeedsRewind()) {
       animElem->TimedElement().Rewind();
     }
   }
 
   for (auto iter = mChildContainerTable.Iter(); !iter.Done(); iter.Next()) {
     iter.Get()->GetKey()->ClearNeedsRewind();
   }
@@ -467,38 +467,38 @@ void SMILAnimationController::DoMileston
   nsSMILTime sampleTime = INT64_MIN;
 
   while (true) {
     // We want to find any milestones AT OR BEFORE the current sample time so we
     // initialise the next milestone to the moment after (1ms after, to be
     // precise) the current sample time and see if there are any milestones
     // before that. Any other milestones will be dealt with in a subsequent
     // sample.
-    nsSMILMilestone nextMilestone(GetCurrentTimeAsSMILTime() + 1, true);
+    SMILMilestone nextMilestone(GetCurrentTimeAsSMILTime() + 1, true);
     for (auto iter = mChildContainerTable.Iter(); !iter.Done(); iter.Next()) {
-      nsSMILTimeContainer* container = iter.Get()->GetKey();
-      if (container->IsPausedByType(nsSMILTimeContainer::PAUSE_BEGIN)) {
+      SMILTimeContainer* container = iter.Get()->GetKey();
+      if (container->IsPausedByType(SMILTimeContainer::PAUSE_BEGIN)) {
         continue;
       }
-      nsSMILMilestone thisMilestone;
+      SMILMilestone thisMilestone;
       bool didGetMilestone =
           container->GetNextMilestoneInParentTime(thisMilestone);
       if (didGetMilestone && thisMilestone < nextMilestone) {
         nextMilestone = thisMilestone;
       }
     }
 
     if (nextMilestone.mTime > GetCurrentTimeAsSMILTime()) {
       break;
     }
 
     nsTArray<RefPtr<mozilla::dom::SVGAnimationElement>> elements;
     for (auto iter = mChildContainerTable.Iter(); !iter.Done(); iter.Next()) {
-      nsSMILTimeContainer* container = iter.Get()->GetKey();
-      if (container->IsPausedByType(nsSMILTimeContainer::PAUSE_BEGIN)) {
+      SMILTimeContainer* container = iter.Get()->GetKey();
+      if (container->IsPausedByType(SMILTimeContainer::PAUSE_BEGIN)) {
         continue;
       }
       container->PopMilestoneElementsAtMilestone(nextMilestone, elements);
     }
 
     uint32_t length = elements.Length();
 
     // During the course of a sampling we don't want to actually go backwards.
@@ -510,17 +510,17 @@ void SMILAnimationController::DoMileston
     // Because we're only performing this clamping at the last moment, the
     // animations will still all get sampled in the correct order and
     // dependencies will be appropriately resolved.
     sampleTime = std::max(nextMilestone.mTime, sampleTime);
 
     for (uint32_t i = 0; i < length; ++i) {
       SVGAnimationElement* elem = elements[i].get();
       MOZ_ASSERT(elem, "nullptr animation element in list");
-      nsSMILTimeContainer* container = elem->GetTimeContainer();
+      SMILTimeContainer* container = elem->GetTimeContainer();
       if (!container)
         // The container may be nullptr if the element has been detached from
         // its parent since registering a milestone.
         continue;
 
       nsSMILTimeValue containerTimeValue =
           container->ParentToContainerTime(sampleTime);
       if (!containerTimeValue.IsDefinite()) continue;
@@ -535,17 +535,17 @@ void SMILAnimationController::DoMileston
         elem->TimedElement().SampleAt(containerTime);
       }
     }
   }
 }
 
 /*static*/ void SMILAnimationController::SampleTimedElement(
     SVGAnimationElement* aElement, TimeContainerHashtable* aActiveContainers) {
-  nsSMILTimeContainer* timeContainer = aElement->GetTimeContainer();
+  SMILTimeContainer* timeContainer = aElement->GetTimeContainer();
   if (!timeContainer) return;
 
   // We'd like to call timeContainer->NeedsSample() here and skip all timed
   // elements that belong to paused time containers that don't need a sample,
   // but that doesn't work because we've already called Sample() on all the time
   // containers so the paused ones don't need a sample any more and they'll
   // return false.
   //
@@ -560,17 +560,17 @@ void SMILAnimationController::DoMileston
              "Doing a regular sample but the time container is still seeking");
   aElement->TimedElement().SampleAt(containerTime);
 }
 
 /*static*/ void SMILAnimationController::AddAnimationToCompositorTable(
     SVGAnimationElement* aElement, SMILCompositorTable* aCompositorTable,
     bool& aStyleFlushNeeded) {
   // Add a compositor to the hash table if there's not already one there
-  nsSMILTargetIdentifier key;
+  SMILTargetIdentifier key;
   if (!GetTargetIdentifierForAnimation(aElement, key))
     // Something's wrong/missing about animation's target; skip this animation
     return;
 
   SMILAnimationFunction& func = aElement->AnimationFunction();
 
   // Only add active animation functions. If there are no active animations
   // targeting an attribute, no compositor will be created and any previously
@@ -602,20 +602,20 @@ static inline bool IsTransformAttribute(
                                         nsAtom* aAttributeName) {
   return aNamespaceID == kNameSpaceID_None &&
          (aAttributeName == nsGkAtoms::transform ||
           aAttributeName == nsGkAtoms::patternTransform ||
           aAttributeName == nsGkAtoms::gradientTransform);
 }
 
 // Helper function that, given a SVGAnimationElement, looks up its target
-// element & target attribute and populates a nsSMILTargetIdentifier
+// element & target attribute and populates a SMILTargetIdentifier
 // for this target.
 /*static*/ bool SMILAnimationController::GetTargetIdentifierForAnimation(
-    SVGAnimationElement* aAnimElem, nsSMILTargetIdentifier& aResult) {
+    SVGAnimationElement* aAnimElem, SMILTargetIdentifier& aResult) {
   // Look up target (animated) element
   Element* targetElem = aAnimElem->GetTargetElementContent();
   if (!targetElem)
     // Animation has no target elem -- skip it.
     return false;
 
   // Look up target (animated) attribute
   // SMILANIM section 3.1, attributeName may
@@ -656,17 +656,17 @@ bool SMILAnimationController::PreTravers
   if (!context) {
     return false;
   }
 
   bool foundElementsNeedingRestyle = false;
   for (auto iter = mAnimationElementTable.Iter(); !iter.Done(); iter.Next()) {
     SVGAnimationElement* animElement = iter.Get()->GetKey();
 
-    nsSMILTargetIdentifier key;
+    SMILTargetIdentifier key;
     if (!GetTargetIdentifierForAnimation(animElement, key)) {
       // Something's wrong/missing about animation's target; skip this animation
       continue;
     }
 
     // Ignore restyles that aren't in the flattened tree subtree rooted at
     // aRoot.
     if (aRoot && !nsContentUtils::ContentIsFlattenedTreeDescendantOf(
@@ -688,29 +688,29 @@ bool SMILAnimationController::PreTravers
   }
 
   return foundElementsNeedingRestyle;
 }
 
 //----------------------------------------------------------------------
 // Add/remove child time containers
 
-nsresult SMILAnimationController::AddChild(nsSMILTimeContainer& aChild) {
+nsresult SMILAnimationController::AddChild(SMILTimeContainer& aChild) {
   TimeContainerPtrKey* key = mChildContainerTable.PutEntry(&aChild);
   NS_ENSURE_TRUE(key, NS_ERROR_OUT_OF_MEMORY);
 
   if (!mPauseState && mChildContainerTable.Count() == 1) {
     MaybeStartSampling(GetRefreshDriver());
     Sample();  // Run the first sample manually
   }
 
   return NS_OK;
 }
 
-void SMILAnimationController::RemoveChild(nsSMILTimeContainer& aChild) {
+void SMILAnimationController::RemoveChild(SMILTimeContainer& aChild) {
   mChildContainerTable.RemoveEntry(&aChild);
 
   if (!mPauseState && mChildContainerTable.Count() == 0) {
     StopSampling(GetRefreshDriver());
   }
 }
 
 // Helper method
--- a/dom/smil/SMILAnimationController.h
+++ b/dom/smil/SMILAnimationController.h
@@ -4,30 +4,30 @@
  * 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_SMILANIMATIONCONTROLLER_H_
 #define NS_SMILANIMATIONCONTROLLER_H_
 
 #include "mozilla/Attributes.h"
 #include "mozilla/SMILCompositorTable.h"
+#include "mozilla/SMILMilestone.h"
+#include "mozilla/SMILTimeContainer.h"
 #include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "nsTArray.h"
 #include "nsITimer.h"
 #include "nsTHashtable.h"
 #include "nsHashKeys.h"
-#include "nsSMILTimeContainer.h"
-#include "nsSMILMilestone.h"
 #include "nsRefreshDriver.h"
 
-struct nsSMILTargetIdentifier;
 class nsIDocument;
 
 namespace mozilla {
+struct SMILTargetIdentifier;
 namespace dom {
 class Element;
 class SVGAnimationElement;
 }  // namespace dom
 
 //----------------------------------------------------------------------
 // SMILAnimationController
 //
@@ -36,18 +36,18 @@ class SVGAnimationElement;
 // at most one animation controller per document so that frame-rate tuning can
 // be performed at a document-level.
 //
 // The animation controller can contain many child time containers (timed
 // document root objects) which may correspond to SVG document fragments within
 // a compound document. These time containers can be paused individually or
 // here, at the document level.
 //
-class SMILAnimationController final : public nsSMILTimeContainer,
-                                        public nsARefreshObserver {
+class SMILAnimationController final : public SMILTimeContainer,
+                                      public nsARefreshObserver {
  public:
   explicit SMILAnimationController(nsIDocument* aDoc);
 
   // Clears mDocument pointer. (Called by our nsIDocument when it's going away)
   void Disconnect();
 
   // nsSMILContainer
   virtual void Pause(uint32_t aType) override;
@@ -109,17 +109,17 @@ class SMILAnimationController final : pu
 
   bool PreTraverse();
   bool PreTraverseInSubtree(mozilla::dom::Element* aRoot);
 
  protected:
   ~SMILAnimationController();
 
   // Typedefs
-  typedef nsPtrHashKey<nsSMILTimeContainer> TimeContainerPtrKey;
+  typedef nsPtrHashKey<SMILTimeContainer> TimeContainerPtrKey;
   typedef nsTHashtable<TimeContainerPtrKey> TimeContainerHashtable;
   typedef nsPtrHashKey<mozilla::dom::SVGAnimationElement>
       AnimationElementPtrKey;
   typedef nsTHashtable<AnimationElementPtrKey> AnimationElementHashtable;
 
   // Returns mDocument's refresh driver, if it's got one.
   nsRefreshDriver* GetRefreshDriver();
 
@@ -142,21 +142,21 @@ class SMILAnimationController final : pu
                                  TimeContainerHashtable* aActiveContainers);
 
   static void AddAnimationToCompositorTable(
       mozilla::dom::SVGAnimationElement* aElement,
       SMILCompositorTable* aCompositorTable, bool& aStyleFlushNeeded);
 
   static bool GetTargetIdentifierForAnimation(
       mozilla::dom::SVGAnimationElement* aAnimElem,
-      nsSMILTargetIdentifier& aResult);
+      SMILTargetIdentifier& aResult);
 
   // Methods for adding/removing time containers
-  virtual nsresult AddChild(nsSMILTimeContainer& aChild) override;
-  virtual void RemoveChild(nsSMILTimeContainer& aChild) override;
+  virtual nsresult AddChild(SMILTimeContainer& aChild) override;
+  virtual void RemoveChild(SMILTimeContainer& aChild) override;
 
   void FlagDocumentNeedsFlush();
 
   // Members
   nsAutoRefCnt mRefCnt;
   NS_DECL_OWNINGTHREAD
 
   AnimationElementHashtable mAnimationElementTable;
--- a/dom/smil/SMILAnimationFunction.cpp
+++ b/dom/smil/SMILAnimationFunction.cpp
@@ -282,17 +282,17 @@ bool SMILAnimationFunction::WillReplace(
   return !mErrorFlags && !(IsAdditive() || IsToAnimation());
 }
 
 bool SMILAnimationFunction::HasChanged() const {
   return mHasChanged || mValueNeedsReparsingEverySample;
 }
 
 bool SMILAnimationFunction::UpdateCachedTarget(
-    const nsSMILTargetIdentifier& aNewTarget) {
+    const SMILTargetIdentifier& aNewTarget) {
   if (!mLastTarget.Equals(aNewTarget)) {
     mLastTarget = aNewTarget;
     return true;
   }
   return false;
 }
 
 //----------------------------------------------------------------------
--- a/dom/smil/SMILAnimationFunction.h
+++ b/dom/smil/SMILAnimationFunction.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 NS_SMILANIMATIONFUNCTION_H_
 #define NS_SMILANIMATIONFUNCTION_H_
 
+#include "mozilla/SMILTargetIdentifier.h"
 #include "nsISMILAttr.h"
 #include "nsGkAtoms.h"
 #include "nsString.h"
-#include "nsSMILTargetIdentifier.h"
 #include "nsSMILTimeValue.h"
 #include "nsSMILKeySpline.h"
 #include "nsSMILValue.h"
 #include "nsTArray.h"
 #include "nsAttrValue.h"
 #include "nsSMILTypes.h"
 
 namespace mozilla {
@@ -209,22 +209,22 @@ class SMILAnimationFunction {
 
   /**
    * Updates the cached record of our animation target, and returns a boolean
    * that indicates whether the target has changed since the last call to this
    * function. (This lets SMILCompositor check whether its animation
    * functions have changed value or target since the last sample.  If none of
    * them have, then the compositor doesn't need to do anything.)
    *
-   * @param aNewTarget A nsSMILTargetIdentifier representing the animation
+   * @param aNewTarget A SMILTargetIdentifier representing the animation
    *                   target of this function for this sample.
    * @return  true if |aNewTarget| is different from the old cached value;
    *          otherwise, false.
    */
-  bool UpdateCachedTarget(const nsSMILTargetIdentifier& aNewTarget);
+  bool UpdateCachedTarget(const SMILTargetIdentifier& aNewTarget);
 
   /**
    * Returns true if this function was skipped in the previous sample (because
    * there was a higher-priority non-additive animation). If a skipped animation
    * function is later used, then the animation sandwich must be recomposited.
    */
   bool WasSkippedInPrevSample() const { return mWasSkippedInPrevSample; }
 
--- a/dom/smil/SMILCompositor.h
+++ b/dom/smil/SMILCompositor.h
@@ -8,31 +8,31 @@
 #define NS_SMILCOMPOSITOR_H_
 
 #include "mozilla/Move.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/SMILAnimationFunction.h"
 #include "mozilla/SMILCompositorTable.h"
 #include "nsTHashtable.h"
 #include "nsString.h"
-#include "nsSMILTargetIdentifier.h"
+#include "SMILTargetIdentifier.h"
 #include "PLDHashTable.h"
 
 namespace mozilla {
 
 //----------------------------------------------------------------------
 // SMILCompositor
 //
 // Performs the composition of the animation sandwich by combining the results
 // of a series animation functions according to the rules of SMIL composition
 // including prioritising animations.
 
 class SMILCompositor : public PLDHashEntryHdr {
  public:
-  typedef nsSMILTargetIdentifier KeyType;
+  typedef SMILTargetIdentifier KeyType;
   typedef const KeyType& KeyTypeRef;
   typedef const KeyType* KeyTypePointer;
 
   explicit SMILCompositor(KeyTypePointer aKey)
       : mKey(*aKey), mForceCompositing(false) {}
   SMILCompositor(SMILCompositor&& toMove)
       : PLDHashEntryHdr(std::move(toMove)),
         mKey(std::move(toMove.mKey)),
rename from dom/smil/nsSMILMilestone.h
rename to dom/smil/SMILMilestone.h
--- a/dom/smil/nsSMILMilestone.h
+++ b/dom/smil/SMILMilestone.h
@@ -2,16 +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 NS_SMILMILESTONE_H_
 #define NS_SMILMILESTONE_H_
 
+#include "nsSMILTypes.h"
+
+namespace mozilla {
+
 /*
  * A significant moment in an SMILTimedElement's lifetime where a sample is
  * required.
  *
  * Animations register the next milestone in their lifetime with the time
  * container that they belong to. When the animation controller goes to run
  * a sample it first visits all the animations that have a registered milestone
  * in order of their milestone times. This allows interdependencies between
@@ -27,44 +31,45 @@
  *
  * Furthermore, this distinction between sampling the end of an interval and
  * a regular sample is used within the timing model (specifically in
  * SMILTimedElement) to ensure that all intervals ending at time t are sampled
  * before any new intervals are entered so that we have a fully up-to-date set
  * of instance times available before committing to a new interval. Once an
  * interval is entered, the begin time is fixed.
  */
-class nsSMILMilestone {
+class SMILMilestone {
  public:
-  nsSMILMilestone(nsSMILTime aTime, bool aIsEnd)
-      : mTime(aTime), mIsEnd(aIsEnd) {}
+  SMILMilestone(nsSMILTime aTime, bool aIsEnd) : mTime(aTime), mIsEnd(aIsEnd) {}
 
-  nsSMILMilestone() : mTime(0), mIsEnd(false) {}
+  SMILMilestone() : mTime(0), mIsEnd(false) {}
 
-  bool operator==(const nsSMILMilestone& aOther) const {
+  bool operator==(const SMILMilestone& aOther) const {
     return mTime == aOther.mTime && mIsEnd == aOther.mIsEnd;
   }
 
-  bool operator!=(const nsSMILMilestone& aOther) const {
+  bool operator!=(const SMILMilestone& aOther) const {
     return !(*this == aOther);
   }
 
-  bool operator<(const nsSMILMilestone& aOther) const {
+  bool operator<(const SMILMilestone& aOther) const {
     // Earlier times sort first, and for equal times end milestones sort first
     return mTime < aOther.mTime ||
            (mTime == aOther.mTime && mIsEnd && !aOther.mIsEnd);
   }
 
-  bool operator<=(const nsSMILMilestone& aOther) const {
+  bool operator<=(const SMILMilestone& aOther) const {
     return *this == aOther || *this < aOther;
   }
 
-  bool operator>=(const nsSMILMilestone& aOther) const {
+  bool operator>=(const SMILMilestone& aOther) const {
     return !(*this < aOther);
   }
 
   nsSMILTime mTime;  // The milestone time. This may be in container time or
                      // parent container time depending on where it is used.
   bool mIsEnd;       // true if this milestone corresponds to an interval
                      // end, false otherwise.
 };
 
+}  // namespace mozilla
+
 #endif  // NS_SMILMILESTONE_H_
rename from dom/smil/nsSMILTargetIdentifier.h
rename to dom/smil/SMILTargetIdentifier.h
--- a/dom/smil/nsSMILTargetIdentifier.h
+++ b/dom/smil/SMILTargetIdentifier.h
@@ -4,36 +4,38 @@
  * 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_SMILTARGETIDENTIFIER_H_
 #define NS_SMILTARGETIDENTIFIER_H_
 
 #include "mozilla/dom/Element.h"
 
+namespace mozilla {
+
 /**
- * Struct: nsSMILTargetIdentifier
+ * Struct: SMILTargetIdentifier
  *
  * Tuple of: { Animated Element, Attribute Name }
  *
  * Used in SMILAnimationController as hash key for mapping an animation
  * target to the SMILCompositor for that target.
  *
  * NOTE: Need a nsRefPtr for the element & attribute name, because
  * SMILAnimationController retain its hash table for one sample into the
  * future, and we need to make sure their target isn't deleted in that time.
  */
 
-struct nsSMILTargetIdentifier {
-  nsSMILTargetIdentifier()
+struct SMILTargetIdentifier {
+  SMILTargetIdentifier()
       : mElement(nullptr),
         mAttributeName(nullptr),
         mAttributeNamespaceID(kNameSpaceID_Unknown) {}
 
-  inline bool Equals(const nsSMILTargetIdentifier& aOther) const {
+  inline bool Equals(const SMILTargetIdentifier& aOther) const {
     return (aOther.mElement == mElement &&
             aOther.mAttributeName == mAttributeName &&
             aOther.mAttributeNamespaceID == mAttributeNamespaceID);
   }
 
   RefPtr<mozilla::dom::Element> mElement;
   RefPtr<nsAtom> mAttributeName;
   int32_t mAttributeNamespaceID;
@@ -50,26 +52,28 @@ struct nsSMILTargetIdentifier {
  * from one sample to the next.
  */
 class nsSMILWeakTargetIdentifier {
  public:
   // Trivial constructor
   nsSMILWeakTargetIdentifier() : mElement(nullptr), mAttributeName(nullptr) {}
 
   // Allow us to update a weak identifier to match a given non-weak identifier
-  nsSMILWeakTargetIdentifier& operator=(const nsSMILTargetIdentifier& aOther) {
+  nsSMILWeakTargetIdentifier& operator=(const SMILTargetIdentifier& aOther) {
     mElement = aOther.mElement;
     mAttributeName = aOther.mAttributeName;
     return *this;
   }
 
   // Allow for comparison vs. non-weak identifier
-  inline bool Equals(const nsSMILTargetIdentifier& aOther) const {
+  inline bool Equals(const SMILTargetIdentifier& aOther) const {
     return (aOther.mElement == mElement &&
             aOther.mAttributeName == mAttributeName);
   }
 
  private:
   const nsIContent* mElement;
   const nsAtom* mAttributeName;
 };
 
+}  // namespace mozilla
+
 #endif  // NS_SMILTARGETIDENTIFIER_H_
rename from dom/smil/nsSMILTimeContainer.cpp
rename to dom/smil/SMILTimeContainer.cpp
--- a/dom/smil/nsSMILTimeContainer.cpp
+++ b/dom/smil/SMILTimeContainer.cpp
@@ -1,117 +1,117 @@
 /* -*- 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 "nsSMILTimeContainer.h"
+#include "SMILTimeContainer.h"
 
 #include "mozilla/AutoRestore.h"
 #include "mozilla/SMILTimedElement.h"
 #include "nsSMILTimeValue.h"
 #include <algorithm>
 
-using namespace mozilla;
+namespace mozilla {
 
-nsSMILTimeContainer::nsSMILTimeContainer()
+SMILTimeContainer::SMILTimeContainer()
     : mParent(nullptr),
       mCurrentTime(0L),
       mParentOffset(0L),
       mPauseStart(0L),
       mNeedsPauseSample(false),
       mNeedsRewind(false),
       mIsSeeking(false),
 #ifdef DEBUG
       mHoldingEntries(false),
 #endif
       mPauseState(PAUSE_BEGIN) {
 }
 
-nsSMILTimeContainer::~nsSMILTimeContainer() {
+SMILTimeContainer::~SMILTimeContainer() {
   if (mParent) {
     mParent->RemoveChild(*this);
   }
 }
 
-nsSMILTimeValue nsSMILTimeContainer::ContainerToParentTime(
+nsSMILTimeValue SMILTimeContainer::ContainerToParentTime(
     nsSMILTime aContainerTime) const {
   // If we're paused, then future times are indefinite
   if (IsPaused() && aContainerTime > mCurrentTime)
     return nsSMILTimeValue::Indefinite();
 
   return nsSMILTimeValue(aContainerTime + mParentOffset);
 }
 
-nsSMILTimeValue nsSMILTimeContainer::ParentToContainerTime(
+nsSMILTimeValue SMILTimeContainer::ParentToContainerTime(
     nsSMILTime aParentTime) const {
   // If we're paused, then any time after when we paused is indefinite
   if (IsPaused() && aParentTime > mPauseStart)
     return nsSMILTimeValue::Indefinite();
 
   return nsSMILTimeValue(aParentTime - mParentOffset);
 }
 
-void nsSMILTimeContainer::Begin() {
+void SMILTimeContainer::Begin() {
   Resume(PAUSE_BEGIN);
   if (mPauseState) {
     mNeedsPauseSample = true;
   }
 
   // This is a little bit complicated here. Ideally we'd just like to call
   // Sample() and force an initial sample but this turns out to be a bad idea
   // because this may mean that NeedsSample() no longer reports true and so when
   // we come to the first real sample our parent will skip us over altogether.
   // So we force the time to be updated and adopt the policy to never call
   // Sample() ourselves but to always leave that to our parent or client.
 
   UpdateCurrentTime();
 }
 
-void nsSMILTimeContainer::Pause(uint32_t aType) {
+void SMILTimeContainer::Pause(uint32_t aType) {
   bool didStartPause = false;
 
   if (!mPauseState && aType) {
     mPauseStart = GetParentTime();
     mNeedsPauseSample = true;
     didStartPause = true;
   }
 
   mPauseState |= aType;
 
   if (didStartPause) {
     NotifyTimeChange();
   }
 }
 
-void nsSMILTimeContainer::Resume(uint32_t aType) {
+void SMILTimeContainer::Resume(uint32_t aType) {
   if (!mPauseState) return;
 
   mPauseState &= ~aType;
 
   if (!mPauseState) {
     nsSMILTime extraOffset = GetParentTime() - mPauseStart;
     mParentOffset += extraOffset;
     NotifyTimeChange();
   }
 }
 
-nsSMILTime nsSMILTimeContainer::GetCurrentTimeAsSMILTime() const {
+nsSMILTime SMILTimeContainer::GetCurrentTimeAsSMILTime() const {
   // The following behaviour is consistent with:
   // http://www.w3.org/2003/01/REC-SVG11-20030114-errata
   //  #getCurrentTime_setCurrentTime_undefined_before_document_timeline_begin
   // which says that if GetCurrentTime is called before the document timeline
   // has begun we should just return 0.
   if (IsPausedByType(PAUSE_BEGIN)) return 0L;
 
   return mCurrentTime;
 }
 
-void nsSMILTimeContainer::SetCurrentTime(nsSMILTime aSeekTo) {
+void SMILTimeContainer::SetCurrentTime(nsSMILTime aSeekTo) {
   // SVG 1.1 doesn't specify what to do for negative times so we adopt SVGT1.2's
   // behaviour of clamping negative times to 0.
   aSeekTo = std::max<nsSMILTime>(0, aSeekTo);
 
   // The following behaviour is consistent with:
   // http://www.w3.org/2003/01/REC-SVG11-20030114-errata
   //  #getCurrentTime_setCurrentTime_undefined_before_document_timeline_begin
   // which says that if SetCurrentTime is called before the document timeline
@@ -133,41 +133,41 @@ void nsSMILTimeContainer::SetCurrentTime
 
   // Force an update to the current time in case we get a call to GetCurrentTime
   // before another call to Sample().
   UpdateCurrentTime();
 
   NotifyTimeChange();
 }
 
-nsSMILTime nsSMILTimeContainer::GetParentTime() const {
+nsSMILTime SMILTimeContainer::GetParentTime() const {
   if (mParent) return mParent->GetCurrentTimeAsSMILTime();
 
   return 0L;
 }
 
-void nsSMILTimeContainer::SyncPauseTime() {
+void SMILTimeContainer::SyncPauseTime() {
   if (IsPaused()) {
     nsSMILTime parentTime = GetParentTime();
     nsSMILTime extraOffset = parentTime - mPauseStart;
     mParentOffset += extraOffset;
     mPauseStart = parentTime;
   }
 }
 
-void nsSMILTimeContainer::Sample() {
+void SMILTimeContainer::Sample() {
   if (!NeedsSample()) return;
 
   UpdateCurrentTime();
   DoSample();
 
   mNeedsPauseSample = false;
 }
 
-nsresult nsSMILTimeContainer::SetParent(nsSMILTimeContainer* aParent) {
+nsresult SMILTimeContainer::SetParent(SMILTimeContainer* aParent) {
   if (mParent) {
     mParent->RemoveChild(*this);
     // When we're not attached to a parent time container, GetParentTime() will
     // return 0. We need to adjust our pause state information to be relative to
     // this new time base.
     // Note that since "current time = parent time - parent offset" setting the
     // parent offset and pause start as follows preserves our current time even
     // while parent time = 0.
@@ -180,55 +180,55 @@ nsresult nsSMILTimeContainer::SetParent(
   nsresult rv = NS_OK;
   if (mParent) {
     rv = mParent->AddChild(*this);
   }
 
   return rv;
 }
 
-bool nsSMILTimeContainer::AddMilestone(
-    const nsSMILMilestone& aMilestone,
+bool SMILTimeContainer::AddMilestone(
+    const SMILMilestone& aMilestone,
     mozilla::dom::SVGAnimationElement& aElement) {
   // We record the milestone time and store it along with the element but this
   // time may change (e.g. if attributes are changed on the timed element in
   // between samples). If this happens, then we may do an unecessary sample
   // but that's pretty cheap.
   MOZ_ASSERT(!mHoldingEntries);
   return mMilestoneEntries.Push(MilestoneEntry(aMilestone, aElement));
 }
 
-void nsSMILTimeContainer::ClearMilestones() {
+void SMILTimeContainer::ClearMilestones() {
   MOZ_ASSERT(!mHoldingEntries);
   mMilestoneEntries.Clear();
 }
 
-bool nsSMILTimeContainer::GetNextMilestoneInParentTime(
-    nsSMILMilestone& aNextMilestone) const {
+bool SMILTimeContainer::GetNextMilestoneInParentTime(
+    SMILMilestone& aNextMilestone) const {
   if (mMilestoneEntries.IsEmpty()) return false;
 
   nsSMILTimeValue parentTime =
       ContainerToParentTime(mMilestoneEntries.Top().mMilestone.mTime);
   if (!parentTime.IsDefinite()) return false;
 
-  aNextMilestone = nsSMILMilestone(parentTime.GetMillis(),
-                                   mMilestoneEntries.Top().mMilestone.mIsEnd);
+  aNextMilestone = SMILMilestone(parentTime.GetMillis(),
+                                 mMilestoneEntries.Top().mMilestone.mIsEnd);
 
   return true;
 }
 
-bool nsSMILTimeContainer::PopMilestoneElementsAtMilestone(
-    const nsSMILMilestone& aMilestone, AnimElemArray& aMatchedElements) {
+bool SMILTimeContainer::PopMilestoneElementsAtMilestone(
+    const SMILMilestone& aMilestone, AnimElemArray& aMatchedElements) {
   if (mMilestoneEntries.IsEmpty()) return false;
 
   nsSMILTimeValue containerTime = ParentToContainerTime(aMilestone.mTime);
   if (!containerTime.IsDefinite()) return false;
 
-  nsSMILMilestone containerMilestone(containerTime.GetMillis(),
-                                     aMilestone.mIsEnd);
+  SMILMilestone containerMilestone(containerTime.GetMillis(),
+                                   aMilestone.mIsEnd);
 
   MOZ_ASSERT(mMilestoneEntries.Top().mMilestone >= containerMilestone,
              "Trying to pop off earliest times but we have earlier ones that "
              "were overlooked");
 
   MOZ_ASSERT(!mHoldingEntries);
 
   bool gotOne = false;
@@ -236,42 +236,42 @@ bool nsSMILTimeContainer::PopMilestoneEl
          mMilestoneEntries.Top().mMilestone == containerMilestone) {
     aMatchedElements.AppendElement(mMilestoneEntries.Pop().mTimebase);
     gotOne = true;
   }
 
   return gotOne;
 }
 
-void nsSMILTimeContainer::Traverse(
+void SMILTimeContainer::Traverse(
     nsCycleCollectionTraversalCallback* aCallback) {
 #ifdef DEBUG
   AutoRestore<bool> saveHolding(mHoldingEntries);
   mHoldingEntries = true;
 #endif
   const MilestoneEntry* p = mMilestoneEntries.Elements();
   while (p < mMilestoneEntries.Elements() + mMilestoneEntries.Length()) {
     NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*aCallback, "mTimebase");
     aCallback->NoteXPCOMChild(static_cast<nsIContent*>(p->mTimebase.get()));
     ++p;
   }
 }
 
-void nsSMILTimeContainer::Unlink() {
+void SMILTimeContainer::Unlink() {
   MOZ_ASSERT(!mHoldingEntries);
   mMilestoneEntries.Clear();
 }
 
-void nsSMILTimeContainer::UpdateCurrentTime() {
+void SMILTimeContainer::UpdateCurrentTime() {
   nsSMILTime now = IsPaused() ? mPauseStart : GetParentTime();
   mCurrentTime = now - mParentOffset;
   MOZ_ASSERT(mCurrentTime >= 0, "Container has negative time");
 }
 
-void nsSMILTimeContainer::NotifyTimeChange() {
+void SMILTimeContainer::NotifyTimeChange() {
   // Called when the container time is changed with respect to the document
   // time. When this happens time dependencies in other time containers need to
   // re-resolve their times because begin and end times are stored in container
   // time.
   //
   // To get the list of timed elements with dependencies we simply re-use the
   // milestone elements. This is because any timed element with dependents and
   // with significant transitions yet to fire should have their next milestone
@@ -292,8 +292,10 @@ void nsSMILTimeContainer::NotifyTimeChan
       elems.AppendElement(p->mTimebase.get());
     }
   }
 
   for (auto& elem : elems) {
     elem->TimedElement().HandleContainerTimeChange();
   }
 }
+
+}  // namespace mozilla
rename from dom/smil/nsSMILTimeContainer.h
rename to dom/smil/SMILTimeContainer.h
--- a/dom/smil/nsSMILTimeContainer.h
+++ b/dom/smil/SMILTimeContainer.h
@@ -3,32 +3,34 @@
 /* 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_SMILTIMECONTAINER_H_
 #define NS_SMILTIMECONTAINER_H_
 
 #include "mozilla/dom/SVGAnimationElement.h"
+#include "mozilla/SMILMilestone.h"
 #include "nscore.h"
 #include "nsSMILTypes.h"
 #include "nsTPriorityQueue.h"
-#include "nsSMILMilestone.h"
 
 class nsSMILTimeValue;
 
+namespace mozilla {
+
 //----------------------------------------------------------------------
-// nsSMILTimeContainer
+// SMILTimeContainer
 //
 // Common base class for a time base that can be paused, resumed, and sampled.
 //
-class nsSMILTimeContainer {
+class SMILTimeContainer {
  public:
-  nsSMILTimeContainer();
-  virtual ~nsSMILTimeContainer();
+  SMILTimeContainer();
+  virtual ~SMILTimeContainer();
 
   /*
    * Pause request types.
    */
   enum {
     PAUSE_BEGIN = 1,     // Paused because timeline has yet to begin.
     PAUSE_SCRIPT = 2,    // Paused by script.
     PAUSE_PAGEHIDE = 4,  // Paused because our doc is hidden.
@@ -153,58 +155,58 @@ class nsSMILTimeContainer {
   bool IsSeeking() const { return mIsSeeking; }
   void MarkSeekFinished() { mIsSeeking = false; }
 
   /*
    * Sets the parent time container.
    *
    * The callee still retains ownership of the time container.
    */
-  nsresult SetParent(nsSMILTimeContainer* aParent);
+  nsresult SetParent(SMILTimeContainer* aParent);
 
   /*
    * Registers an element for a sample at the given time.
    *
    * @param   aMilestone  The milestone to register in container time.
    * @param   aElement    The timebase element that needs a sample at
    *                      aMilestone.
    * @return  true if the element was successfully added, false otherwise.
    */
-  bool AddMilestone(const nsSMILMilestone& aMilestone,
+  bool AddMilestone(const SMILMilestone& aMilestone,
                     mozilla::dom::SVGAnimationElement& aElement);
 
   /*
    * Resets the list of milestones.
    */
   void ClearMilestones();
 
   /*
    * Returns the next significant transition from amongst the registered
    * milestones.
    *
    * @param[out] aNextMilestone The next milestone with time in parent time.
    *
    * @return true if there exists another milestone, false otherwise in
    * which case aNextMilestone will be unmodified.
    */
-  bool GetNextMilestoneInParentTime(nsSMILMilestone& aNextMilestone) const;
+  bool GetNextMilestoneInParentTime(SMILMilestone& aNextMilestone) const;
 
   typedef nsTArray<RefPtr<mozilla::dom::SVGAnimationElement> > AnimElemArray;
 
   /*
    * Removes and returns the timebase elements from the start of the list of
    * timebase elements that match the given time.
    *
    * @param      aMilestone  The milestone time to match in parent time. This
    *                         must be <= GetNextMilestoneInParentTime.
    * @param[out] aMatchedElements The array to which matching elements will be
    *                              appended.
    * @return true if one or more elements match, false otherwise.
    */
-  bool PopMilestoneElementsAtMilestone(const nsSMILMilestone& aMilestone,
+  bool PopMilestoneElementsAtMilestone(const SMILMilestone& aMilestone,
                                        AnimElemArray& aMatchedElements);
 
   // Cycle-collection support
   void Traverse(nsCycleCollectionTraversalCallback* aCallback);
   void Unlink();
 
  protected:
   /*
@@ -216,38 +218,38 @@ class nsSMILTimeContainer {
   /*
    * Adding and removing child containers is not implemented in the base class
    * because not all subclasses need this.
    */
 
   /*
    * Adds a child time container.
    */
-  virtual nsresult AddChild(nsSMILTimeContainer& aChild) {
+  virtual nsresult AddChild(SMILTimeContainer& aChild) {
     return NS_ERROR_FAILURE;
   }
 
   /*
    * Removes a child time container.
    */
-  virtual void RemoveChild(nsSMILTimeContainer& aChild) {}
+  virtual void RemoveChild(SMILTimeContainer& aChild) {}
 
   /*
    * Implementation helper to update the current time.
    */
   void UpdateCurrentTime();
 
   /*
    * Implementation helper to notify timed elements with dependencies that the
    * container time has changed with respect to the document time.
    */
   void NotifyTimeChange();
 
   // The parent time container, if any
-  nsSMILTimeContainer* mParent;
+  SMILTimeContainer* mParent;
 
   // The current time established at the last call to Sample()
   nsSMILTime mCurrentTime;
 
   // The number of milliseconds for which the container has been paused
   // (excluding the current pause interval if the container is currently
   // paused).
   //
@@ -268,29 +270,31 @@ class nsSMILTimeContainer {
   bool mHoldingEntries;  // True if there's a raw pointer to mMilestoneEntries
                          // on the stack.
 #endif
 
   // A bitfield of the pause state for all pause requests
   uint32_t mPauseState;
 
   struct MilestoneEntry {
-    MilestoneEntry(const nsSMILMilestone& aMilestone,
+    MilestoneEntry(const SMILMilestone& aMilestone,
                    mozilla::dom::SVGAnimationElement& aElement)
         : mMilestone(aMilestone), mTimebase(&aElement) {}
 
     bool operator<(const MilestoneEntry& aOther) const {
       return mMilestone < aOther.mMilestone;
     }
 
-    nsSMILMilestone mMilestone;  // In container time.
+    SMILMilestone mMilestone;  // In container time.
     RefPtr<mozilla::dom::SVGAnimationElement> mTimebase;
   };
 
   // Queue of elements with registered milestones. Used to update the model with
   // significant transitions that occur between two samples. Since timed element
   // re-register their milestones when they're sampled this is reset once we've
   // taken care of the milestones before the current sample time but before we
   // actually do the full sample.
   nsTPriorityQueue<MilestoneEntry> mMilestoneEntries;
 };
 
+}  // namespace mozilla
+
 #endif  // NS_SMILTIMECONTAINER_H_
--- a/dom/smil/SMILTimedElement.cpp
+++ b/dom/smil/SMILTimedElement.cpp
@@ -6,24 +6,24 @@
 
 #include "SMILTimedElement.h"
 
 #include "mozilla/AutoRestore.h"
 #include "mozilla/ContentEvents.h"
 #include "mozilla/DebugOnly.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/SMILAnimationFunction.h"
+#include "mozilla/SMILTimeContainer.h"
 #include "mozilla/TaskCategory.h"
 #include "mozilla/dom/SVGAnimationElement.h"
 #include "nsAttrValueInlines.h"
 #include "nsSMILTimeValue.h"
 #include "nsSMILTimeValueSpec.h"
 #include "nsSMILInstanceTime.h"
 #include "nsSMILParserUtils.h"
-#include "nsSMILTimeContainer.h"
 #include "nsGkAtoms.h"
 #include "nsReadableUtils.h"
 #include "nsMathUtils.h"
 #include "nsThreadUtils.h"
 #include "nsIPresShell.h"
 #include "prdtoa.h"
 #include "plstr.h"
 #include "prtime.h"
@@ -193,17 +193,17 @@ const nsAttrValue::EnumTable SMILTimedEl
     {"remove", FILL_REMOVE}, {"freeze", FILL_FREEZE}, {nullptr, 0}};
 
 const nsAttrValue::EnumTable SMILTimedElement::sRestartModeTable[] = {
     {"always", RESTART_ALWAYS},
     {"whenNotActive", RESTART_WHENNOTACTIVE},
     {"never", RESTART_NEVER},
     {nullptr, 0}};
 
-const nsSMILMilestone SMILTimedElement::sMaxMilestone(
+const SMILMilestone SMILTimedElement::sMaxMilestone(
     std::numeric_limits<nsSMILTime>::max(), false);
 
 // The thresholds at which point we start filtering intervals and instance times
 // indiscriminately.
 // See FilterIntervals and FilterInstanceTimes.
 const uint8_t SMILTimedElement::sMaxNumIntervals = 20;
 const uint8_t SMILTimedElement::sMaxNumInstanceTimes = 100;
 
@@ -264,17 +264,17 @@ SMILTimedElement::~SMILTimedElement() {
 }
 
 void SMILTimedElement::SetAnimationElement(SVGAnimationElement* aElement) {
   MOZ_ASSERT(aElement, "NULL owner element");
   MOZ_ASSERT(!mAnimationElement, "Re-setting owner");
   mAnimationElement = aElement;
 }
 
-nsSMILTimeContainer* SMILTimedElement::GetTimeContainer() {
+SMILTimeContainer* SMILTimedElement::GetTimeContainer() {
   return mAnimationElement ? mAnimationElement->GetTimeContainer() : nullptr;
 }
 
 dom::Element* SMILTimedElement::GetTargetElement() {
   return mAnimationElement ? mAnimationElement->GetTargetElementContent()
                            : nullptr;
 }
 
@@ -290,25 +290,25 @@ dom::Element* SMILTimedElement::GetTarge
 // This inconsistency has now been addressed by an erratum in SVG 1.1:
 //
 // http://www.w3.org/2003/01/REC-SVG11-20030114-errata#elementtimecontrol-interface
 //
 // which favours the definition in SMIL, i.e. instance times are just added
 // without first checking the restart mode.
 
 nsresult SMILTimedElement::BeginElementAt(double aOffsetSeconds) {
-  nsSMILTimeContainer* container = GetTimeContainer();
+  SMILTimeContainer* container = GetTimeContainer();
   if (!container) return NS_ERROR_FAILURE;
 
   nsSMILTime currentTime = container->GetCurrentTimeAsSMILTime();
   return AddInstanceTimeFromCurrentTime(currentTime, aOffsetSeconds, true);
 }
 
 nsresult SMILTimedElement::EndElementAt(double aOffsetSeconds) {
-  nsSMILTimeContainer* container = GetTimeContainer();
+  SMILTimeContainer* container = GetTimeContainer();
   if (!container) return NS_ERROR_FAILURE;
 
   nsSMILTime currentTime = container->GetCurrentTimeAsSMILTime();
   return AddInstanceTimeFromCurrentTime(currentTime, aOffsetSeconds, false);
 }
 
 //----------------------------------------------------------------------
 // nsSVGAnimationElement methods
@@ -498,17 +498,17 @@ void SMILTimedElement::DoSampleAt(nsSMIL
   MOZ_ASSERT(GetTimeContainer(),
              "Got sample without being registered with a time container");
 
   // This could probably happen if we later implement externalResourcesRequired
   // (bug 277955) and whilst waiting for those resources (and the animation to
   // start) we transfer a node from another document fragment that has already
   // started. In such a case we might receive milestone samples registered with
   // the already active container.
-  if (GetTimeContainer()->IsPausedByType(nsSMILTimeContainer::PAUSE_BEGIN))
+  if (GetTimeContainer()->IsPausedByType(SMILTimeContainer::PAUSE_BEGIN))
     return;
 
   // We use an end-sample to start animation since an end-sample lets us
   // tentatively create an interval without committing to it (by transitioning
   // to the ACTIVE state) and this is necessary because we might have
   // dependencies on other animations that are yet to start. After these
   // other animations start, it may be necessary to revise our initial interval.
   //
@@ -1988,35 +1988,35 @@ nsresult SMILTimedElement::AddInstanceTi
       new nsSMILInstanceTime(timeVal, nsSMILInstanceTime::SOURCE_DOM);
 
   AddInstanceTime(instanceTime, aIsBegin);
 
   return NS_OK;
 }
 
 void SMILTimedElement::RegisterMilestone() {
-  nsSMILTimeContainer* container = GetTimeContainer();
+  SMILTimeContainer* container = GetTimeContainer();
   if (!container) return;
   MOZ_ASSERT(mAnimationElement,
              "Got a time container without an owning animation element");
 
-  nsSMILMilestone nextMilestone;
+  SMILMilestone nextMilestone;
   if (!GetNextMilestone(nextMilestone)) return;
 
   // This method is called every time we might possibly have updated our
-  // current interval, but since nsSMILTimeContainer makes no attempt to filter
+  // current interval, but since SMILTimeContainer makes no attempt to filter
   // out redundant milestones we do some rudimentary filtering here. It's not
   // perfect, but unnecessary samples are fairly cheap.
   if (nextMilestone >= mPrevRegisteredMilestone) return;
 
   container->AddMilestone(nextMilestone, *mAnimationElement);
   mPrevRegisteredMilestone = nextMilestone;
 }
 
-bool SMILTimedElement::GetNextMilestone(nsSMILMilestone& aNextMilestone) const {
+bool SMILTimedElement::GetNextMilestone(SMILMilestone& aNextMilestone) const {
   // Return the next key moment in our lifetime.
   //
   // XXX It may be possible in future to optimise this so that we only register
   // for milestones if:
   // a) We have time dependents, or
   // b) We are dependent on events or syncbase relationships, or
   // c) There are registered listeners for our events
   //
@@ -2081,17 +2081,17 @@ bool SMILTimedElement::GetNextMilestone(
   MOZ_CRASH("Invalid element state");
 }
 
 void SMILTimedElement::NotifyNewInterval() {
   MOZ_ASSERT(mCurrentInterval,
              "Attempting to notify dependents of a new interval but the "
              "interval is not set");
 
-  nsSMILTimeContainer* container = GetTimeContainer();
+  SMILTimeContainer* container = GetTimeContainer();
   if (container) {
     container->SyncPauseTime();
   }
 
   for (auto iter = mTimeDependents.Iter(); !iter.Done(); iter.Next()) {
     nsSMILInterval* interval = mCurrentInterval.get();
     // It's possible that in notifying one new time dependent of a new interval
     // that a chain reaction is triggered which results in the original
@@ -2105,17 +2105,17 @@ void SMILTimedElement::NotifyNewInterval
   }
 }
 
 void SMILTimedElement::NotifyChangedInterval(nsSMILInterval* aInterval,
                                              bool aBeginObjectChanged,
                                              bool aEndObjectChanged) {
   MOZ_ASSERT(aInterval, "Null interval for change notification");
 
-  nsSMILTimeContainer* container = GetTimeContainer();
+  SMILTimeContainer* container = GetTimeContainer();
   if (container) {
     container->SyncPauseTime();
   }
 
   // Copy the instance times list since notifying the instance times can result
   // in a chain reaction whereby our own interval gets deleted along with its
   // instance times.
   InstanceTimeList times;
--- a/dom/smil/SMILTimedElement.h
+++ b/dom/smil/SMILTimedElement.h
@@ -4,35 +4,35 @@
  * 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_SMILTIMEDELEMENT_H_
 #define NS_SMILTIMEDELEMENT_H_
 
 #include "mozilla/EventForwards.h"
 #include "mozilla/Move.h"
+#include "mozilla/SMILMilestone.h"
 #include "mozilla/UniquePtr.h"
 #include "nsSMILInterval.h"
 #include "nsSMILInstanceTime.h"
-#include "nsSMILMilestone.h"
 #include "nsSMILTimeValueSpec.h"
 #include "nsSMILRepeatCount.h"
 #include "nsSMILTypes.h"
 #include "nsTArray.h"
 #include "nsTHashtable.h"
 #include "nsHashKeys.h"
 #include "nsAutoPtr.h"
 #include "nsAttrValue.h"
 
-class nsSMILTimeContainer;
 class nsSMILTimeValue;
 class nsAtom;
 
 namespace mozilla {
 class SMILAnimationFunction;
+class SMILTimeContainer;
 namespace dom {
 class SVGAnimationElement;
 }  // namespace dom
 
 //----------------------------------------------------------------------
 // SMILTimedElement
 
 class SMILTimedElement {
@@ -47,17 +47,17 @@ class SMILTimedElement {
    * container times and to register timebase elements.
    */
   void SetAnimationElement(mozilla::dom::SVGAnimationElement* aElement);
 
   /*
    * Returns the time container with which this timed element is associated or
    * nullptr if it is not associated with a time container.
    */
-  nsSMILTimeContainer* GetTimeContainer();
+  SMILTimeContainer* GetTimeContainer();
 
   /*
    * Returns the element targeted by the animation element. Needed for
    * registering event listeners against the appropriate element.
    */
   Element* GetTargetElement();
 
   /**
@@ -511,17 +511,17 @@ class SMILTimedElement {
   nsSMILInstanceTime* CheckForEarlyEnd(
       const nsSMILTimeValue& aContainerTime) const;
   void UpdateCurrentInterval(bool aForceChangeNotice = false);
   void SampleSimpleTime(nsSMILTime aActiveTime);
   void SampleFillValue();
   nsresult AddInstanceTimeFromCurrentTime(nsSMILTime aCurrentTime,
                                           double aOffsetSeconds, bool aIsBegin);
   void RegisterMilestone();
-  bool GetNextMilestone(nsSMILMilestone& aNextMilestone) const;
+  bool GetNextMilestone(SMILMilestone& aNextMilestone) const;
 
   // Notification methods. Note that these notifications can result in nested
   // calls to this same object. Therefore,
   // (i)  we should not perform notification until this object is in
   //      a consistent state to receive callbacks, and
   // (ii) after calling these methods we must assume that the state of the
   //      element may have changed.
   void NotifyNewInterval();
@@ -578,18 +578,18 @@ class SMILTimedElement {
   InstanceTimeList mBeginInstances;
   InstanceTimeList mEndInstances;
   uint32_t mInstanceSerialIndex;
 
   SMILAnimationFunction* mClient;
   UniquePtr<nsSMILInterval> mCurrentInterval;
   IntervalList mOldIntervals;
   uint32_t mCurrentRepeatIteration;
-  nsSMILMilestone mPrevRegisteredMilestone;
-  static const nsSMILMilestone sMaxMilestone;
+  SMILMilestone mPrevRegisteredMilestone;
+  static const SMILMilestone sMaxMilestone;
   static const uint8_t sMaxNumIntervals;
   static const uint8_t sMaxNumInstanceTimes;
 
   // Set of dependent time value specs to be notified when establishing a new
   // current interval. Change notifications and delete notifications are handled
   // by the interval.
   //
   // [weak] The nsSMILTimeValueSpec objects register themselves and unregister
--- a/dom/smil/moz.build
+++ b/dom/smil/moz.build
@@ -10,64 +10,64 @@ with Files("**"):
 MOCHITEST_MANIFESTS += ['test/mochitest.ini']
 
 EXPORTS += [
     'nsISMILAttr.h',
     'nsSMILCSSProperty.h',
     'nsSMILInstanceTime.h',
     'nsSMILInterval.h',
     'nsSMILKeySpline.h',
-    'nsSMILMilestone.h',
     'nsSMILRepeatCount.h',
-    'nsSMILTargetIdentifier.h',
-    'nsSMILTimeContainer.h',
     'nsSMILTimeValue.h',
     'nsSMILTimeValueSpec.h',
     'nsSMILTimeValueSpecParams.h',
     'nsSMILTypes.h',
     'nsSMILValue.h',
     'SMILCSSValueType.h',
     'SMILNullType.h',
     'SMILType.h',
 ]
 
 EXPORTS.mozilla += [
     'SMILAnimationController.h',
     'SMILAnimationFunction.h',
     'SMILCompositorTable.h',
+    'SMILMilestone.h',
     'SMILSetAnimationFunction.h',
+    'SMILTargetIdentifier.h',
+    'SMILTimeContainer.h',
     'SMILTimedElement.h',
 ]
 
 EXPORTS.mozilla.dom += [
     'TimeEvent.h',
 ]
 
 UNIFIED_SOURCES += [
     'nsSMILCSSProperty.cpp',
     'nsSMILInstanceTime.cpp',
     'nsSMILInterval.cpp',
     'nsSMILKeySpline.cpp',
     'nsSMILParserUtils.cpp',
     'nsSMILRepeatCount.cpp',
-    'nsSMILTimeContainer.cpp',
     'nsSMILTimeValue.cpp',
     'nsSMILTimeValueSpec.cpp',
     'nsSMILValue.cpp',
     'SMILAnimationController.cpp',
     'SMILAnimationFunction.cpp',
     'SMILBoolType.cpp',
     'SMILCompositor.cpp',
     'SMILCSSValueType.cpp',
     'SMILEnumType.cpp',
     'SMILFloatType.cpp',
     'SMILIntegerType.cpp',
     'SMILNullType.cpp',
     'SMILSetAnimationFunction.cpp',
     'SMILStringType.cpp',
+    'SMILTimeContainer.cpp',
     'SMILTimedElement.cpp',
     'TimeEvent.cpp',
 ]
 
 LOCAL_INCLUDES += [
     '/dom/base',
     '/dom/svg',
     '/layout/base',
--- a/dom/smil/nsSMILInstanceTime.cpp
+++ b/dom/smil/nsSMILInstanceTime.cpp
@@ -59,17 +59,17 @@ void nsSMILInstanceTime::Unlink() {
   if (mBaseInterval) {
     mBaseInterval->RemoveDependentTime(*this);
     mBaseInterval = nullptr;
   }
   mCreator = nullptr;
 }
 
 void nsSMILInstanceTime::HandleChangedInterval(
-    const nsSMILTimeContainer* aSrcContainer, bool aBeginObjectChanged,
+    const SMILTimeContainer* aSrcContainer, bool aBeginObjectChanged,
     bool aEndObjectChanged) {
   // It's possible a sequence of notifications might cause our base interval to
   // be updated and then deleted. Furthermore, the delete might happen whilst
   // we're still in the queue to be notified of the change. In any case, if we
   // don't have a base interval, just ignore the change.
   if (!mBaseInterval) return;
 
   MOZ_ASSERT(mCreator, "Base interval is set but creator is not.");
--- a/dom/smil/nsSMILInstanceTime.h
+++ b/dom/smil/nsSMILInstanceTime.h
@@ -2,22 +2,26 @@
 /* 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_SMILINSTANCETIME_H_
 #define NS_SMILINSTANCETIME_H_
 
+#include "nsISupportsImpl.h"
 #include "nsSMILTimeValue.h"
 
 class nsSMILInterval;
-class nsSMILTimeContainer;
 class nsSMILTimeValueSpec;
 
+namespace mozilla {
+class SMILTimeContainer;
+}
+
 //----------------------------------------------------------------------
 // nsSMILInstanceTime
 //
 // An instant in document simple time that may be used in creating a new
 // interval.
 //
 // For an overview of how this class is related to other SMIL time classes see
 // the documentation in nsSMILTimeValue.h
@@ -50,17 +54,17 @@ class nsSMILInstanceTime final {
   };
 
   explicit nsSMILInstanceTime(const nsSMILTimeValue& aTime,
                               nsSMILInstanceTimeSource aSource = SOURCE_NONE,
                               nsSMILTimeValueSpec* aCreator = nullptr,
                               nsSMILInterval* aBaseInterval = nullptr);
 
   void Unlink();
-  void HandleChangedInterval(const nsSMILTimeContainer* aSrcContainer,
+  void HandleChangedInterval(const mozilla::SMILTimeContainer* aSrcContainer,
                              bool aBeginObjectChanged, bool aEndObjectChanged);
   void HandleDeletedInterval();
   void HandleFilteredInterval();
 
   const nsSMILTimeValue& Time() const { return mTime; }
   const nsSMILTimeValueSpec* GetCreator() const { return mCreator; }
 
   bool IsDynamic() const { return !!(mFlags & kDynamic); }
--- a/dom/smil/nsSMILTimeValueSpec.cpp
+++ b/dom/smil/nsSMILTimeValueSpec.cpp
@@ -1,22 +1,22 @@
 /* -*- 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 "mozilla/EventListenerManager.h"
+#include "mozilla/SMILTimeContainer.h"
 #include "mozilla/SMILTimedElement.h"
 #include "mozilla/dom/Event.h"
 #include "mozilla/dom/SVGAnimationElement.h"
 #include "mozilla/dom/TimeEvent.h"
 #include "nsSMILTimeValueSpec.h"
 #include "nsSMILInterval.h"
-#include "nsSMILTimeContainer.h"
 #include "nsSMILTimeValue.h"
 #include "nsSMILInstanceTime.h"
 #include "nsSMILParserUtils.h"
 #include "nsString.h"
 #include <limits>
 
 using namespace mozilla;
 using namespace mozilla::dom;
@@ -103,17 +103,17 @@ void nsSMILTimeValueSpec::ResolveReferen
 }
 
 bool nsSMILTimeValueSpec::IsEventBased() const {
   return mParams.mType == nsSMILTimeValueSpecParams::EVENT ||
          mParams.mType == nsSMILTimeValueSpecParams::REPEAT;
 }
 
 void nsSMILTimeValueSpec::HandleNewInterval(
-    nsSMILInterval& aInterval, const nsSMILTimeContainer* aSrcContainer) {
+    nsSMILInterval& aInterval, const SMILTimeContainer* aSrcContainer) {
   const nsSMILInstanceTime& baseInstance =
       mParams.mSyncBegin ? *aInterval.Begin() : *aInterval.End();
   nsSMILTimeValue newTime =
       ConvertBetweenTimeContainers(baseInstance.Time(), aSrcContainer);
 
   // Apply offset
   if (!ApplyOffset(newTime)) {
     NS_WARNING("New time overflows nsSMILTime, ignoring");
@@ -128,18 +128,17 @@ void nsSMILTimeValueSpec::HandleNewInter
 
 void nsSMILTimeValueSpec::HandleTargetElementChange(Element* aNewTarget) {
   if (!IsEventBased() || mParams.mDependentElemID) return;
 
   mReferencedElement.ResetWithElement(aNewTarget);
 }
 
 void nsSMILTimeValueSpec::HandleChangedInstanceTime(
-    const nsSMILInstanceTime& aBaseTime,
-    const nsSMILTimeContainer* aSrcContainer,
+    const nsSMILInstanceTime& aBaseTime, const SMILTimeContainer* aSrcContainer,
     nsSMILInstanceTime& aInstanceTimeToUpdate, bool aObjectChanged) {
   // If the instance time is fixed (e.g. because it's being used as the begin
   // time of an active or postactive interval) we just ignore the change.
   if (aInstanceTimeToUpdate.IsFixedTime()) return;
 
   nsSMILTimeValue updatedTime =
       ConvertBetweenTimeContainers(aBaseTime.Time(), aSrcContainer);
 
@@ -289,17 +288,17 @@ void nsSMILTimeValueSpec::UnregisterEven
 void nsSMILTimeValueSpec::HandleEvent(Event* aEvent) {
   MOZ_ASSERT(mEventListener, "Got event without an event listener");
   MOZ_ASSERT(IsEventBased(), "Got event for non-event nsSMILTimeValueSpec");
   MOZ_ASSERT(aEvent, "No event supplied");
 
   // XXX In the long run we should get the time from the event itself which will
   // store the time in global document time which we'll need to convert to our
   // time container
-  nsSMILTimeContainer* container = mOwner->GetTimeContainer();
+  SMILTimeContainer* container = mOwner->GetTimeContainer();
   if (!container) return;
 
   if (mParams.mType == nsSMILTimeValueSpecParams::REPEAT &&
       !CheckRepeatEventDetail(aEvent)) {
     return;
   }
 
   nsSMILTime currentTime = container->GetCurrentTimeAsSMILTime();
@@ -321,23 +320,23 @@ bool nsSMILTimeValueSpec::CheckRepeatEve
     return false;
   }
 
   int32_t detail = timeEvent->Detail();
   return detail > 0 && (uint32_t)detail == mParams.mRepeatIteration;
 }
 
 nsSMILTimeValue nsSMILTimeValueSpec::ConvertBetweenTimeContainers(
-    const nsSMILTimeValue& aSrcTime, const nsSMILTimeContainer* aSrcContainer) {
+    const nsSMILTimeValue& aSrcTime, const SMILTimeContainer* aSrcContainer) {
   // If the source time is either indefinite or unresolved the result is going
   // to be the same
   if (!aSrcTime.IsDefinite()) return aSrcTime;
 
   // Convert from source time container to our parent time container
-  const nsSMILTimeContainer* dstContainer = mOwner->GetTimeContainer();
+  const SMILTimeContainer* dstContainer = mOwner->GetTimeContainer();
   if (dstContainer == aSrcContainer) return aSrcTime;
 
   // If one of the elements is not attached to a time container then we can't do
   // any meaningful conversion
   if (!aSrcContainer || !dstContainer) return nsSMILTimeValue();  // unresolved
 
   nsSMILTimeValue docTime =
       aSrcContainer->ContainerToParentTime(aSrcTime.GetMillis());
--- a/dom/smil/nsSMILTimeValueSpec.h
+++ b/dom/smil/nsSMILTimeValueSpec.h
@@ -9,21 +9,21 @@
 
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/IDTracker.h"
 #include "nsSMILTimeValueSpecParams.h"
 #include "nsStringFwd.h"
 #include "nsIDOMEventListener.h"
 
 class nsSMILTimeValue;
-class nsSMILTimeContainer;
 class nsSMILInstanceTime;
 class nsSMILInterval;
 
 namespace mozilla {
+class SMILTimeContainer;
 class SMILTimedElement;
 namespace dom {
 class Event;
 }  // namespace dom
 
 class EventListenerManager;
 }  // namespace mozilla
 
@@ -35,36 +35,37 @@ class EventListenerManager;
 // necessary event handling (for event and repeat specifications)
 // and synchronisation (for syncbase specifications).
 //
 // For an overview of how this class is related to other SMIL time classes see
 // the documentation in nsSMILTimeValue.h
 
 class nsSMILTimeValueSpec {
  public:
+  typedef mozilla::SMILTimeContainer SMILTimeContainer;
   typedef mozilla::SMILTimedElement SMILTimedElement;
   typedef mozilla::dom::Element Element;
   typedef mozilla::dom::Event Event;
   typedef mozilla::dom::IDTracker IDTracker;
 
   nsSMILTimeValueSpec(SMILTimedElement& aOwner, bool aIsBegin);
   ~nsSMILTimeValueSpec();
 
   nsresult SetSpec(const nsAString& aStringSpec, Element& aContextElement);
   void ResolveReferences(Element& aContextElement);
   bool IsEventBased() const;
 
   void HandleNewInterval(nsSMILInterval& aInterval,
-                         const nsSMILTimeContainer* aSrcContainer);
+                         const SMILTimeContainer* aSrcContainer);
   void HandleTargetElementChange(Element* aNewTarget);
 
   // For created nsSMILInstanceTime objects
   bool DependsOnBegin() const;
   void HandleChangedInstanceTime(const nsSMILInstanceTime& aBaseTime,
-                                 const nsSMILTimeContainer* aSrcContainer,
+                                 const SMILTimeContainer* aSrcContainer,
                                  nsSMILInstanceTime& aInstanceTimeToUpdate,
                                  bool aObjectChanged);
   void HandleDeletedInstanceTime(nsSMILInstanceTime& aInstanceTime);
 
   // Cycle-collection support
   void Traverse(nsCycleCollectionTraversalCallback* aCallback);
   void Unlink();
 
@@ -73,18 +74,17 @@ class nsSMILTimeValueSpec {
   void UnregisterFromReferencedElement(Element* aElement);
   SMILTimedElement* GetTimedElement(Element* aElement);
   bool IsWhitelistedEvent();
   void RegisterEventListener(Element* aElement);
   void UnregisterEventListener(Element* aElement);
   void HandleEvent(Event* aEvent);
   bool CheckRepeatEventDetail(Event* aEvent);
   nsSMILTimeValue ConvertBetweenTimeContainers(
-      const nsSMILTimeValue& aSrcTime,
-      const nsSMILTimeContainer* aSrcContainer);
+      const nsSMILTimeValue& aSrcTime, const SMILTimeContainer* aSrcContainer);
   bool ApplyOffset(nsSMILTimeValue& aTime) const;
 
   SMILTimedElement* mOwner;
   bool mIsBegin;  // Indicates if *we* are a begin spec,
                   // not to be confused with
                   // mParams.mSyncBegin which indicates
                   // if we're synced with the begin of
                   // the target.
--- a/dom/svg/SVGAnimationElement.cpp
+++ b/dom/svg/SVGAnimationElement.cpp
@@ -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/. */
 
 #include "mozilla/dom/SVGAnimationElement.h"
 #include "mozilla/dom/SVGSVGElement.h"
 #include "mozilla/dom/ElementInlines.h"
 #include "mozilla/SMILAnimationController.h"
 #include "mozilla/SMILAnimationFunction.h"
-#include "nsSMILTimeContainer.h"
+#include "mozilla/SMILTimeContainer.h"
 #include "nsContentUtils.h"
 #include "nsIContentInlines.h"
 #include "nsIURI.h"
 #include "prtime.h"
 
 namespace mozilla {
 namespace dom {
 
@@ -105,17 +105,17 @@ float SVGAnimationElement::GetStartTime(
   }
 
   return float(double(startTime.GetMillis()) / PR_MSEC_PER_SEC);
 }
 
 float SVGAnimationElement::GetCurrentTimeAsFloat() {
   // Not necessary to call FlushAnimations() for this
 
-  nsSMILTimeContainer* root = GetTimeContainer();
+  SMILTimeContainer* root = GetTimeContainer();
   if (root) {
     return float(double(root->GetCurrentTimeAsSMILTime()) / PR_MSEC_PER_SEC);
   }
 
   return 0.0f;
 }
 
 float SVGAnimationElement::GetSimpleDuration(ErrorResult& rv) {
@@ -294,17 +294,17 @@ bool SVGAnimationElement::IsNodeOfType(u
 void SVGAnimationElement::ActivateByHyperlink() {
   FlushAnimations();
 
   // The behavior for when the target is an animation element is defined in
   // SMIL Animation:
   //   http://www.w3.org/TR/smil-animation/#HyperlinkSemantics
   nsSMILTimeValue seekTime = mTimedElement.GetHyperlinkTime();
   if (seekTime.IsDefinite()) {
-    nsSMILTimeContainer* timeContainer = GetTimeContainer();
+    SMILTimeContainer* timeContainer = GetTimeContainer();
     if (timeContainer) {
       timeContainer->SetCurrentTime(seekTime.GetMillis());
       AnimationNeedsResample();
       // As with SVGSVGElement::SetCurrentTime, we need to trigger
       // a synchronous sample now.
       FlushAnimations();
     }
     // else, silently fail. We mustn't be part of an SVG document fragment that
@@ -312,17 +312,17 @@ void SVGAnimationElement::ActivateByHype
   } else {
     BeginElement(IgnoreErrors());
   }
 }
 
 //----------------------------------------------------------------------
 // Implementation helpers
 
-nsSMILTimeContainer* SVGAnimationElement::GetTimeContainer() {
+SMILTimeContainer* SVGAnimationElement::GetTimeContainer() {
   SVGSVGElement* element = SVGContentUtils::GetOuterSVGElement(this);
 
   if (element) {
     return element->GetTimedDocumentRoot();
   }
 
   return nullptr;
 }
--- a/dom/svg/SVGAnimationElement.h
+++ b/dom/svg/SVGAnimationElement.h
@@ -3,20 +3,20 @@
 /* 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_SVGAnimationElement_h
 #define mozilla_dom_SVGAnimationElement_h
 
 #include "mozilla/Attributes.h"
+#include "mozilla/SMILTimedElement.h"
 #include "mozilla/dom/IDTracker.h"
 #include "mozilla/dom/SVGElement.h"
 #include "mozilla/dom/SVGTests.h"
-#include "mozilla/SMILTimedElement.h"
 
 namespace mozilla {
 namespace dom {
 
 typedef SVGElement SVGAnimationElementBase;
 
 enum nsSMILTargetAttrType {
   eSMILTargetAttrType_auto,
@@ -57,17 +57,17 @@ class SVGAnimationElement : public SVGAn
                                 const nsAttrValue* aOldValue,
                                 nsIPrincipal* aSubjectPrincipal,
                                 bool aNotify) override;
 
   Element* GetTargetElementContent();
   virtual bool GetTargetAttributeName(int32_t* aNamespaceID,
                                       nsAtom** aLocalName) const;
   mozilla::SMILTimedElement& TimedElement();
-  nsSMILTimeContainer* GetTimeContainer();
+  mozilla::SMILTimeContainer* GetTimeContainer();
   virtual SMILAnimationFunction& AnimationFunction() = 0;
 
   virtual bool IsEventAttributeNameInternal(nsAtom* aName) override;
 
   // Utility methods for within SVG
   void ActivateByHyperlink();
 
   // WebIDL
--- a/dom/svg/SVGSVGElement.cpp
+++ b/dom/svg/SVGSVGElement.cpp
@@ -8,26 +8,26 @@
 
 #include "mozilla/ContentEvents.h"
 #include "mozilla/dom/SVGSVGElementBinding.h"
 #include "mozilla/dom/SVGMatrix.h"
 #include "mozilla/dom/SVGRect.h"
 #include "mozilla/dom/SVGViewElement.h"
 #include "mozilla/EventDispatcher.h"
 #include "mozilla/SMILAnimationController.h"
+#include "mozilla/SMILTimeContainer.h"
 
 #include "DOMSVGAngle.h"
 #include "DOMSVGLength.h"
 #include "DOMSVGNumber.h"
 #include "DOMSVGPoint.h"
 #include "nsFrameSelection.h"
 #include "nsLayoutStylesheetCache.h"
 #include "nsIFrame.h"
 #include "nsISVGSVGFrame.h"
-#include "nsSMILTimeContainer.h"
 #include "nsSVGDisplayableFrame.h"
 #include "nsSVGUtils.h"
 
 NS_IMPL_NS_NEW_SVG_ELEMENT_CHECK_PARSER(SVG)
 
 using namespace mozilla::gfx;
 
 namespace mozilla {
@@ -191,35 +191,35 @@ void SVGSVGElement::UnsuspendRedrawAll()
 }
 
 void SVGSVGElement::ForceRedraw() {
   // no-op
 }
 
 void SVGSVGElement::PauseAnimations() {
   if (mTimedDocumentRoot) {
-    mTimedDocumentRoot->Pause(nsSMILTimeContainer::PAUSE_SCRIPT);
+    mTimedDocumentRoot->Pause(SMILTimeContainer::PAUSE_SCRIPT);
   }
   // else we're not the outermost <svg> or not bound to a tree, so silently fail
 }
 
 void SVGSVGElement::UnpauseAnimations() {
   if (mTimedDocumentRoot) {
-    mTimedDocumentRoot->Resume(nsSMILTimeContainer::PAUSE_SCRIPT);
+    mTimedDocumentRoot->Resume(SMILTimeContainer::PAUSE_SCRIPT);
   }
   // else we're not the outermost <svg> or not bound to a tree, so silently fail
 }
 
 bool SVGSVGElement::AnimationsPaused() {
-  nsSMILTimeContainer* root = GetTimedDocumentRoot();
-  return root && root->IsPausedByType(nsSMILTimeContainer::PAUSE_SCRIPT);
+  SMILTimeContainer* root = GetTimedDocumentRoot();
+  return root && root->IsPausedByType(SMILTimeContainer::PAUSE_SCRIPT);
 }
 
 float SVGSVGElement::GetCurrentTimeAsFloat() {
-  nsSMILTimeContainer* root = GetTimedDocumentRoot();
+  SMILTimeContainer* root = GetTimedDocumentRoot();
   if (root) {
     double fCurrentTimeMs = double(root->GetCurrentTimeAsSMILTime());
     return (float)(fCurrentTimeMs / PR_MSEC_PER_SEC);
   } else {
     return 0.f;
   }
 }
 
@@ -353,17 +353,17 @@ void SVGSVGElement::SetZoomAndPan(uint16
     mEnumAttributes[ZOOMANDPAN].SetBaseValue(aZoomAndPan, this);
     return;
   }
 
   rv.ThrowRangeError<MSG_INVALID_ZOOMANDPAN_VALUE_ERROR>();
 }
 
 //----------------------------------------------------------------------
-nsSMILTimeContainer* SVGSVGElement::GetTimedDocumentRoot() {
+SMILTimeContainer* SVGSVGElement::GetTimedDocumentRoot() {
   if (mTimedDocumentRoot) {
     return mTimedDocumentRoot;
   }
 
   // We must not be the outermost <svg> element, try to find it
   SVGSVGElement* outerSVGElement = SVGContentUtils::GetOuterSVGElement(this);
 
   if (outerSVGElement) {
@@ -380,17 +380,17 @@ nsresult SVGSVGElement::BindToTree(nsIDo
 
   if (aDocument) {
     smilController = aDocument->GetAnimationController();
     if (smilController) {
       // SMIL is enabled in this document
       if (WillBeOutermostSVG(aParent, aBindingParent)) {
         // We'll be the outermost <svg> element.  We'll need a time container.
         if (!mTimedDocumentRoot) {
-          mTimedDocumentRoot = new nsSMILTimeContainer();
+          mTimedDocumentRoot = new SMILTimeContainer();
         }
       } else {
         // We're a child of some other <svg> element, so we don't need our own
         // time container. However, we need to make sure that we'll get a
         // kick-start if we get promoted to be outermost later on.
         mTimedDocumentRoot = nullptr;
         mStartAnimationOnBindToTree = true;
       }
--- a/dom/svg/SVGSVGElement.h
+++ b/dom/svg/SVGSVGElement.h
@@ -8,20 +8,19 @@
 #define mozilla_dom_SVGSVGElement_h
 
 #include "SVGViewportElement.h"
 
 nsresult NS_NewSVGSVGElement(
     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
     mozilla::dom::FromParser aFromParser);
 
-class nsSMILTimeContainer;
-
 namespace mozilla {
 class AutoSVGViewHandler;
+class SMILTimeContainer;
 class SVGFragmentIdentifier;
 class EventChainPreVisitor;
 
 namespace dom {
 class DOMSVGAngle;
 class DOMSVGLength;
 class DOMSVGNumber;
 class SVGMatrix;
@@ -155,17 +154,17 @@ class SVGSVGElement final : public SVGSV
   // SVGSVGElement methods:
 
   // Returns true IFF our attributes are currently overridden by a <view>
   // element and that element's ID matches the passed-in string.
   bool IsOverriddenBy(const nsAString& aViewID) const {
     return mCurrentViewID && mCurrentViewID->Equals(aViewID);
   }
 
-  nsSMILTimeContainer* GetTimedDocumentRoot();
+  SMILTimeContainer* GetTimedDocumentRoot();
 
   // public helpers:
 
   /**
    * Returns -1 if the width/height is a percentage, else returns the user unit
    * length clamped to fit in a int32_t.
    * XXX see bug 1112533 comment 3 - we should fix drawImage so that we can
    * change these methods to make zero the error flag for percentages.
@@ -226,17 +225,17 @@ class SVGSVGElement final : public SVGSV
 
   enum { ZOOMANDPAN };
   nsSVGEnum mEnumAttributes[1];
   static nsSVGEnumMapping sZoomAndPanMap[];
   static EnumInfo sEnumInfo[1];
 
   // The time container for animations within this SVG document fragment. Set
   // for all outermost <svg> elements (not nested <svg> elements).
-  nsAutoPtr<nsSMILTimeContainer> mTimedDocumentRoot;
+  nsAutoPtr<SMILTimeContainer> mTimedDocumentRoot;
 
   // zoom and pan
   // IMPORTANT: see the comment in RecordCurrentScaleTranslate before writing
   // code to change any of these!
   SVGPoint mCurrentTranslate;
   float mCurrentScale;
   SVGPoint mPreviousTranslate;
   float mPreviousScale;
--- a/gfx/thebes/gfxSVGGlyphs.cpp
+++ b/gfx/thebes/gfxSVGGlyphs.cpp
@@ -151,18 +151,17 @@ nsresult gfxSVGGlyphsDocument::SetupPres
   if (!presShell->DidInitialize()) {
     rv = presShell->Initialize();
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   mDocument->FlushPendingNotifications(FlushType::Layout);
 
   if (mDocument->HasAnimationController()) {
-    mDocument->GetAnimationController()->Resume(
-        nsSMILTimeContainer::PAUSE_IMAGE);
+    mDocument->GetAnimationController()->Resume(SMILTimeContainer::PAUSE_IMAGE);
   }
   mDocument->ImageTracker()->SetAnimatingState(true);
 
   mViewer = viewer;
   mPresShell = presShell;
   mPresShell->AddPostRefreshObserver(this);
 
   return NS_OK;
--- a/image/SVGDocumentWrapper.cpp
+++ b/image/SVGDocumentWrapper.cpp
@@ -126,34 +126,34 @@ void SVGDocumentWrapper::StartAnimation(
   if (!mViewer) {
     return;
   }
 
   nsIDocument* doc = mViewer->GetDocument();
   if (doc) {
     SMILAnimationController* controller = doc->GetAnimationController();
     if (controller) {
-      controller->Resume(nsSMILTimeContainer::PAUSE_IMAGE);
+      controller->Resume(SMILTimeContainer::PAUSE_IMAGE);
     }
     doc->ImageTracker()->SetAnimatingState(true);
   }
 }
 
 void SVGDocumentWrapper::StopAnimation() {
   // Can be called for animated images during shutdown, after we've
   // already Observe()'d XPCOM shutdown and cleared out our mViewer pointer.
   if (!mViewer) {
     return;
   }
 
   nsIDocument* doc = mViewer->GetDocument();
   if (doc) {
     SMILAnimationController* controller = doc->GetAnimationController();
     if (controller) {
-      controller->Pause(nsSMILTimeContainer::PAUSE_IMAGE);
+      controller->Pause(SMILTimeContainer::PAUSE_IMAGE);
     }
     doc->ImageTracker()->SetAnimatingState(false);
   }
 }
 
 void SVGDocumentWrapper::ResetAnimation() {
   SVGSVGElement* svgElem = GetRootSVGElem();
   if (!svgElem) {
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -1092,22 +1092,22 @@ void nsPresContext::SetImgAnimations(nsI
 void nsPresContext::SetSMILAnimations(nsIDocument* aDoc, uint16_t aNewMode,
                                       uint16_t aOldMode) {
   if (aDoc->HasAnimationController()) {
     SMILAnimationController* controller = aDoc->GetAnimationController();
     switch (aNewMode) {
       case imgIContainer::kNormalAnimMode:
       case imgIContainer::kLoopOnceAnimMode:
         if (aOldMode == imgIContainer::kDontAnimMode)
-          controller->Resume(nsSMILTimeContainer::PAUSE_USERPREF);
+          controller->Resume(SMILTimeContainer::PAUSE_USERPREF);
         break;
 
       case imgIContainer::kDontAnimMode:
         if (aOldMode != imgIContainer::kDontAnimMode)
-          controller->Pause(nsSMILTimeContainer::PAUSE_USERPREF);
+          controller->Pause(SMILTimeContainer::PAUSE_USERPREF);
         break;
     }
   }
 }
 
 void nsPresContext::SetImageAnimationMode(uint16_t aMode) {
   NS_ASSERTION(aMode == imgIContainer::kNormalAnimMode ||
                    aMode == imgIContainer::kDontAnimMode ||