Bug 1073336 part 10 - Add AnimationPlayer::GetAnimationManager(); r=dbaron

This patch introduces an abstract method to AnimationPlayer to fetch the manager
object associated with the player. This method is implemented separate by
CSSAnimationPlayer and CSSTransitionPlayer to return the nsAnimationManager or
nsTransitionManager accordingly.
This commit is contained in:
Brian Birtles 2014-11-17 13:45:58 +09:00
parent aa668ac8e6
commit 3b5c4f0d9d
5 changed files with 27 additions and 0 deletions

View File

@ -28,6 +28,7 @@ class nsPresContext;
namespace mozilla {
namespace css {
class AnimValuesStyleRule;
class CommonAnimationManager;
} // namespace css
class CSSAnimationPlayer;
@ -130,6 +131,7 @@ protected:
nsIDocument* GetRenderedDocument() const;
nsPresContext* GetPresContext() const;
virtual css::CommonAnimationManager* GetAnimationManager() const = 0;
nsRefPtr<AnimationTimeline> mTimeline;
nsRefPtr<Animation> mSource;

View File

@ -152,6 +152,17 @@ CSSAnimationPlayer::QueueEvents(EventArray& aEventsToDispatch)
}
}
CommonAnimationManager*
CSSAnimationPlayer::GetAnimationManager() const
{
nsPresContext* context = GetPresContext();
if (!context) {
return nullptr;
}
return context->AnimationManager();
}
/* static */ nsString
CSSAnimationPlayer::PseudoTypeAsString(nsCSSPseudoElements::Type aPseudoType)
{

View File

@ -78,6 +78,7 @@ public:
protected:
virtual ~CSSAnimationPlayer() { }
virtual css::CommonAnimationManager* GetAnimationManager() const MOZ_OVERRIDE;
static nsString PseudoTypeAsString(nsCSSPseudoElements::Type aPseudoType);

View File

@ -88,6 +88,17 @@ CSSTransitionPlayer::PlayFromJS()
AnimationPlayer::PlayFromJS();
}
CommonAnimationManager*
CSSTransitionPlayer::GetAnimationManager() const
{
nsPresContext* context = GetPresContext();
if (!context) {
return nullptr;
}
return context->TransitionManager();
}
/*****************************************************************************
* nsTransitionManager *
*****************************************************************************/

View File

@ -81,6 +81,8 @@ public:
protected:
virtual ~CSSTransitionPlayer() { }
virtual css::CommonAnimationManager* GetAnimationManager() const MOZ_OVERRIDE;
};
} // namespace mozilla