Bug 1516411 - Move nsSMILAnimationController into the mozilla namespace and rename it as SMILAnimationController r=birtles
authorlongsonr <longsonr@gmail.com>
Fri, 28 Dec 2018 11:47:58 +0000
changeset 452042 04943bb8dcdcbb78870d89246939248d3f0f6a56
parent 452041 4b34ca564fc01c3669796af28b6a18f46ecd1862
child 452043 6b9e37b4b8a343bb6a4ccf5c62c0f2e5daec0000
push id35282
push userbtara@mozilla.com
push dateFri, 28 Dec 2018 21:50:42 +0000
treeherdermozilla-central@0cf7daf34a37 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles
bugs1516411
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 1516411 - Move nsSMILAnimationController into the mozilla namespace and rename it as SMILAnimationController r=birtles
dom/base/nsDocument.cpp
dom/base/nsIDocument.h
dom/smil/SMILAnimationController.cpp
dom/smil/SMILAnimationController.h
dom/smil/moz.build
dom/smil/nsSMILAnimationController.cpp
dom/smil/nsSMILAnimationController.h
dom/smil/nsSMILCompositor.h
dom/smil/nsSMILCompositorTable.h
dom/smil/nsSMILTargetIdentifier.h
dom/svg/SVGAnimationElement.cpp
dom/svg/SVGElement.cpp
dom/svg/SVGSVGElement.cpp
gfx/thebes/gfxSVGGlyphs.cpp
image/SVGDocumentWrapper.cpp
layout/base/PresShell.cpp
layout/base/nsPresContext.cpp
layout/style/ServoStyleSet.cpp
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -172,17 +172,17 @@
 #include "mozilla/dom/HTMLTextAreaElement.h"
 #include "mozilla/dom/MediaSource.h"
 
 #include "mozAutoDocUpdate.h"
 #include "nsGlobalWindow.h"
 #include "mozilla/Encoding.h"
 #include "nsDOMNavigationTiming.h"
 
-#include "nsSMILAnimationController.h"
+#include "mozilla/SMILAnimationController.h"
 #include "imgIContainer.h"
 #include "nsSVGUtils.h"
 
 #include "nsRefreshDriver.h"
 
 // FOR CSP (autogenerated by xpidl)
 #include "nsIContentSecurityPolicy.h"
 #include "mozilla/dom/nsCSPContext.h"
@@ -6124,24 +6124,24 @@ nsIDocument* nsIDocument::RequestExterna
       aURI, aReferrer, aReferrerPolicy, aRequestingNode, this, aPendingLoad);
 }
 
 void nsIDocument::EnumerateExternalResources(nsSubDocEnumFunc aCallback,
                                              void* aData) {
   mExternalResourceMap.EnumerateResources(aCallback, aData);
 }
 
-nsSMILAnimationController* nsIDocument::GetAnimationController() {
+SMILAnimationController* nsIDocument::GetAnimationController() {
   // We create the animation controller lazily because most documents won't want
   // one and only SVG documents and the like will call this
   if (mAnimationController) return mAnimationController;
   // Refuse to create an Animation Controller for data documents.
   if (mLoadedAsData || mLoadedAsInteractiveData) return nullptr;
 
-  mAnimationController = new nsSMILAnimationController(this);
+  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);
   }
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -107,17 +107,16 @@ class nsISecurityConsoleMessage;
 class nsIStreamListener;
 class nsIStructuredCloneContainer;
 class nsIURI;
 class nsIVariant;
 class nsViewManager;
 class nsPresContext;
 class nsRange;
 class nsSimpleContentList;
-class nsSMILAnimationController;
 class nsTextNode;
 class nsUnblockOnloadEvent;
 class nsWindowSizes;
 class nsDOMCaretPosition;
 class nsViewportInfo;
 class nsIGlobalObject;
 class nsIXULWindow;
 
@@ -127,16 +126,17 @@ class CSSStyleSheet;
 class Encoding;
 class ErrorResult;
 class EventStates;
 class EventListenerManager;
 class FullscreenExit;
 class FullscreenRequest;
 class PendingAnimationTracker;
 class ServoStyleSet;
+class SMILAnimationController;
 template <typename>
 class OwningNonNull;
 struct URLExtraData;
 
 namespace css {
 class Loader;
 class ImageLoader;
 class Rule;
@@ -2403,17 +2403,17 @@ class nsIDocument : public nsINode,
   // will have a non-null return value.
   bool HasAnimationController() { return !!mAnimationController; }
 
   // Getter for this document's SMIL Animation Controller. Performs lazy
   // initialization, if this document supports animation and if
   // mAnimationController isn't yet initialized.
   //
   // If HasAnimationController is true, this is guaranteed to return non-null.
-  nsSMILAnimationController* GetAnimationController();
+  mozilla::SMILAnimationController* GetAnimationController();
 
   // Gets the tracker for animations that are waiting to start.
   // Returns nullptr if there is no pending animation tracker for this document
   // which will be the case if there have never been any CSS animations or
   // transitions on elements in the document.
   mozilla::PendingAnimationTracker* GetPendingAnimationTracker() {
     return mPendingAnimationTracker;
   }
@@ -3643,17 +3643,17 @@ class nsIDocument : public nsINode,
 
   typedef mozilla::SegmentedVector<nsCOMPtr<mozilla::dom::Link>, kSegmentSize,
                                    InfallibleAllocPolicy>
       LinksToUpdateList;
 
   LinksToUpdateList mLinksToUpdate;
 
   // SMIL Animation Controller, lazily-initialized in GetAnimationController
-  RefPtr<nsSMILAnimationController> mAnimationController;
+  RefPtr<mozilla::SMILAnimationController> mAnimationController;
 
   // Table of element properties for this document.
   nsPropertyTable mPropertyTable;
 
   // Our cached .children collection
   nsCOMPtr<nsIHTMLCollection> mChildrenCollection;
 
   // Various DOM lists
rename from dom/smil/nsSMILAnimationController.cpp
rename to dom/smil/SMILAnimationController.cpp
--- a/dom/smil/nsSMILAnimationController.cpp
+++ b/dom/smil/SMILAnimationController.cpp
@@ -1,15 +1,15 @@
 /* -*- 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 "nsSMILAnimationController.h"
+#include "mozilla/SMILAnimationController.h"
 
 #include <algorithm>
 
 #include "mozilla/AutoRestore.h"
 #include "mozilla/RestyleManager.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/SVGAnimationElement.h"
 #include "nsContentUtils.h"
@@ -17,26 +17,27 @@
 #include "nsIDocument.h"
 #include "nsIPresShell.h"
 #include "nsIPresShellInlines.h"
 #include "nsITimer.h"
 #include "nsSMILCompositor.h"
 #include "nsSMILCSSProperty.h"
 #include "nsSMILTimedElement.h"
 
-using namespace mozilla;
 using namespace mozilla::dom;
 
+namespace mozilla {
+
 //----------------------------------------------------------------------
-// nsSMILAnimationController implementation
+// SMILAnimationController implementation
 
 //----------------------------------------------------------------------
 // ctors, dtors, factory methods
 
-nsSMILAnimationController::nsSMILAnimationController(nsIDocument* aDoc)
+SMILAnimationController::SMILAnimationController(nsIDocument* aDoc)
     : mAvgTimeBetweenSamples(0),
       mResampleNeeded(false),
       mDeferredStartSampling(false),
       mRunningSample(false),
       mRegisteredWithRefreshDriver(false),
       mMightHavePendingStyleUpdates(false),
       mDocument(aDoc) {
   MOZ_ASSERT(aDoc, "need a non-null document");
@@ -47,73 +48,73 @@ nsSMILAnimationController::nsSMILAnimati
   } else {
     mStartTime = mozilla::TimeStamp::Now();
   }
   mCurrentSampleTime = mStartTime;
 
   Begin();
 }
 
-nsSMILAnimationController::~nsSMILAnimationController() {
+SMILAnimationController::~SMILAnimationController() {
   NS_ASSERTION(mAnimationElementTable.Count() == 0,
                "Animation controller shouldn't be tracking any animation"
                " elements when it dies");
   NS_ASSERTION(!mRegisteredWithRefreshDriver,
                "Leaving stale entry in refresh driver's observer list");
 }
 
-void nsSMILAnimationController::Disconnect() {
+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,
                "Expecting to be paused for pagehide before disconnect");
 
   StopSampling(GetRefreshDriver());
 
   mDocument = nullptr;  // (raw pointer)
 }
 
 //----------------------------------------------------------------------
 // nsSMILTimeContainer methods:
 
-void nsSMILAnimationController::Pause(uint32_t aType) {
+void SMILAnimationController::Pause(uint32_t aType) {
   nsSMILTimeContainer::Pause(aType);
 
   if (mPauseState) {
     mDeferredStartSampling = false;
     StopSampling(GetRefreshDriver());
   }
 }
 
-void nsSMILAnimationController::Resume(uint32_t aType) {
+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);
 
   if (wasPaused && !mPauseState && mChildContainerTable.Count()) {
     MaybeStartSampling(GetRefreshDriver());
     Sample();  // Run the first sample manually
   }
 }
 
-nsSMILTime nsSMILAnimationController::GetParentTime() const {
+nsSMILTime SMILAnimationController::GetParentTime() const {
   return (nsSMILTime)(mCurrentSampleTime - mStartTime).ToMilliseconds();
 }
 
 //----------------------------------------------------------------------
 // nsARefreshObserver methods:
-NS_IMPL_ADDREF(nsSMILAnimationController)
-NS_IMPL_RELEASE(nsSMILAnimationController)
+NS_IMPL_ADDREF(SMILAnimationController)
+NS_IMPL_RELEASE(SMILAnimationController)
 
 // nsRefreshDriver Callback function
-void nsSMILAnimationController::WillRefresh(mozilla::TimeStamp aTime) {
+void SMILAnimationController::WillRefresh(mozilla::TimeStamp aTime) {
   // Although we never expect aTime to go backwards, when we initialise the
   // animation controller, if we can't get hold of a refresh driver we
   // initialise mCurrentSampleTime to Now(). It may be possible that after
   // doing so we get sampled by a refresh driver whose most recent refresh time
   // predates when we were initialised, so to be safe we make sure to take the
   // most recent time here.
   aTime = std::max(mCurrentSampleTime, aTime);
 
@@ -153,113 +154,113 @@ void nsSMILAnimationController::WillRefr
   mCurrentSampleTime = aTime;
 
   Sample();
 }
 
 //----------------------------------------------------------------------
 // Animation element registration methods:
 
-void nsSMILAnimationController::RegisterAnimationElement(
+void SMILAnimationController::RegisterAnimationElement(
     SVGAnimationElement* aAnimationElement) {
   mAnimationElementTable.PutEntry(aAnimationElement);
   if (mDeferredStartSampling) {
     mDeferredStartSampling = false;
     if (mChildContainerTable.Count()) {
       // mAnimationElementTable was empty, but now we've added its 1st element
       MOZ_ASSERT(mAnimationElementTable.Count() == 1,
                  "we shouldn't have deferred sampling if we already had "
                  "animations registered");
       StartSampling(GetRefreshDriver());
       Sample();  // Run the first sample manually
     }  // else, don't sample until a time container is registered (via AddChild)
   }
 }
 
-void nsSMILAnimationController::UnregisterAnimationElement(
+void SMILAnimationController::UnregisterAnimationElement(
     SVGAnimationElement* aAnimationElement) {
   mAnimationElementTable.RemoveEntry(aAnimationElement);
 }
 
 //----------------------------------------------------------------------
 // Page show/hide
 
-void nsSMILAnimationController::OnPageShow() {
+void SMILAnimationController::OnPageShow() {
   Resume(nsSMILTimeContainer::PAUSE_PAGEHIDE);
 }
 
-void nsSMILAnimationController::OnPageHide() {
+void SMILAnimationController::OnPageHide() {
   Pause(nsSMILTimeContainer::PAUSE_PAGEHIDE);
 }
 
 //----------------------------------------------------------------------
 // Cycle-collection support
 
-void nsSMILAnimationController::Traverse(
+void SMILAnimationController::Traverse(
     nsCycleCollectionTraversalCallback* aCallback) {
   // Traverse last compositor table
   if (mLastCompositorTable) {
     for (auto iter = mLastCompositorTable->Iter(); !iter.Done(); iter.Next()) {
       nsSMILCompositor* compositor = iter.Get();
       compositor->Traverse(aCallback);
     }
   }
 }
 
-void nsSMILAnimationController::Unlink() { mLastCompositorTable = nullptr; }
+void SMILAnimationController::Unlink() { mLastCompositorTable = nullptr; }
 
 //----------------------------------------------------------------------
 // Refresh driver lifecycle related methods
 
-void nsSMILAnimationController::NotifyRefreshDriverCreated(
+void SMILAnimationController::NotifyRefreshDriverCreated(
     nsRefreshDriver* aRefreshDriver) {
   if (!mPauseState) {
     MaybeStartSampling(aRefreshDriver);
   }
 }
 
-void nsSMILAnimationController::NotifyRefreshDriverDestroying(
+void SMILAnimationController::NotifyRefreshDriverDestroying(
     nsRefreshDriver* aRefreshDriver) {
   if (!mPauseState && !mDeferredStartSampling) {
     StopSampling(aRefreshDriver);
   }
 }
 
 //----------------------------------------------------------------------
 // Timer-related implementation helpers
 
-void nsSMILAnimationController::StartSampling(nsRefreshDriver* aRefreshDriver) {
+void SMILAnimationController::StartSampling(nsRefreshDriver* aRefreshDriver) {
   NS_ASSERTION(mPauseState == 0, "Starting sampling but controller is paused");
   NS_ASSERTION(!mDeferredStartSampling,
                "Started sampling but the deferred start flag is still set");
   if (aRefreshDriver) {
     MOZ_ASSERT(!mRegisteredWithRefreshDriver,
                "Redundantly registering with refresh driver");
     MOZ_ASSERT(!GetRefreshDriver() || aRefreshDriver == GetRefreshDriver(),
                "Starting sampling with wrong refresh driver");
     // We're effectively resuming from a pause so update our current sample time
     // or else it will confuse our "average time between samples" calculations.
     mCurrentSampleTime = mozilla::TimeStamp::Now();
     aRefreshDriver->AddRefreshObserver(this, FlushType::Style);
     mRegisteredWithRefreshDriver = true;
   }
 }
 
-void nsSMILAnimationController::StopSampling(nsRefreshDriver* aRefreshDriver) {
+void SMILAnimationController::StopSampling(nsRefreshDriver* aRefreshDriver) {
   if (aRefreshDriver && mRegisteredWithRefreshDriver) {
     // NOTE: The document might already have been detached from its PresContext
     // (and RefreshDriver), which would make GetRefreshDriver() return null.
     MOZ_ASSERT(!GetRefreshDriver() || aRefreshDriver == GetRefreshDriver(),
                "Stopping sampling with wrong refresh driver");
     aRefreshDriver->RemoveRefreshObserver(this, FlushType::Style);
     mRegisteredWithRefreshDriver = false;
   }
 }
 
-void nsSMILAnimationController::MaybeStartSampling(
+void SMILAnimationController::MaybeStartSampling(
     nsRefreshDriver* aRefreshDriver) {
   if (mDeferredStartSampling) {
     // We've received earlier 'MaybeStartSampling' calls, and we're
     // deferring until we get a registered animation.
     return;
   }
 
   if (mAnimationElementTable.Count()) {
@@ -267,21 +268,21 @@ void nsSMILAnimationController::MaybeSta
   } else {
     mDeferredStartSampling = true;
   }
 }
 
 //----------------------------------------------------------------------
 // Sample-related methods and callbacks
 
-void nsSMILAnimationController::DoSample() {
+void SMILAnimationController::DoSample() {
   DoSample(true);  // Skip unchanged time containers
 }
 
-void nsSMILAnimationController::DoSample(bool aSkipUnchangedContainers) {
+void SMILAnimationController::DoSample(bool aSkipUnchangedContainers) {
   if (!mDocument) {
     NS_ERROR("Shouldn't be sampling after document has disconnected");
     return;
   }
   if (mRunningSample) {
     NS_ERROR("Shouldn't be recursively sampling");
     return;
   }
@@ -415,17 +416,17 @@ void nsSMILAnimationController::DoSample
 
   // Update last compositor table
   mLastCompositorTable = currentCompositorTable.forget();
   mMightHavePendingStyleUpdates = mightHavePendingStyleUpdates;
 
   NS_ASSERTION(!mResampleNeeded, "Resample dirty flag set during sample!");
 }
 
-void nsSMILAnimationController::RewindElements() {
+void SMILAnimationController::RewindElements() {
   bool rewindNeeded = false;
   for (auto iter = mChildContainerTable.Iter(); !iter.Done(); iter.Next()) {
     nsSMILTimeContainer* container = iter.Get()->GetKey();
     if (container->NeedsRewind()) {
       rewindNeeded = true;
       break;
     }
   }
@@ -440,17 +441,17 @@ void nsSMILAnimationController::RewindEl
     }
   }
 
   for (auto iter = mChildContainerTable.Iter(); !iter.Done(); iter.Next()) {
     iter.Get()->GetKey()->ClearNeedsRewind();
   }
 }
 
-void nsSMILAnimationController::DoMilestoneSamples() {
+void SMILAnimationController::DoMilestoneSamples() {
   // We need to sample the timing model but because SMIL operates independently
   // of the frame-rate, we can get one sample at t=0s and the next at t=10min.
   //
   // In between those two sample times a whole string of significant events
   // might be expected to take place: events firing, new interdependencies
   // between animations resolved and dissolved, etc.
   //
   // Furthermore, at any given time, we want to sample all the intervals that
@@ -532,17 +533,17 @@ void nsSMILAnimationController::DoMilest
         elem->TimedElement().SampleEndAt(containerTime);
       } else {
         elem->TimedElement().SampleAt(containerTime);
       }
     }
   }
 }
 
-/*static*/ void nsSMILAnimationController::SampleTimedElement(
+/*static*/ void SMILAnimationController::SampleTimedElement(
     SVGAnimationElement* aElement, TimeContainerHashtable* aActiveContainers) {
   nsSMILTimeContainer* 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
@@ -555,17 +556,17 @@ void nsSMILAnimationController::DoMilest
 
   nsSMILTime containerTime = timeContainer->GetCurrentTimeAsSMILTime();
 
   MOZ_ASSERT(!timeContainer->IsSeeking(),
              "Doing a regular sample but the time container is still seeking");
   aElement->TimedElement().SampleAt(containerTime);
 }
 
-/*static*/ void nsSMILAnimationController::AddAnimationToCompositorTable(
+/*static*/ void SMILAnimationController::AddAnimationToCompositorTable(
     SVGAnimationElement* aElement, nsSMILCompositorTable* aCompositorTable,
     bool& aStyleFlushNeeded) {
   // Add a compositor to the hash table if there's not already one there
   nsSMILTargetIdentifier key;
   if (!GetTargetIdentifierForAnimation(aElement, key))
     // Something's wrong/missing about animation's target; skip this animation
     return;
 
@@ -603,17 +604,17 @@ static inline bool IsTransformAttribute(
          (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
 // for this target.
-/*static*/ bool nsSMILAnimationController::GetTargetIdentifierForAnimation(
+/*static*/ bool SMILAnimationController::GetTargetIdentifierForAnimation(
     SVGAnimationElement* aAnimElem, nsSMILTargetIdentifier& 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
@@ -635,21 +636,21 @@ static inline bool IsTransformAttribute(
   // Construct the key
   aResult.mElement = targetElem;
   aResult.mAttributeName = attributeName;
   aResult.mAttributeNamespaceID = attributeNamespaceID;
 
   return true;
 }
 
-bool nsSMILAnimationController::PreTraverse() {
+bool SMILAnimationController::PreTraverse() {
   return PreTraverseInSubtree(nullptr);
 }
 
-bool nsSMILAnimationController::PreTraverseInSubtree(Element* aRoot) {
+bool SMILAnimationController::PreTraverseInSubtree(Element* aRoot) {
   MOZ_ASSERT(NS_IsMainThread());
 
   if (!mMightHavePendingStyleUpdates) {
     return false;
   }
 
   nsPresContext* context = mDocument->GetPresContext();
   if (!context) {
@@ -687,44 +688,47 @@ bool nsSMILAnimationController::PreTrave
   }
 
   return foundElementsNeedingRestyle;
 }
 
 //----------------------------------------------------------------------
 // Add/remove child time containers
 
-nsresult nsSMILAnimationController::AddChild(nsSMILTimeContainer& aChild) {
+nsresult SMILAnimationController::AddChild(nsSMILTimeContainer& 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 nsSMILAnimationController::RemoveChild(nsSMILTimeContainer& aChild) {
+void SMILAnimationController::RemoveChild(nsSMILTimeContainer& aChild) {
   mChildContainerTable.RemoveEntry(&aChild);
 
   if (!mPauseState && mChildContainerTable.Count() == 0) {
     StopSampling(GetRefreshDriver());
   }
 }
 
 // Helper method
-nsRefreshDriver* nsSMILAnimationController::GetRefreshDriver() {
+nsRefreshDriver* SMILAnimationController::GetRefreshDriver() {
   if (!mDocument) {
     NS_ERROR("Requesting refresh driver after document has disconnected!");
     return nullptr;
   }
 
   nsPresContext* context = mDocument->GetPresContext();
   return context ? context->RefreshDriver() : nullptr;
 }
 
-void nsSMILAnimationController::FlagDocumentNeedsFlush() {
+void SMILAnimationController::FlagDocumentNeedsFlush() {
   if (nsIPresShell* shell = mDocument->GetShell()) {
     shell->SetNeedStyleFlush();
   }
 }
+
+}  // namespace mozilla
+
rename from dom/smil/nsSMILAnimationController.h
rename to dom/smil/SMILAnimationController.h
--- a/dom/smil/nsSMILAnimationController.h
+++ b/dom/smil/SMILAnimationController.h
@@ -22,35 +22,34 @@
 struct nsSMILTargetIdentifier;
 class nsIDocument;
 
 namespace mozilla {
 namespace dom {
 class Element;
 class SVGAnimationElement;
 }  // namespace dom
-}  // namespace mozilla
 
 //----------------------------------------------------------------------
-// nsSMILAnimationController
+// SMILAnimationController
 //
 // The animation controller maintains the animation timer and determines the
 // sample times and sample rate for all SMIL animations in a document. There is
 // at most one animation controller per nsDocument 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 nsSMILAnimationController final : public nsSMILTimeContainer,
+class SMILAnimationController final : public nsSMILTimeContainer,
                                         public nsARefreshObserver {
  public:
-  explicit nsSMILAnimationController(nsIDocument* aDoc);
+  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;
   virtual void Resume(uint32_t aType) override;
   virtual nsSMILTime GetParentTime() const override;
@@ -107,17 +106,17 @@ class nsSMILAnimationController final : 
   bool MightHavePendingStyleUpdates() const {
     return mMightHavePendingStyleUpdates;
   }
 
   bool PreTraverse();
   bool PreTraverseInSubtree(mozilla::dom::Element* aRoot);
 
  protected:
-  ~nsSMILAnimationController();
+  ~SMILAnimationController();
 
   // Typedefs
   typedef nsPtrHashKey<nsSMILTimeContainer> TimeContainerPtrKey;
   typedef nsTHashtable<TimeContainerPtrKey> TimeContainerHashtable;
   typedef nsPtrHashKey<mozilla::dom::SVGAnimationElement>
       AnimationElementPtrKey;
   typedef nsTHashtable<AnimationElementPtrKey> AnimationElementHashtable;
 
@@ -202,9 +201,11 @@ class nsSMILAnimationController final : 
 
   // Contains compositors used in our last sample.  We keep this around
   // so we can detect when an element/attribute used to be animated,
   // but isn't anymore for some reason. (e.g. if its <animate> element is
   // removed or retargeted)
   nsAutoPtr<nsSMILCompositorTable> mLastCompositorTable;
 };
 
+}  // namespace mozilla
+
 #endif  // NS_SMILANIMATIONCONTROLLER_H_
--- a/dom/smil/moz.build
+++ b/dom/smil/moz.build
@@ -6,17 +6,16 @@
 
 with Files("**"):
     BUG_COMPONENT = ("Core", "SVG")
 
 MOCHITEST_MANIFESTS += ['test/mochitest.ini']
 
 EXPORTS += [
     'nsISMILAttr.h',
-    'nsSMILAnimationController.h',
     'nsSMILAnimationFunction.h',
     'nsSMILCompositorTable.h',
     'nsSMILCSSProperty.h',
     'nsSMILInstanceTime.h',
     'nsSMILInterval.h',
     'nsSMILKeySpline.h',
     'nsSMILMilestone.h',
     'nsSMILRepeatCount.h',
@@ -29,36 +28,40 @@ EXPORTS += [
     'nsSMILTimeValueSpecParams.h',
     'nsSMILTypes.h',
     'nsSMILValue.h',
     'SMILCSSValueType.h',
     'SMILNullType.h',
     'SMILType.h',
 ]
 
+EXPORTS.mozilla += [
+    'SMILAnimationController.h',
+]
+
 EXPORTS.mozilla.dom += [
     'TimeEvent.h',
 ]
 
 UNIFIED_SOURCES += [
-    'nsSMILAnimationController.cpp',
     'nsSMILAnimationFunction.cpp',
     'nsSMILCompositor.cpp',
     'nsSMILCSSProperty.cpp',
     'nsSMILInstanceTime.cpp',
     'nsSMILInterval.cpp',
     'nsSMILKeySpline.cpp',
     'nsSMILParserUtils.cpp',
     'nsSMILRepeatCount.cpp',
     'nsSMILSetAnimationFunction.cpp',
     'nsSMILTimeContainer.cpp',
     'nsSMILTimedElement.cpp',
     'nsSMILTimeValue.cpp',
     'nsSMILTimeValueSpec.cpp',
     'nsSMILValue.cpp',
+    'SMILAnimationController.cpp',
     'SMILBoolType.cpp',
     'SMILCSSValueType.cpp',
     'SMILEnumType.cpp',
     'SMILFloatType.cpp',
     'SMILIntegerType.cpp',
     'SMILNullType.cpp',
     'SMILStringType.cpp',
     'TimeEvent.cpp',
--- a/dom/smil/nsSMILCompositor.h
+++ b/dom/smil/nsSMILCompositor.h
@@ -108,15 +108,15 @@ class nsSMILCompositor : public PLDHashE
 
   // Member data for detecting when we need to force-recompose
   // ---------------------------------------------------------
   // Flag for tracking whether we need to compose. Initialized to false, but
   // gets flipped to true if we detect that something has changed.
   bool mForceCompositing;
 
   // Cached base value, so we can detect & force-recompose when it changes
-  // from one sample to the next. (nsSMILAnimationController moves this
+  // from one sample to the next. (SMILAnimationController moves this
   // forward from the previous sample's compositor by calling
   // StealCachedBaseValue.)
   nsSMILValue mCachedBaseValue;
 };
 
 #endif  // NS_SMILCOMPOSITOR_H_
--- a/dom/smil/nsSMILCompositorTable.h
+++ b/dom/smil/nsSMILCompositorTable.h
@@ -8,16 +8,16 @@
 #define NS_SMILCOMPOSITORTABLE_H_
 
 #include "nsTHashtable.h"
 
 //----------------------------------------------------------------------
 // nsSMILCompositorTable : A hashmap of nsSMILCompositors
 //
 // This is just a forward-declaration because it is included in
-// nsSMILAnimationController which is used in nsDocument. We don't want to
+// SMILAnimationController which is used in nsDocument. We don't want to
 // expose all of nsSMILCompositor or otherwise any changes to it will mean the
 // whole world will need to be rebuilt.
 
 class nsSMILCompositor;
 typedef nsTHashtable<nsSMILCompositor> nsSMILCompositorTable;
 
 #endif  // NS_SMILCOMPOSITORTABLE_H_
--- a/dom/smil/nsSMILTargetIdentifier.h
+++ b/dom/smil/nsSMILTargetIdentifier.h
@@ -9,21 +9,21 @@
 
 #include "mozilla/dom/Element.h"
 
 /**
  * Struct: nsSMILTargetIdentifier
  *
  * Tuple of: { Animated Element, Attribute Name }
  *
- * Used in nsSMILAnimationController as hash key for mapping an animation
+ * Used in SMILAnimationController as hash key for mapping an animation
  * target to the nsSMILCompositor for that target.
  *
  * NOTE: Need a nsRefPtr for the element & attribute name, because
- * nsSMILAnimationController retain its hash table for one sample into the
+ * 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()
       : mElement(nullptr),
         mAttributeName(nullptr),
         mAttributeNamespaceID(kNameSpaceID_Unknown) {}
--- a/dom/svg/SVGAnimationElement.cpp
+++ b/dom/svg/SVGAnimationElement.cpp
@@ -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/. */
 
 #include "mozilla/dom/SVGAnimationElement.h"
 #include "mozilla/dom/SVGSVGElement.h"
 #include "mozilla/dom/ElementInlines.h"
 #include "nsSMILTimeContainer.h"
-#include "nsSMILAnimationController.h"
+#include "SMILAnimationController.h"
 #include "nsSMILAnimationFunction.h"
 #include "nsContentUtils.h"
 #include "nsIContentInlines.h"
 #include "nsIURI.h"
 #include "prtime.h"
 
 namespace mozilla {
 namespace dom {
@@ -141,17 +141,17 @@ nsresult SVGAnimationElement::BindToTree
   MOZ_ASSERT(!mHrefTarget.get(),
              "Shouldn't have href-target yet (or it should've been cleared)");
   nsresult rv =
       SVGAnimationElementBase::BindToTree(aDocument, aParent, aBindingParent);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Add myself to the animation controller's master set of animation elements.
   if (nsIDocument* doc = GetComposedDoc()) {
-    nsSMILAnimationController* controller = doc->GetAnimationController();
+    SMILAnimationController* controller = doc->GetAnimationController();
     if (controller) {
       controller->RegisterAnimationElement(this);
     }
     const nsAttrValue* href =
         HasAttr(kNameSpaceID_None, nsGkAtoms::href)
             ? mAttrs.GetAttr(nsGkAtoms::href, kNameSpaceID_None)
             : mAttrs.GetAttr(nsGkAtoms::href, kNameSpaceID_XLink);
     if (href) {
@@ -165,17 +165,17 @@ nsresult SVGAnimationElement::BindToTree
   }
 
   AnimationNeedsResample();
 
   return NS_OK;
 }
 
 void SVGAnimationElement::UnbindFromTree(bool aDeep, bool aNullParent) {
-  nsSMILAnimationController* controller = OwnerDoc()->GetAnimationController();
+  SMILAnimationController* controller = OwnerDoc()->GetAnimationController();
   if (controller) {
     controller->UnregisterAnimationElement(this);
   }
 
   mHrefTarget.Unlink();
   mTimedElement.DissolveReferences();
 
   AnimationNeedsResample();
--- a/dom/svg/SVGElement.cpp
+++ b/dom/svg/SVGElement.cpp
@@ -16,30 +16,30 @@
 #include "mozilla/dom/SVGLengthBinding.h"
 #include "mozilla/dom/SVGSVGElement.h"
 #include "mozilla/dom/SVGTests.h"
 #include "mozilla/dom/SVGUnitTypesBinding.h"
 #include "mozilla/DeclarationBlock.h"
 #include "mozilla/EventListenerManager.h"
 #include "mozilla/InternalMutationEvent.h"
 #include "mozilla/RestyleManager.h"
+#include "mozilla/SMILAnimationController.h"
 #include "mozilla/Unused.h"
 #include "mozAutoDocUpdate.h"
 #include "nsAttrValueOrString.h"
 #include "nsCSSProps.h"
 #include "nsContentUtils.h"
 #include "nsICSSDeclaration.h"
 #include "nsIContentInlines.h"
 #include "nsIDocument.h"
 #include "nsError.h"
 #include "nsGkAtoms.h"
 #include "nsIPresShell.h"
 #include "nsIFrame.h"
 #include "nsLayoutUtils.h"
-#include "nsSMILAnimationController.h"
 #include "nsSVGAngle.h"
 #include "nsSVGBoolean.h"
 #include "nsSVGEnum.h"
 #include "nsSVGInteger.h"
 #include "nsSVGIntegerPair.h"
 #include "nsSVGLength2.h"
 #include "nsSVGNumber2.h"
 #include "nsSVGNumberPair.h"
--- a/dom/svg/SVGSVGElement.cpp
+++ b/dom/svg/SVGSVGElement.cpp
@@ -7,25 +7,25 @@
 #include "mozilla/dom/SVGSVGElement.h"
 
 #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 "DOMSVGLength.h"
 #include "DOMSVGNumber.h"
 #include "DOMSVGPoint.h"
 #include "nsFrameSelection.h"
 #include "nsLayoutStylesheetCache.h"
 #include "nsIFrame.h"
 #include "nsISVGSVGFrame.h"
-#include "nsSMILAnimationController.h"
 #include "nsSMILTimeContainer.h"
 #include "nsSVGAngle.h"
 #include "SVGAngle.h"
 #include "nsSVGDisplayableFrame.h"
 #include "nsSVGUtils.h"
 
 NS_IMPL_NS_NEW_SVG_ELEMENT_CHECK_PARSER(SVG)
 
@@ -375,17 +375,17 @@ nsSMILTimeContainer* SVGSVGElement::GetT
   }
   // invalid structure
   return nullptr;
 }
 //----------------------------------------------------------------------
 // SVGElement
 nsresult SVGSVGElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
                                    nsIContent* aBindingParent) {
-  nsSMILAnimationController* smilController = nullptr;
+  SMILAnimationController* smilController = nullptr;
 
   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) {
--- a/gfx/thebes/gfxSVGGlyphs.cpp
+++ b/gfx/thebes/gfxSVGGlyphs.cpp
@@ -20,20 +20,20 @@
 #include "nsStreamUtils.h"
 #include "nsIPrincipal.h"
 #include "mozilla/BasePrincipal.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/FontTableURIProtocolHandler.h"
 #include "mozilla/dom/SVGDocument.h"
 #include "mozilla/LoadInfo.h"
 #include "mozilla/NullPrincipal.h"
+#include "mozilla/SMILAnimationController.h"
 #include "nsSVGUtils.h"
 #include "nsContentUtils.h"
 #include "gfxFont.h"
-#include "nsSMILAnimationController.h"
 #include "gfxContext.h"
 #include "harfbuzz/hb.h"
 #include "mozilla/dom/ImageTracker.h"
 
 #define SVG_CONTENT_TYPE NS_LITERAL_CSTRING("image/svg+xml")
 #define UTF8_CHARSET NS_LITERAL_CSTRING("utf-8")
 
 using namespace mozilla;
--- a/image/SVGDocumentWrapper.cpp
+++ b/image/SVGDocumentWrapper.cpp
@@ -16,17 +16,17 @@
 #include "nsIObserverService.h"
 #include "nsIParser.h"
 #include "nsIPresShell.h"
 #include "nsIRequest.h"
 #include "nsIStreamListener.h"
 #include "nsIXMLContentSink.h"
 #include "nsNetCID.h"
 #include "nsComponentManagerUtils.h"
-#include "nsSMILAnimationController.h"
+#include "mozilla/SMILAnimationController.h"
 #include "nsServiceManagerUtils.h"
 #include "mozilla/dom/SVGSVGElement.h"
 #include "SVGObserverUtils.h"
 #include "mozilla/dom/SVGAnimatedLength.h"
 #include "nsMimeTypes.h"
 #include "DOMSVGLength.h"
 #include "nsDocument.h"
 #include "mozilla/dom/ImageTracker.h"
@@ -124,34 +124,34 @@ void SVGDocumentWrapper::StartAnimation(
   // 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) {
-    nsSMILAnimationController* controller = doc->GetAnimationController();
+    SMILAnimationController* controller = doc->GetAnimationController();
     if (controller) {
       controller->Resume(nsSMILTimeContainer::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) {
-    nsSMILAnimationController* controller = doc->GetAnimationController();
+    SMILAnimationController* controller = doc->GetAnimationController();
     if (controller) {
       controller->Pause(nsSMILTimeContainer::PAUSE_IMAGE);
     }
     doc->ImageTracker()->SetAnimatingState(false);
   }
 }
 
 void SVGDocumentWrapper::ResetAnimation() {
--- a/layout/base/PresShell.cpp
+++ b/layout/base/PresShell.cpp
@@ -102,17 +102,17 @@
 #include "nsPIDOMWindow.h"
 #include "nsFocusManager.h"
 #include "nsIObjectFrame.h"
 #include "nsIObjectLoadingContent.h"
 #include "nsNetUtil.h"
 #include "nsThreadUtils.h"
 #include "nsStyleSheetService.h"
 #include "gfxUtils.h"
-#include "nsSMILAnimationController.h"
+#include "mozilla/SMILAnimationController.h"
 #include "SVGContentUtils.h"
 #include "SVGObserverUtils.h"
 #include "SVGFragmentIdentifier.h"
 #include "nsFrameSelection.h"
 
 #include "mozilla/dom/Performance.h"
 #include "nsRefreshDriver.h"
 #include "nsDOMNavigationTiming.h"
@@ -1030,17 +1030,17 @@ void PresShell::Init(nsIDocument* aDocum
 
     mReflowCountMgr->SetDumpFrameCounts(dumpFrameCounts);
     mReflowCountMgr->SetDumpFrameByFrameCounts(dumpFrameByFrameCounts);
     mReflowCountMgr->SetPaintFrameCounts(paintFrameCounts);
   }
 #endif
 
   if (mDocument->HasAnimationController()) {
-    nsSMILAnimationController* animCtrl = mDocument->GetAnimationController();
+    SMILAnimationController* animCtrl = mDocument->GetAnimationController();
     animCtrl->NotifyRefreshDriverCreated(GetPresContext()->RefreshDriver());
   }
 
   for (DocumentTimeline* timeline : mDocument->Timelines()) {
     timeline->NotifyRefreshDriverCreated(GetPresContext()->RefreshDriver());
   }
 
   // Get our activeness from the docShell.
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -50,17 +50,17 @@
 #include "nsTransitionManager.h"
 #include "nsAnimationManager.h"
 #include "CounterStyleManager.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/dom/Element.h"
 #include "nsIMessageManager.h"
 #include "mozilla/dom/HTMLBodyElement.h"
 #include "mozilla/dom/MediaQueryList.h"
-#include "nsSMILAnimationController.h"
+#include "mozilla/SMILAnimationController.h"
 #include "mozilla/css/ImageLoader.h"
 #include "mozilla/dom/PBrowserParent.h"
 #include "mozilla/dom/TabChild.h"
 #include "mozilla/dom/TabParent.h"
 #include "nsRefreshDriver.h"
 #include "Layers.h"
 #include "LayerUserData.h"
 #include "ClientLayerManager.h"
@@ -1087,17 +1087,17 @@ void nsPresContext::SetImgAnimations(nsI
        childContent = childContent->GetNextSibling()) {
     SetImgAnimations(childContent, aMode);
   }
 }
 
 void nsPresContext::SetSMILAnimations(nsIDocument* aDoc, uint16_t aNewMode,
                                       uint16_t aOldMode) {
   if (aDoc->HasAnimationController()) {
-    nsSMILAnimationController* controller = aDoc->GetAnimationController();
+    SMILAnimationController* controller = aDoc->GetAnimationController();
     switch (aNewMode) {
       case imgIContainer::kNormalAnimMode:
       case imgIContainer::kLoopOnceAnimMode:
         if (aOldMode == imgIContainer::kDontAnimMode)
           controller->Resume(nsSMILTimeContainer::PAUSE_USERPREF);
         break;
 
       case imgIContainer::kDontAnimMode:
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -12,33 +12,33 @@
 #include "mozilla/DocumentStyleRootIterator.h"
 #include "mozilla/EffectCompositor.h"
 #include "mozilla/IntegerRange.h"
 #include "mozilla/LookAndFeel.h"
 #include "mozilla/ServoBindings.h"
 #include "mozilla/RestyleManager.h"
 #include "mozilla/ServoStyleRuleMap.h"
 #include "mozilla/ServoTypes.h"
+#include "mozilla/SMILAnimationController.h"
 #include "mozilla/StyleAnimationValue.h"
 #include "mozilla/css/Loader.h"
 #include "mozilla/dom/AnonymousContent.h"
 #include "mozilla/dom/ChildIterator.h"
 #include "mozilla/dom/FontFaceSet.h"
 #include "mozilla/dom/Element.h"
 #include "mozilla/dom/ElementInlines.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsCSSPseudoElements.h"
 #include "nsDeviceContext.h"
 #include "nsHTMLStyleSheet.h"
 #include "nsIAnonymousContentCreator.h"
 #include "nsIDocumentInlines.h"
 #include "nsMediaFeatures.h"
 #include "nsPrintfCString.h"
-#include "nsSMILAnimationController.h"
 #include "nsXBLPrototypeBinding.h"
 #include "gfxUserFontSet.h"
 #include "nsBindingManager.h"
 #include "nsWindowSizes.h"
 #include "GeckoProfiler.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
@@ -404,17 +404,17 @@ void ServoStyleSet::PreTraverseSync() {
   presContext->CacheAllLangs();
 }
 
 void ServoStyleSet::PreTraverse(ServoTraversalFlags aFlags, Element* aRoot) {
   PreTraverseSync();
 
   // Process animation stuff that we should avoid doing during the parallel
   // traversal.
-  nsSMILAnimationController* smilController =
+  SMILAnimationController* smilController =
       mDocument->HasAnimationController() ? mDocument->GetAnimationController()
                                           : nullptr;
 
   MOZ_ASSERT(GetPresContext());
   if (aRoot) {
     GetPresContext()->EffectCompositor()->PreTraverseInSubtree(aFlags, aRoot);
     if (smilController) {
       smilController->PreTraverseInSubtree(aRoot);