Bug 1154615 part 1 - Rename AnimationPlayer to Animation in WebIDL; r=smaug

This patch is a fairly minimal rename of the AnimationPlayer interface. It
leaves a bunch of local variables and helper classes still using the word
"player". These will be addressed in subsequent patches that don't require DOM
peer review.
This commit is contained in:
Brian Birtles 2015-04-21 10:22:09 +09:00
parent 99e9a55aac
commit 6033b2c86d
33 changed files with 175 additions and 176 deletions

View File

@ -3,9 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "AnimationPlayer.h" #include "Animation.h"
#include "AnimationUtils.h" #include "AnimationUtils.h"
#include "mozilla/dom/AnimationPlayerBinding.h" #include "mozilla/dom/AnimationBinding.h"
#include "mozilla/AutoRestore.h" #include "mozilla/AutoRestore.h"
#include "AnimationCommon.h" // For AnimationPlayerCollection, #include "AnimationCommon.h" // For AnimationPlayerCollection,
// CommonAnimationManager // CommonAnimationManager
@ -17,23 +17,23 @@
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(AnimationPlayer, mTimeline, NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(Animation, mTimeline,
mEffect, mReady, mFinished) mEffect, mReady, mFinished)
NS_IMPL_CYCLE_COLLECTING_ADDREF(AnimationPlayer) NS_IMPL_CYCLE_COLLECTING_ADDREF(Animation)
NS_IMPL_CYCLE_COLLECTING_RELEASE(AnimationPlayer) NS_IMPL_CYCLE_COLLECTING_RELEASE(Animation)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AnimationPlayer) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Animation)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END NS_INTERFACE_MAP_END
JSObject* JSObject*
AnimationPlayer::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) Animation::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{ {
return dom::AnimationPlayerBinding::Wrap(aCx, this, aGivenProto); return dom::AnimationBinding::Wrap(aCx, this, aGivenProto);
} }
void void
AnimationPlayer::SetStartTime(const Nullable<TimeDuration>& aNewStartTime) Animation::SetStartTime(const Nullable<TimeDuration>& aNewStartTime)
{ {
#if 1 #if 1
// Bug 1096776: once we support inactive/missing timelines we'll want to take // Bug 1096776: once we support inactive/missing timelines we'll want to take
@ -74,7 +74,7 @@ AnimationPlayer::SetStartTime(const Nullable<TimeDuration>& aNewStartTime)
} }
Nullable<TimeDuration> Nullable<TimeDuration>
AnimationPlayer::GetCurrentTime() const Animation::GetCurrentTime() const
{ {
Nullable<TimeDuration> result; Nullable<TimeDuration> result;
if (!mHoldTime.IsNull()) { if (!mHoldTime.IsNull()) {
@ -94,7 +94,7 @@ AnimationPlayer::GetCurrentTime() const
// Implements http://w3c.github.io/web-animations/#silently-set-the-current-time // Implements http://w3c.github.io/web-animations/#silently-set-the-current-time
void void
AnimationPlayer::SilentlySetCurrentTime(const TimeDuration& aSeekTime) Animation::SilentlySetCurrentTime(const TimeDuration& aSeekTime)
{ {
if (!mHoldTime.IsNull() || if (!mHoldTime.IsNull() ||
!mTimeline || !mTimeline ||
@ -115,7 +115,7 @@ AnimationPlayer::SilentlySetCurrentTime(const TimeDuration& aSeekTime)
// Implements http://w3c.github.io/web-animations/#set-the-current-time // Implements http://w3c.github.io/web-animations/#set-the-current-time
void void
AnimationPlayer::SetCurrentTime(const TimeDuration& aSeekTime) Animation::SetCurrentTime(const TimeDuration& aSeekTime)
{ {
SilentlySetCurrentTime(aSeekTime); SilentlySetCurrentTime(aSeekTime);
@ -132,7 +132,7 @@ AnimationPlayer::SetCurrentTime(const TimeDuration& aSeekTime)
} }
void void
AnimationPlayer::SetPlaybackRate(double aPlaybackRate) Animation::SetPlaybackRate(double aPlaybackRate)
{ {
Nullable<TimeDuration> previousTime = GetCurrentTime(); Nullable<TimeDuration> previousTime = GetCurrentTime();
mPlaybackRate = aPlaybackRate; mPlaybackRate = aPlaybackRate;
@ -144,7 +144,7 @@ AnimationPlayer::SetPlaybackRate(double aPlaybackRate)
} }
void void
AnimationPlayer::SilentlySetPlaybackRate(double aPlaybackRate) Animation::SilentlySetPlaybackRate(double aPlaybackRate)
{ {
Nullable<TimeDuration> previousTime = GetCurrentTime(); Nullable<TimeDuration> previousTime = GetCurrentTime();
mPlaybackRate = aPlaybackRate; mPlaybackRate = aPlaybackRate;
@ -156,7 +156,7 @@ AnimationPlayer::SilentlySetPlaybackRate(double aPlaybackRate)
} }
AnimationPlayState AnimationPlayState
AnimationPlayer::PlayState() const Animation::PlayState() const
{ {
if (mPendingState != PendingState::NotPending) { if (mPendingState != PendingState::NotPending) {
return AnimationPlayState::Pending; return AnimationPlayState::Pending;
@ -190,7 +190,7 @@ CreatePromise(DocumentTimeline* aTimeline, ErrorResult& aRv)
} }
Promise* Promise*
AnimationPlayer::GetReady(ErrorResult& aRv) Animation::GetReady(ErrorResult& aRv)
{ {
if (!mReady) { if (!mReady) {
mReady = CreatePromise(mTimeline, aRv); // Lazily create on demand mReady = CreatePromise(mTimeline, aRv); // Lazily create on demand
@ -204,7 +204,7 @@ AnimationPlayer::GetReady(ErrorResult& aRv)
} }
Promise* Promise*
AnimationPlayer::GetFinished(ErrorResult& aRv) Animation::GetFinished(ErrorResult& aRv)
{ {
if (!mFinished) { if (!mFinished) {
mFinished = CreatePromise(mTimeline, aRv); // Lazily create on demand mFinished = CreatePromise(mTimeline, aRv); // Lazily create on demand
@ -218,14 +218,14 @@ AnimationPlayer::GetFinished(ErrorResult& aRv)
} }
void void
AnimationPlayer::Play(LimitBehavior aLimitBehavior) Animation::Play(LimitBehavior aLimitBehavior)
{ {
DoPlay(aLimitBehavior); DoPlay(aLimitBehavior);
PostUpdate(); PostUpdate();
} }
void void
AnimationPlayer::Pause() Animation::Pause()
{ {
// TODO: The DoPause() call should not be synchronous (bug 1109390). See // TODO: The DoPause() call should not be synchronous (bug 1109390). See
// http://w3c.github.io/web-animations/#pausing-an-animation-section // http://w3c.github.io/web-animations/#pausing-an-animation-section
@ -234,25 +234,25 @@ AnimationPlayer::Pause()
} }
Nullable<double> Nullable<double>
AnimationPlayer::GetStartTimeAsDouble() const Animation::GetStartTimeAsDouble() const
{ {
return AnimationUtils::TimeDurationToDouble(mStartTime); return AnimationUtils::TimeDurationToDouble(mStartTime);
} }
void void
AnimationPlayer::SetStartTimeAsDouble(const Nullable<double>& aStartTime) Animation::SetStartTimeAsDouble(const Nullable<double>& aStartTime)
{ {
return SetStartTime(AnimationUtils::DoubleToTimeDuration(aStartTime)); return SetStartTime(AnimationUtils::DoubleToTimeDuration(aStartTime));
} }
Nullable<double> Nullable<double>
AnimationPlayer::GetCurrentTimeAsDouble() const Animation::GetCurrentTimeAsDouble() const
{ {
return AnimationUtils::TimeDurationToDouble(GetCurrentTime()); return AnimationUtils::TimeDurationToDouble(GetCurrentTime());
} }
void void
AnimationPlayer::SetCurrentTimeAsDouble(const Nullable<double>& aCurrentTime, Animation::SetCurrentTimeAsDouble(const Nullable<double>& aCurrentTime,
ErrorResult& aRv) ErrorResult& aRv)
{ {
if (aCurrentTime.IsNull()) { if (aCurrentTime.IsNull()) {
@ -266,7 +266,7 @@ AnimationPlayer::SetCurrentTimeAsDouble(const Nullable<double>& aCurrentTime,
} }
void void
AnimationPlayer::SetEffect(KeyframeEffectReadonly* aEffect) Animation::SetEffect(KeyframeEffectReadonly* aEffect)
{ {
if (mEffect) { if (mEffect) {
mEffect->SetParentTime(Nullable<TimeDuration>()); mEffect->SetParentTime(Nullable<TimeDuration>());
@ -279,7 +279,7 @@ AnimationPlayer::SetEffect(KeyframeEffectReadonly* aEffect)
} }
void void
AnimationPlayer::Tick() Animation::Tick()
{ {
// Since we are not guaranteed to get only one call per refresh driver tick, // Since we are not guaranteed to get only one call per refresh driver tick,
// it's possible that mPendingReadyTime is set to a time in the future. // it's possible that mPendingReadyTime is set to a time in the future.
@ -302,7 +302,7 @@ AnimationPlayer::Tick()
} }
void void
AnimationPlayer::TriggerOnNextTick(const Nullable<TimeDuration>& aReadyTime) Animation::TriggerOnNextTick(const Nullable<TimeDuration>& aReadyTime)
{ {
// Normally we expect the play state to be pending but it's possible that, // Normally we expect the play state to be pending but it's possible that,
// due to the handling of possibly orphaned players in Tick(), this player got // due to the handling of possibly orphaned players in Tick(), this player got
@ -317,7 +317,7 @@ AnimationPlayer::TriggerOnNextTick(const Nullable<TimeDuration>& aReadyTime)
} }
void void
AnimationPlayer::TriggerNow() Animation::TriggerNow()
{ {
MOZ_ASSERT(PlayState() == AnimationPlayState::Pending, MOZ_ASSERT(PlayState() == AnimationPlayState::Pending,
"Expected to start a pending player"); "Expected to start a pending player");
@ -328,7 +328,7 @@ AnimationPlayer::TriggerNow()
} }
Nullable<TimeDuration> Nullable<TimeDuration>
AnimationPlayer::GetCurrentOrPendingStartTime() const Animation::GetCurrentOrPendingStartTime() const
{ {
Nullable<TimeDuration> result; Nullable<TimeDuration> result;
@ -349,7 +349,7 @@ AnimationPlayer::GetCurrentOrPendingStartTime() const
} }
void void
AnimationPlayer::Cancel() Animation::Cancel()
{ {
if (mPendingState != PendingState::NotPending) { if (mPendingState != PendingState::NotPending) {
CancelPendingTasks(); CancelPendingTasks();
@ -371,7 +371,7 @@ AnimationPlayer::Cancel()
} }
void void
AnimationPlayer::UpdateRelevance() Animation::UpdateRelevance()
{ {
bool wasRelevant = mIsRelevant; bool wasRelevant = mIsRelevant;
mIsRelevant = HasCurrentEffect() || IsInEffect(); mIsRelevant = HasCurrentEffect() || IsInEffect();
@ -385,7 +385,7 @@ AnimationPlayer::UpdateRelevance()
} }
bool bool
AnimationPlayer::CanThrottle() const Animation::CanThrottle() const
{ {
if (!mEffect || if (!mEffect ||
mEffect->IsFinishedTransition() || mEffect->IsFinishedTransition() ||
@ -410,9 +410,9 @@ AnimationPlayer::CanThrottle() const
} }
void void
AnimationPlayer::ComposeStyle(nsRefPtr<css::AnimValuesStyleRule>& aStyleRule, Animation::ComposeStyle(nsRefPtr<css::AnimValuesStyleRule>& aStyleRule,
nsCSSPropertySet& aSetProperties, nsCSSPropertySet& aSetProperties,
bool& aNeedsRefreshes) bool& aNeedsRefreshes)
{ {
if (!mEffect || mEffect->IsFinishedTransition()) { if (!mEffect || mEffect->IsFinishedTransition()) {
return; return;
@ -493,7 +493,7 @@ AnimationPlayer::ComposeStyle(nsRefPtr<css::AnimValuesStyleRule>& aStyleRule,
} }
void void
AnimationPlayer::DoPlay(LimitBehavior aLimitBehavior) Animation::DoPlay(LimitBehavior aLimitBehavior)
{ {
bool abortedPause = mPendingState == PendingState::PausePending; bool abortedPause = mPendingState == PendingState::PausePending;
@ -556,7 +556,7 @@ AnimationPlayer::DoPlay(LimitBehavior aLimitBehavior)
} }
void void
AnimationPlayer::DoPause() Animation::DoPause()
{ {
if (IsPausedOrPausing()) { if (IsPausedOrPausing()) {
return; return;
@ -593,7 +593,7 @@ AnimationPlayer::DoPause()
} }
void void
AnimationPlayer::ResumeAt(const TimeDuration& aReadyTime) Animation::ResumeAt(const TimeDuration& aReadyTime)
{ {
// This method is only expected to be called for a player that is // This method is only expected to be called for a player that is
// waiting to play. We can easily adapt it to handle other states // waiting to play. We can easily adapt it to handle other states
@ -625,7 +625,7 @@ AnimationPlayer::ResumeAt(const TimeDuration& aReadyTime)
} }
void void
AnimationPlayer::PauseAt(const TimeDuration& aReadyTime) Animation::PauseAt(const TimeDuration& aReadyTime)
{ {
MOZ_ASSERT(mPendingState == PendingState::PausePending, MOZ_ASSERT(mPendingState == PendingState::PausePending,
"Expected to pause a pause-pending player"); "Expected to pause a pause-pending player");
@ -645,7 +645,7 @@ AnimationPlayer::PauseAt(const TimeDuration& aReadyTime)
} }
void void
AnimationPlayer::UpdateTiming() Animation::UpdateTiming()
{ {
// We call UpdateFinishedState before UpdateEffect because the former // We call UpdateFinishedState before UpdateEffect because the former
// can change the current time, which is used by the latter. // can change the current time, which is used by the latter.
@ -654,7 +654,7 @@ AnimationPlayer::UpdateTiming()
} }
void void
AnimationPlayer::UpdateFinishedState(bool aSeekFlag) Animation::UpdateFinishedState(bool aSeekFlag)
{ {
Nullable<TimeDuration> currentTime = GetCurrentTime(); Nullable<TimeDuration> currentTime = GetCurrentTime();
TimeDuration effectEnd = TimeDuration(EffectEnd()); TimeDuration effectEnd = TimeDuration(EffectEnd());
@ -708,7 +708,7 @@ AnimationPlayer::UpdateFinishedState(bool aSeekFlag)
} }
void void
AnimationPlayer::UpdateEffect() Animation::UpdateEffect()
{ {
if (mEffect) { if (mEffect) {
mEffect->SetParentTime(GetCurrentTime()); mEffect->SetParentTime(GetCurrentTime());
@ -717,7 +717,7 @@ AnimationPlayer::UpdateEffect()
} }
void void
AnimationPlayer::FlushStyle() const Animation::FlushStyle() const
{ {
nsIDocument* doc = GetRenderedDocument(); nsIDocument* doc = GetRenderedDocument();
if (doc) { if (doc) {
@ -726,7 +726,7 @@ AnimationPlayer::FlushStyle() const
} }
void void
AnimationPlayer::PostUpdate() Animation::PostUpdate()
{ {
AnimationPlayerCollection* collection = GetCollection(); AnimationPlayerCollection* collection = GetCollection();
if (collection) { if (collection) {
@ -735,7 +735,7 @@ AnimationPlayer::PostUpdate()
} }
void void
AnimationPlayer::CancelPendingTasks() Animation::CancelPendingTasks()
{ {
if (mPendingState == PendingState::NotPending) { if (mPendingState == PendingState::NotPending) {
return; return;
@ -758,7 +758,7 @@ AnimationPlayer::CancelPendingTasks()
} }
bool bool
AnimationPlayer::IsFinished() const Animation::IsFinished() const
{ {
// Unfortunately there's some weirdness in the spec at the moment where if // Unfortunately there's some weirdness in the spec at the moment where if
// you're finished and paused, the playState is paused. This prevents us // you're finished and paused, the playState is paused. This prevents us
@ -771,7 +771,7 @@ AnimationPlayer::IsFinished() const
} }
bool bool
AnimationPlayer::IsPossiblyOrphanedPendingPlayer() const Animation::IsPossiblyOrphanedPendingPlayer() const
{ {
// Check if we are pending but might never start because we are not being // Check if we are pending but might never start because we are not being
// tracked. // tracked.
@ -825,7 +825,7 @@ AnimationPlayer::IsPossiblyOrphanedPendingPlayer() const
} }
StickyTimeDuration StickyTimeDuration
AnimationPlayer::EffectEnd() const Animation::EffectEnd() const
{ {
if (!mEffect) { if (!mEffect) {
return StickyTimeDuration(0); return StickyTimeDuration(0);
@ -836,7 +836,7 @@ AnimationPlayer::EffectEnd() const
} }
nsIDocument* nsIDocument*
AnimationPlayer::GetRenderedDocument() const Animation::GetRenderedDocument() const
{ {
if (!mEffect) { if (!mEffect) {
return nullptr; return nullptr;
@ -853,7 +853,7 @@ AnimationPlayer::GetRenderedDocument() const
} }
nsPresContext* nsPresContext*
AnimationPlayer::GetPresContext() const Animation::GetPresContext() const
{ {
nsIDocument* doc = GetRenderedDocument(); nsIDocument* doc = GetRenderedDocument();
if (!doc) { if (!doc) {
@ -867,7 +867,7 @@ AnimationPlayer::GetPresContext() const
} }
AnimationPlayerCollection* AnimationPlayerCollection*
AnimationPlayer::GetCollection() const Animation::GetCollection() const
{ {
css::CommonAnimationManager* manager = GetAnimationManager(); css::CommonAnimationManager* manager = GetAnimationManager();
if (!manager) { if (!manager) {

View File

@ -3,14 +3,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_AnimationPlayer_h #ifndef mozilla_dom_Animation_h
#define mozilla_dom_AnimationPlayer_h #define mozilla_dom_Animation_h
#include "nsWrapperCache.h" #include "nsWrapperCache.h"
#include "nsCycleCollectionParticipant.h" #include "nsCycleCollectionParticipant.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/TimeStamp.h" // for TimeStamp, TimeDuration #include "mozilla/TimeStamp.h" // for TimeStamp, TimeDuration
#include "mozilla/dom/AnimationPlayerBinding.h" // for AnimationPlayState #include "mozilla/dom/AnimationBinding.h" // for AnimationPlayState
#include "mozilla/dom/DocumentTimeline.h" // for DocumentTimeline #include "mozilla/dom/DocumentTimeline.h" // for DocumentTimeline
#include "mozilla/dom/KeyframeEffect.h" // for KeyframeEffectReadonly #include "mozilla/dom/KeyframeEffect.h" // for KeyframeEffectReadonly
#include "mozilla/dom/Promise.h" // for Promise #include "mozilla/dom/Promise.h" // for Promise
@ -44,14 +44,15 @@ class CSSTransitionPlayer;
namespace dom { namespace dom {
class AnimationPlayer : public nsISupports, class Animation
public nsWrapperCache : public nsISupports
, public nsWrapperCache
{ {
protected: protected:
virtual ~AnimationPlayer() {} virtual ~Animation() {}
public: public:
explicit AnimationPlayer(DocumentTimeline* aTimeline) explicit Animation(DocumentTimeline* aTimeline)
: mTimeline(aTimeline) : mTimeline(aTimeline)
, mPlaybackRate(1.0) , mPlaybackRate(1.0)
, mPendingState(PendingState::NotPending) , mPendingState(PendingState::NotPending)
@ -63,7 +64,7 @@ public:
} }
NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(AnimationPlayer) NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(Animation)
DocumentTimeline* GetParentObject() const { return mTimeline; } DocumentTimeline* GetParentObject() const { return mTimeline; }
virtual JSObject* WrapObject(JSContext* aCx, virtual JSObject* WrapObject(JSContext* aCx,
@ -79,7 +80,7 @@ public:
Continue = 1 Continue = 1
}; };
// AnimationPlayer methods // Animation methods
KeyframeEffectReadonly* GetEffect() const { return mEffect; } KeyframeEffectReadonly* GetEffect() const { return mEffect; }
DocumentTimeline* Timeline() const { return mTimeline; } DocumentTimeline* Timeline() const { return mTimeline; }
Nullable<TimeDuration> GetStartTime() const { return mStartTime; } Nullable<TimeDuration> GetStartTime() const { return mStartTime; }
@ -97,7 +98,7 @@ public:
virtual void Pause(); virtual void Pause();
bool IsRunningOnCompositor() const { return mIsRunningOnCompositor; } bool IsRunningOnCompositor() const { return mIsRunningOnCompositor; }
// Wrapper functions for AnimationPlayer DOM methods when called // Wrapper functions for Animation DOM methods when called
// from script. We often use the same methods internally and from // from script. We often use the same methods internally and from
// script but when called from script we (or one of our subclasses) perform // script but when called from script we (or one of our subclasses) perform
// extra steps such as flushing style or converting the return type. // extra steps such as flushing style or converting the return type.
@ -346,4 +347,4 @@ protected:
} // namespace dom } // namespace dom
} // namespace mozilla } // namespace mozilla
#endif // mozilla_dom_AnimationPlayer_h #endif // mozilla_dom_Animation_h

View File

@ -234,7 +234,7 @@ KeyframeEffectReadonly::ActiveDuration(const AnimationTiming& aTiming)
// http://w3c.github.io/web-animations/#in-play // http://w3c.github.io/web-animations/#in-play
bool bool
KeyframeEffectReadonly::IsInPlay(const AnimationPlayer& aPlayer) const KeyframeEffectReadonly::IsInPlay(const Animation& aPlayer) const
{ {
if (IsFinishedTransition() || if (IsFinishedTransition() ||
aPlayer.PlayState() == AnimationPlayState::Finished) { aPlayer.PlayState() == AnimationPlayState::Finished) {
@ -246,7 +246,7 @@ KeyframeEffectReadonly::IsInPlay(const AnimationPlayer& aPlayer) const
// http://w3c.github.io/web-animations/#current // http://w3c.github.io/web-animations/#current
bool bool
KeyframeEffectReadonly::IsCurrent(const AnimationPlayer& aPlayer) const KeyframeEffectReadonly::IsCurrent(const Animation& aPlayer) const
{ {
if (IsFinishedTransition() || if (IsFinishedTransition() ||
aPlayer.PlayState() == AnimationPlayState::Finished) { aPlayer.PlayState() == AnimationPlayState::Finished) {

View File

@ -306,8 +306,8 @@ public:
mIsFinishedTransition = aIsFinished; mIsFinishedTransition = aIsFinished;
} }
bool IsInPlay(const AnimationPlayer& aPlayer) const; bool IsInPlay(const Animation& aPlayer) const;
bool IsCurrent(const AnimationPlayer& aPlayer) const; bool IsCurrent(const Animation& aPlayer) const;
bool IsInEffect() const; bool IsInEffect() const;
const AnimationProperty* const AnimationProperty*

View File

@ -22,7 +22,7 @@ NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(PendingPlayerTracker, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(PendingPlayerTracker, Release) NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(PendingPlayerTracker, Release)
void void
PendingPlayerTracker::AddPending(dom::AnimationPlayer& aPlayer, PendingPlayerTracker::AddPending(dom::Animation& aPlayer,
AnimationPlayerSet& aSet) AnimationPlayerSet& aSet)
{ {
aSet.PutEntry(&aPlayer); aSet.PutEntry(&aPlayer);
@ -34,24 +34,24 @@ PendingPlayerTracker::AddPending(dom::AnimationPlayer& aPlayer,
} }
void void
PendingPlayerTracker::RemovePending(dom::AnimationPlayer& aPlayer, PendingPlayerTracker::RemovePending(dom::Animation& aPlayer,
AnimationPlayerSet& aSet) AnimationPlayerSet& aSet)
{ {
aSet.RemoveEntry(&aPlayer); aSet.RemoveEntry(&aPlayer);
} }
bool bool
PendingPlayerTracker::IsWaiting(const dom::AnimationPlayer& aPlayer, PendingPlayerTracker::IsWaiting(const dom::Animation& aPlayer,
const AnimationPlayerSet& aSet) const const AnimationPlayerSet& aSet) const
{ {
return aSet.Contains(const_cast<dom::AnimationPlayer*>(&aPlayer)); return aSet.Contains(const_cast<dom::Animation*>(&aPlayer));
} }
PLDHashOperator PLDHashOperator
TriggerPlayerAtTime(nsRefPtrHashKey<dom::AnimationPlayer>* aKey, TriggerPlayerAtTime(nsRefPtrHashKey<dom::Animation>* aKey,
void* aReadyTime) void* aReadyTime)
{ {
dom::AnimationPlayer* player = aKey->GetKey(); dom::Animation* player = aKey->GetKey();
dom::DocumentTimeline* timeline = player->Timeline(); dom::DocumentTimeline* timeline = player->Timeline();
// When the timeline's refresh driver is under test control, its values // When the timeline's refresh driver is under test control, its values
@ -81,7 +81,7 @@ PendingPlayerTracker::TriggerPendingPlayersOnNextTick(const TimeStamp&
} }
PLDHashOperator PLDHashOperator
TriggerPlayerNow(nsRefPtrHashKey<dom::AnimationPlayer>* aKey, void*) TriggerPlayerNow(nsRefPtrHashKey<dom::Animation>* aKey, void*)
{ {
aKey->GetKey()->TriggerNow(); aKey->GetKey()->TriggerNow();
return PL_DHASH_NEXT; return PL_DHASH_NEXT;

View File

@ -6,7 +6,7 @@
#ifndef mozilla_dom_PendingPlayerTracker_h #ifndef mozilla_dom_PendingPlayerTracker_h
#define mozilla_dom_PendingPlayerTracker_h #define mozilla_dom_PendingPlayerTracker_h
#include "mozilla/dom/AnimationPlayer.h" #include "mozilla/dom/Animation.h"
#include "nsCycleCollectionParticipant.h" #include "nsCycleCollectionParticipant.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsTHashtable.h" #include "nsTHashtable.h"
@ -25,32 +25,32 @@ public:
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(PendingPlayerTracker) NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(PendingPlayerTracker)
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(PendingPlayerTracker) NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(PendingPlayerTracker)
void AddPlayPending(dom::AnimationPlayer& aPlayer) void AddPlayPending(dom::Animation& aPlayer)
{ {
MOZ_ASSERT(!IsWaitingToPause(aPlayer), MOZ_ASSERT(!IsWaitingToPause(aPlayer),
"Player is already waiting to pause"); "Player is already waiting to pause");
AddPending(aPlayer, mPlayPendingSet); AddPending(aPlayer, mPlayPendingSet);
} }
void RemovePlayPending(dom::AnimationPlayer& aPlayer) void RemovePlayPending(dom::Animation& aPlayer)
{ {
RemovePending(aPlayer, mPlayPendingSet); RemovePending(aPlayer, mPlayPendingSet);
} }
bool IsWaitingToPlay(const dom::AnimationPlayer& aPlayer) const bool IsWaitingToPlay(const dom::Animation& aPlayer) const
{ {
return IsWaiting(aPlayer, mPlayPendingSet); return IsWaiting(aPlayer, mPlayPendingSet);
} }
void AddPausePending(dom::AnimationPlayer& aPlayer) void AddPausePending(dom::Animation& aPlayer)
{ {
MOZ_ASSERT(!IsWaitingToPlay(aPlayer), MOZ_ASSERT(!IsWaitingToPlay(aPlayer),
"Player is already waiting to play"); "Player is already waiting to play");
AddPending(aPlayer, mPausePendingSet); AddPending(aPlayer, mPausePendingSet);
} }
void RemovePausePending(dom::AnimationPlayer& aPlayer) void RemovePausePending(dom::Animation& aPlayer)
{ {
RemovePending(aPlayer, mPausePendingSet); RemovePending(aPlayer, mPausePendingSet);
} }
bool IsWaitingToPause(const dom::AnimationPlayer& aPlayer) const bool IsWaitingToPause(const dom::Animation& aPlayer) const
{ {
return IsWaiting(aPlayer, mPausePendingSet); return IsWaiting(aPlayer, mPausePendingSet);
} }
@ -66,14 +66,14 @@ private:
void EnsurePaintIsScheduled(); void EnsurePaintIsScheduled();
typedef nsTHashtable<nsRefPtrHashKey<dom::AnimationPlayer>> typedef nsTHashtable<nsRefPtrHashKey<dom::Animation>>
AnimationPlayerSet; AnimationPlayerSet;
void AddPending(dom::AnimationPlayer& aPlayer, void AddPending(dom::Animation& aPlayer,
AnimationPlayerSet& aSet); AnimationPlayerSet& aSet);
void RemovePending(dom::AnimationPlayer& aPlayer, void RemovePending(dom::Animation& aPlayer,
AnimationPlayerSet& aSet); AnimationPlayerSet& aSet);
bool IsWaiting(const dom::AnimationPlayer& aPlayer, bool IsWaiting(const dom::Animation& aPlayer,
const AnimationPlayerSet& aSet) const; const AnimationPlayerSet& aSet) const;
AnimationPlayerSet mPlayPendingSet; AnimationPlayerSet mPlayPendingSet;

View File

@ -8,8 +8,8 @@ MOCHITEST_MANIFESTS += ['test/mochitest.ini']
MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini'] MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']
EXPORTS.mozilla.dom += [ EXPORTS.mozilla.dom += [
'Animation.h',
'AnimationEffectReadonly.h', 'AnimationEffectReadonly.h',
'AnimationPlayer.h',
'AnimationTimeline.h', 'AnimationTimeline.h',
'DocumentTimeline.h', 'DocumentTimeline.h',
'KeyframeEffect.h', 'KeyframeEffect.h',
@ -21,8 +21,8 @@ EXPORTS.mozilla += [
] ]
UNIFIED_SOURCES += [ UNIFIED_SOURCES += [
'Animation.cpp',
'AnimationEffectReadonly.cpp', 'AnimationEffectReadonly.cpp',
'AnimationPlayer.cpp',
'AnimationTimeline.cpp', 'AnimationTimeline.cpp',
'DocumentTimeline.cpp', 'DocumentTimeline.cpp',
'KeyframeEffect.cpp', 'KeyframeEffect.cpp',

View File

@ -14,7 +14,7 @@
#include "AnimationCommon.h" #include "AnimationCommon.h"
#include "mozilla/DebugOnly.h" #include "mozilla/DebugOnly.h"
#include "mozilla/dom/AnimationPlayer.h" #include "mozilla/dom/Animation.h"
#include "mozilla/dom/Attr.h" #include "mozilla/dom/Attr.h"
#include "nsDOMAttributeMap.h" #include "nsDOMAttributeMap.h"
#include "nsIAtom.h" #include "nsIAtom.h"
@ -3186,7 +3186,7 @@ Element::MozRequestPointerLock()
} }
void void
Element::GetAnimations(nsTArray<nsRefPtr<AnimationPlayer> >& aAnimations) Element::GetAnimations(nsTArray<nsRefPtr<Animation>>& aAnimations)
{ {
nsIDocument* doc = GetComposedDoc(); nsIDocument* doc = GetComposedDoc();
if (doc) { if (doc) {
@ -3206,7 +3206,7 @@ Element::GetAnimations(nsTArray<nsRefPtr<AnimationPlayer> >& aAnimations)
for (size_t playerIdx = 0; for (size_t playerIdx = 0;
playerIdx < collection->mPlayers.Length(); playerIdx < collection->mPlayers.Length();
playerIdx++) { playerIdx++) {
AnimationPlayer* player = collection->mPlayers[playerIdx]; Animation* player = collection->mPlayers[playerIdx];
if (player->IsRelevant()) { if (player->IsRelevant()) {
aAnimations.AppendElement(player); aAnimations.AppendElement(player);
} }

View File

@ -121,7 +121,7 @@ class EventStateManager;
namespace dom { namespace dom {
class AnimationPlayer; class Animation;
class Link; class Link;
class UndoManager; class UndoManager;
class DOMRect; class DOMRect;
@ -808,7 +808,7 @@ public:
{ {
} }
void GetAnimations(nsTArray<nsRefPtr<AnimationPlayer> >& aAnimations); void GetAnimations(nsTArray<nsRefPtr<Animation>>& aAnimations);
NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML); NS_IMETHOD GetInnerHTML(nsAString& aInnerHTML);
virtual void SetInnerHTML(const nsAString& aInnerHTML, ErrorResult& aError); virtual void SetInnerHTML(const nsAString& aInnerHTML, ErrorResult& aError);

View File

@ -14,7 +14,7 @@
#include "nsIDOMMutationEvent.h" #include "nsIDOMMutationEvent.h"
#include "nsTextFragment.h" #include "nsTextFragment.h"
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#include "mozilla/dom/AnimationPlayer.h" #include "mozilla/dom/Animation.h"
#include "mozilla/dom/KeyframeEffect.h" #include "mozilla/dom/KeyframeEffect.h"
nsAutoTArray<nsRefPtr<nsDOMMutationObserver>, 4>* nsAutoTArray<nsRefPtr<nsDOMMutationObserver>, 4>*
@ -325,7 +325,7 @@ void nsMutationReceiver::NodeWillBeDestroyed(const nsINode *aNode)
} }
void void
nsAnimationReceiver::RecordAnimationMutation(AnimationPlayer* aPlayer, nsAnimationReceiver::RecordAnimationMutation(Animation* aPlayer,
AnimationMutation aMutationType) AnimationMutation aMutationType)
{ {
KeyframeEffectReadonly* effect = aPlayer->GetEffect(); KeyframeEffectReadonly* effect = aPlayer->GetEffect();
@ -385,19 +385,19 @@ nsAnimationReceiver::RecordAnimationMutation(AnimationPlayer* aPlayer,
} }
void void
nsAnimationReceiver::AnimationAdded(AnimationPlayer* aPlayer) nsAnimationReceiver::AnimationAdded(Animation* aPlayer)
{ {
RecordAnimationMutation(aPlayer, eAnimationMutation_Added); RecordAnimationMutation(aPlayer, eAnimationMutation_Added);
} }
void void
nsAnimationReceiver::AnimationChanged(AnimationPlayer* aPlayer) nsAnimationReceiver::AnimationChanged(Animation* aPlayer)
{ {
RecordAnimationMutation(aPlayer, eAnimationMutation_Changed); RecordAnimationMutation(aPlayer, eAnimationMutation_Changed);
} }
void void
nsAnimationReceiver::AnimationRemoved(AnimationPlayer* aPlayer) nsAnimationReceiver::AnimationRemoved(Animation* aPlayer)
{ {
RecordAnimationMutation(aPlayer, eAnimationMutation_Removed); RecordAnimationMutation(aPlayer, eAnimationMutation_Removed);
} }

View File

@ -24,7 +24,7 @@
#include "nsWrapperCache.h" #include "nsWrapperCache.h"
#include "mozilla/dom/MutationObserverBinding.h" #include "mozilla/dom/MutationObserverBinding.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "mozilla/dom/AnimationPlayer.h" #include "mozilla/dom/Animation.h"
#include "nsIAnimationObserver.h" #include "nsIAnimationObserver.h"
class nsDOMMutationObserver; class nsDOMMutationObserver;
@ -36,7 +36,7 @@ class nsDOMMutationRecord final : public nsISupports,
virtual ~nsDOMMutationRecord() {} virtual ~nsDOMMutationRecord() {}
public: public:
typedef nsTArray<nsRefPtr<mozilla::dom::AnimationPlayer>> AnimationPlayerArray; typedef nsTArray<nsRefPtr<mozilla::dom::Animation>> AnimationPlayerArray;
nsDOMMutationRecord(nsIAtom* aType, nsISupports* aOwner) nsDOMMutationRecord(nsIAtom* aType, nsISupports* aOwner)
: mType(aType), mAttrNamespace(NullString()), mPrevValue(NullString()), mOwner(aOwner) : mType(aType), mAttrNamespace(NullString()), mPrevValue(NullString()), mOwner(aOwner)
@ -434,7 +434,7 @@ private:
eAnimationMutation_Removed eAnimationMutation_Removed
}; };
void RecordAnimationMutation(mozilla::dom::AnimationPlayer* aPlayer, void RecordAnimationMutation(mozilla::dom::Animation* aPlayer,
AnimationMutation aMutationType); AnimationMutation aMutationType);
}; };
@ -756,7 +756,7 @@ public:
return sCurrentBatch->mBatchTarget; return sCurrentBatch->mBatchTarget;
} }
static void AnimationAdded(mozilla::dom::AnimationPlayer* aPlayer) static void AnimationAdded(mozilla::dom::Animation* aPlayer)
{ {
if (!IsBatching()) { if (!IsBatching()) {
return; return;
@ -783,7 +783,7 @@ public:
} }
} }
static void AnimationChanged(mozilla::dom::AnimationPlayer* aPlayer) static void AnimationChanged(mozilla::dom::Animation* aPlayer)
{ {
Entry* entry = sCurrentBatch->FindEntry(aPlayer); Entry* entry = sCurrentBatch->FindEntry(aPlayer);
if (entry) { if (entry) {
@ -800,7 +800,7 @@ public:
} }
} }
static void AnimationRemoved(mozilla::dom::AnimationPlayer* aPlayer) static void AnimationRemoved(mozilla::dom::Animation* aPlayer)
{ {
Entry* entry = sCurrentBatch->FindEntry(aPlayer); Entry* entry = sCurrentBatch->FindEntry(aPlayer);
if (entry) { if (entry) {
@ -824,7 +824,7 @@ public:
} }
private: private:
Entry* FindEntry(mozilla::dom::AnimationPlayer* aPlayer) Entry* FindEntry(mozilla::dom::Animation* aPlayer)
{ {
for (Entry& e : mEntries) { for (Entry& e : mEntries) {
if (e.mPlayer == aPlayer) { if (e.mPlayer == aPlayer) {
@ -843,7 +843,7 @@ private:
struct Entry struct Entry
{ {
nsRefPtr<mozilla::dom::AnimationPlayer> mPlayer; nsRefPtr<mozilla::dom::Animation> mPlayer;
State mState; State mState;
bool mChanged; bool mChanged;
}; };

View File

@ -9,7 +9,7 @@
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
class AnimationPlayer; class Animation;
} }
} }
@ -22,36 +22,36 @@ class nsIAnimationObserver : public nsIMutationObserver
public: public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IANIMATION_OBSERVER_IID) NS_DECLARE_STATIC_IID_ACCESSOR(NS_IANIMATION_OBSERVER_IID)
virtual void AnimationAdded(mozilla::dom::AnimationPlayer* aPlayer) = 0; virtual void AnimationAdded(mozilla::dom::Animation* aPlayer) = 0;
virtual void AnimationChanged(mozilla::dom::AnimationPlayer* aPlayer) = 0; virtual void AnimationChanged(mozilla::dom::Animation* aPlayer) = 0;
virtual void AnimationRemoved(mozilla::dom::AnimationPlayer* aPlayer) = 0; virtual void AnimationRemoved(mozilla::dom::Animation* aPlayer) = 0;
}; };
NS_DEFINE_STATIC_IID_ACCESSOR(nsIAnimationObserver, NS_IANIMATION_OBSERVER_IID) NS_DEFINE_STATIC_IID_ACCESSOR(nsIAnimationObserver, NS_IANIMATION_OBSERVER_IID)
#define NS_DECL_NSIANIMATIONOBSERVER_ANIMATIONADDED \ #define NS_DECL_NSIANIMATIONOBSERVER_ANIMATIONADDED \
virtual void AnimationAdded(mozilla::dom::AnimationPlayer* aPlayer) \ virtual void AnimationAdded(mozilla::dom::Animation* aPlayer) \
override; override;
#define NS_DECL_NSIANIMATIONOBSERVER_ANIMATIONCHANGED \ #define NS_DECL_NSIANIMATIONOBSERVER_ANIMATIONCHANGED \
virtual void AnimationChanged(mozilla::dom::AnimationPlayer* aPlayer) \ virtual void AnimationChanged(mozilla::dom::Animation* aPlayer) \
override; override;
#define NS_DECL_NSIANIMATIONOBSERVER_ANIMATIONREMOVED \ #define NS_DECL_NSIANIMATIONOBSERVER_ANIMATIONREMOVED \
virtual void AnimationRemoved(mozilla::dom::AnimationPlayer* aPlayer) \ virtual void AnimationRemoved(mozilla::dom::Animation* aPlayer) \
override; override;
#define NS_IMPL_NSIANIMATIONOBSERVER_STUB(class_) \ #define NS_IMPL_NSIANIMATIONOBSERVER_STUB(class_) \
void \ void \
class_::AnimationAdded(mozilla::dom::AnimationPlayer* aPlayer) \ class_::AnimationAdded(mozilla::dom::Animation* aPlayer) \
{ \ { \
} \ } \
void \ void \
class_::AnimationChanged(mozilla::dom::AnimationPlayer* aPlayer) \ class_::AnimationChanged(mozilla::dom::Animation* aPlayer) \
{ \ { \
} \ } \
void \ void \
class_::AnimationRemoved(mozilla::dom::AnimationPlayer* aPlayer) \ class_::AnimationRemoved(mozilla::dom::Animation* aPlayer) \
{ \ { \
} \ } \
NS_IMPL_NSIMUTATIONOBSERVER_CORE_STUB(class_) \ NS_IMPL_NSIMUTATIONOBSERVER_CORE_STUB(class_) \

View File

@ -24,7 +24,7 @@
#include "nsBindingManager.h" #include "nsBindingManager.h"
#include "nsGenericHTMLElement.h" #include "nsGenericHTMLElement.h"
#include "mozilla/Assertions.h" #include "mozilla/Assertions.h"
#include "mozilla/dom/AnimationPlayer.h" #include "mozilla/dom/Animation.h"
#include "mozilla/dom/HTMLImageElement.h" #include "mozilla/dom/HTMLImageElement.h"
#include "mozilla/dom/HTMLMediaElement.h" #include "mozilla/dom/HTMLMediaElement.h"
#include "mozilla/dom/KeyframeEffect.h" #include "mozilla/dom/KeyframeEffect.h"
@ -216,7 +216,7 @@ nsNodeUtils::ContentRemoved(nsINode* aContainer,
} }
static inline Element* static inline Element*
GetTarget(AnimationPlayer* aPlayer) GetTarget(Animation* aPlayer)
{ {
KeyframeEffectReadonly* effect = aPlayer->GetEffect(); KeyframeEffectReadonly* effect = aPlayer->GetEffect();
if (!effect) { if (!effect) {
@ -238,7 +238,7 @@ GetTarget(AnimationPlayer* aPlayer)
} }
void void
nsNodeUtils::AnimationAdded(AnimationPlayer* aPlayer) nsNodeUtils::AnimationAdded(Animation* aPlayer)
{ {
Element* target = GetTarget(aPlayer); Element* target = GetTarget(aPlayer);
if (!target) { if (!target) {
@ -252,7 +252,7 @@ nsNodeUtils::AnimationAdded(AnimationPlayer* aPlayer)
} }
void void
nsNodeUtils::AnimationChanged(AnimationPlayer* aPlayer) nsNodeUtils::AnimationChanged(Animation* aPlayer)
{ {
Element* target = GetTarget(aPlayer); Element* target = GetTarget(aPlayer);
if (!target) { if (!target) {
@ -266,7 +266,7 @@ nsNodeUtils::AnimationChanged(AnimationPlayer* aPlayer)
} }
void void
nsNodeUtils::AnimationRemoved(AnimationPlayer* aPlayer) nsNodeUtils::AnimationRemoved(Animation* aPlayer)
{ {
Element* target = GetTarget(aPlayer); Element* target = GetTarget(aPlayer);
if (!target) { if (!target) {

View File

@ -18,7 +18,7 @@ template<class E> class nsCOMArray;
class nsCycleCollectionTraversalCallback; class nsCycleCollectionTraversalCallback;
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
class AnimationPlayer; class Animation;
} }
} }
@ -127,9 +127,9 @@ public:
} }
} }
static void AnimationAdded(mozilla::dom::AnimationPlayer* aPlayer); static void AnimationAdded(mozilla::dom::Animation* aPlayer);
static void AnimationChanged(mozilla::dom::AnimationPlayer* aPlayer); static void AnimationChanged(mozilla::dom::Animation* aPlayer);
static void AnimationRemoved(mozilla::dom::AnimationPlayer* aPlayer); static void AnimationRemoved(mozilla::dom::Animation* aPlayer);
/** /**
* To be called when reference count of aNode drops to zero. * To be called when reference count of aNode drops to zero.

View File

@ -129,12 +129,12 @@ var interfaceNamesInGlobalScope =
{name: "AlarmsManager", pref: "dom.mozAlarms.enabled"}, {name: "AlarmsManager", pref: "dom.mozAlarms.enabled"},
// IMPORTANT: Do not change this list without review from a DOM peer! // IMPORTANT: Do not change this list without review from a DOM peer!
"AnalyserNode", "AnalyserNode",
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "Animation", pref: "dom.animations-api.core.enabled"},
// IMPORTANT: Do not change this list without review from a DOM peer! // IMPORTANT: Do not change this list without review from a DOM peer!
{name: "AnimationEffectReadonly", pref: "dom.animations-api.core.enabled"}, {name: "AnimationEffectReadonly", pref: "dom.animations-api.core.enabled"},
// IMPORTANT: Do not change this list without review from a DOM peer! // IMPORTANT: Do not change this list without review from a DOM peer!
"AnimationEvent", "AnimationEvent",
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "AnimationPlayer", pref: "dom.animations-api.core.enabled"},
// IMPORTANT: Do not change this list without review from a DOM peer! // IMPORTANT: Do not change this list without review from a DOM peer!
{name: "AnimationTimeline", pref: "dom.animations-api.core.enabled"}, {name: "AnimationTimeline", pref: "dom.animations-api.core.enabled"},
// IMPORTANT: Do not change this list without review from a DOM peer! // IMPORTANT: Do not change this list without review from a DOM peer!

View File

@ -13,5 +13,5 @@
[NoInterfaceObject] [NoInterfaceObject]
interface Animatable { interface Animatable {
[Func="nsDocument::IsWebAnimationsEnabled"] [Func="nsDocument::IsWebAnimationsEnabled"]
sequence<AnimationPlayer> getAnimations(); sequence<Animation> getAnimations();
}; };

View File

@ -4,16 +4,16 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. * You can obtain one at http://mozilla.org/MPL/2.0/.
* *
* The origin of this IDL file is * The origin of this IDL file is
* http://dev.w3.org/fxtf/web-animations/#idl-def-AnimationPlayer * http://w3c.github.io/web-animations/#the-animation-interface
* *
* Copyright © 2014 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C * Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply. * liability, trademark and document use rules apply.
*/ */
enum AnimationPlayState { "idle", "pending", "running", "paused", "finished" }; enum AnimationPlayState { "idle", "pending", "running", "paused", "finished" };
[Func="nsDocument::IsWebAnimationsEnabled"] [Func="nsDocument::IsWebAnimationsEnabled"]
interface AnimationPlayer { interface Animation {
// Bug 1049975: Make 'effect' writeable // Bug 1049975: Make 'effect' writeable
[Pure] [Pure]
readonly attribute AnimationEffectReadonly? effect; readonly attribute AnimationEffectReadonly? effect;
@ -27,9 +27,9 @@ interface AnimationPlayer {
[BinaryName="playStateFromJS"] [BinaryName="playStateFromJS"]
readonly attribute AnimationPlayState playState; readonly attribute AnimationPlayState playState;
[Throws] [Throws]
readonly attribute Promise<AnimationPlayer> ready; readonly attribute Promise<Animation> ready;
[Throws] [Throws]
readonly attribute Promise<AnimationPlayer> finished; readonly attribute Promise<Animation> finished;
/* /*
void cancel (); void cancel ();
void finish (); void finish ();
@ -44,6 +44,6 @@ interface AnimationPlayer {
}; };
// Non-standard extensions // Non-standard extensions
partial interface AnimationPlayer { partial interface Animation {
[ChromeOnly] readonly attribute boolean isRunningOnCompositor; [ChromeOnly] readonly attribute boolean isRunningOnCompositor;
}; };

View File

@ -15,6 +15,6 @@ interface AnimationTimeline {
[BinaryName="currentTimeAsDouble"] [BinaryName="currentTimeAsDouble"]
readonly attribute double? currentTime; readonly attribute double? currentTime;
// Not yet implemented: // Not yet implemented:
// AnimationPlayer play (optional TimedItem? source = null); // Animation play (optional TimedItem? source = null);
// sequence<AnimationPlayer> getAnimations (); // sequence<Animation> getAnimations ();
}; };

View File

@ -29,11 +29,11 @@ interface MutationRecord {
[Constant] [Constant]
readonly attribute DOMString? oldValue; readonly attribute DOMString? oldValue;
[Constant,Cached,ChromeOnly] [Constant,Cached,ChromeOnly]
readonly attribute sequence<AnimationPlayer> addedAnimations; readonly attribute sequence<Animation> addedAnimations;
[Constant,Cached,ChromeOnly] [Constant,Cached,ChromeOnly]
readonly attribute sequence<AnimationPlayer> changedAnimations; readonly attribute sequence<Animation> changedAnimations;
[Constant,Cached,ChromeOnly] [Constant,Cached,ChromeOnly]
readonly attribute sequence<AnimationPlayer> removedAnimations; readonly attribute sequence<Animation> removedAnimations;
}; };
[Constructor(MutationCallback mutationCallback)] [Constructor(MutationCallback mutationCallback)]

View File

@ -22,9 +22,9 @@ WEBIDL_FILES = [
'AlarmsManager.webidl', 'AlarmsManager.webidl',
'AnalyserNode.webidl', 'AnalyserNode.webidl',
'Animatable.webidl', 'Animatable.webidl',
'Animation.webidl',
'AnimationEffectReadonly.webidl', 'AnimationEffectReadonly.webidl',
'AnimationEvent.webidl', 'AnimationEvent.webidl',
'AnimationPlayer.webidl',
'AnimationTimeline.webidl', 'AnimationTimeline.webidl',
'AnonymousContent.webidl', 'AnonymousContent.webidl',
'AppInfo.webidl', 'AppInfo.webidl',

View File

@ -21,7 +21,7 @@
#include "gfx2DGlue.h" #include "gfx2DGlue.h"
#include "mozilla/DebugOnly.h" // for DebugOnly #include "mozilla/DebugOnly.h" // for DebugOnly
#include "mozilla/Telemetry.h" // for Accumulate #include "mozilla/Telemetry.h" // for Accumulate
#include "mozilla/dom/AnimationPlayer.h" // for ComputedTimingFunction #include "mozilla/dom/Animation.h" // for ComputedTimingFunction
#include "mozilla/gfx/2D.h" // for DrawTarget #include "mozilla/gfx/2D.h" // for DrawTarget
#include "mozilla/gfx/BaseSize.h" // for BaseSize #include "mozilla/gfx/BaseSize.h" // for BaseSize
#include "mozilla/gfx/Matrix.h" // for Matrix4x4 #include "mozilla/gfx/Matrix.h" // for Matrix4x4

View File

@ -34,7 +34,7 @@
#include "mozilla/ReentrantMonitor.h" // for ReentrantMonitorAutoEnter, etc #include "mozilla/ReentrantMonitor.h" // for ReentrantMonitorAutoEnter, etc
#include "mozilla/StaticPtr.h" // for StaticAutoPtr #include "mozilla/StaticPtr.h" // for StaticAutoPtr
#include "mozilla/TimeStamp.h" // for TimeDuration, TimeStamp #include "mozilla/TimeStamp.h" // for TimeDuration, TimeStamp
#include "mozilla/dom/AnimationPlayer.h" // for ComputedTimingFunction #include "mozilla/dom/KeyframeEffect.h" // for ComputedTimingFunction
#include "mozilla/dom/Touch.h" // for Touch #include "mozilla/dom/Touch.h" // for Touch
#include "mozilla/gfx/BasePoint.h" // for BasePoint #include "mozilla/gfx/BasePoint.h" // for BasePoint
#include "mozilla/gfx/BaseRect.h" // for BaseRect #include "mozilla/gfx/BaseRect.h" // for BaseRect

View File

@ -8,7 +8,7 @@
#include <math.h> // for fabsf, pow, powf #include <math.h> // for fabsf, pow, powf
#include <algorithm> // for max #include <algorithm> // for max
#include "AsyncPanZoomController.h" // for AsyncPanZoomController #include "AsyncPanZoomController.h" // for AsyncPanZoomController
#include "mozilla/dom/AnimationPlayer.h" // for ComputedTimingFunction #include "mozilla/dom/KeyframeEffect.h" // for ComputedTimingFunction
#include "mozilla/layers/APZCTreeManager.h" // for APZCTreeManager #include "mozilla/layers/APZCTreeManager.h" // for APZCTreeManager
#include "mozilla/layers/APZThreadUtils.h" // for AssertOnControllerThread #include "mozilla/layers/APZThreadUtils.h" // for AssertOnControllerThread
#include "FrameMetrics.h" // for FrameMetrics #include "FrameMetrics.h" // for FrameMetrics

View File

@ -17,6 +17,7 @@
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsIDOMWindow.h" #include "nsIDOMWindow.h"
#include "nsRefreshDriver.h"
#define APZCCH_LOG(...) #define APZCCH_LOG(...)
// #define APZCCH_LOG(...) printf_stderr("APZCCH: " __VA_ARGS__) // #define APZCCH_LOG(...) printf_stderr("APZCCH: " __VA_ARGS__)

View File

@ -13,7 +13,6 @@
#include "gfxPoint.h" // for gfxPoint, gfxSize #include "gfxPoint.h" // for gfxPoint, gfxSize
#include "mozilla/StyleAnimationValue.h" // for StyleAnimationValue, etc #include "mozilla/StyleAnimationValue.h" // for StyleAnimationValue, etc
#include "mozilla/WidgetUtils.h" // for ComputeTransformForRotation #include "mozilla/WidgetUtils.h" // for ComputeTransformForRotation
#include "mozilla/dom/AnimationPlayer.h" // for AnimationPlayer
#include "mozilla/dom/KeyframeEffect.h" // for KeyframeEffectReadonly #include "mozilla/dom/KeyframeEffect.h" // for KeyframeEffectReadonly
#include "mozilla/gfx/BaseRect.h" // for BaseRect #include "mozilla/gfx/BaseRect.h" // for BaseRect
#include "mozilla/gfx/Point.h" // for RoundedToInt, PointTyped #include "mozilla/gfx/Point.h" // for RoundedToInt, PointTyped

View File

@ -348,7 +348,7 @@ ToTimingFunction(const ComputedTimingFunction& aCTF)
static void static void
AddAnimationForProperty(nsIFrame* aFrame, const AnimationProperty& aProperty, AddAnimationForProperty(nsIFrame* aFrame, const AnimationProperty& aProperty,
AnimationPlayer* aPlayer, Layer* aLayer, dom::Animation* aPlayer, Layer* aLayer,
AnimationData& aData, bool aPending) AnimationData& aData, bool aPending)
{ {
MOZ_ASSERT(aLayer->AsContainerLayer(), "Should only animate ContainerLayer"); MOZ_ASSERT(aLayer->AsContainerLayer(), "Should only animate ContainerLayer");
@ -417,7 +417,7 @@ AddAnimationsForProperty(nsIFrame* aFrame, nsCSSProperty aProperty,
// Add from first to last (since last overrides) // Add from first to last (since last overrides)
for (size_t playerIdx = 0; playerIdx < aPlayers.Length(); playerIdx++) { for (size_t playerIdx = 0; playerIdx < aPlayers.Length(); playerIdx++) {
AnimationPlayer* player = aPlayers[playerIdx]; dom::Animation* player = aPlayers[playerIdx];
if (!player->IsPlaying()) { if (!player->IsPlaying()) {
continue; continue;
} }

View File

@ -501,7 +501,7 @@ GetMinAndMaxScaleForAnimationProperty(nsIContent* aContent,
gfxSize& aMinScale) gfxSize& aMinScale)
{ {
for (size_t playerIdx = aPlayers->mPlayers.Length(); playerIdx-- != 0; ) { for (size_t playerIdx = aPlayers->mPlayers.Length(); playerIdx-- != 0; ) {
AnimationPlayer* player = aPlayers->mPlayers[playerIdx]; dom::Animation* player = aPlayers->mPlayers[playerIdx];
if (!player->GetEffect() || player->GetEffect()->IsFinishedTransition()) { if (!player->GetEffect() || player->GetEffect()->IsFinishedTransition()) {
continue; continue;
} }

View File

@ -29,7 +29,7 @@
using mozilla::layers::Layer; using mozilla::layers::Layer;
using mozilla::dom::AnimationPlayer; using mozilla::dom::Animation;
using mozilla::dom::KeyframeEffectReadonly; using mozilla::dom::KeyframeEffectReadonly;
namespace mozilla { namespace mozilla {
@ -601,7 +601,7 @@ AnimationPlayerCollection::CanPerformOnCompositorThread(
} }
for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) { for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) {
const AnimationPlayer* player = mPlayers[playerIdx]; const Animation* player = mPlayers[playerIdx];
if (!player->IsPlaying()) { if (!player->IsPlaying()) {
continue; continue;
} }
@ -620,7 +620,7 @@ AnimationPlayerCollection::CanPerformOnCompositorThread(
bool existsProperty = false; bool existsProperty = false;
for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) { for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) {
const AnimationPlayer* player = mPlayers[playerIdx]; const Animation* player = mPlayers[playerIdx];
if (!player->IsPlaying()) { if (!player->IsPlaying()) {
continue; continue;
} }
@ -928,7 +928,7 @@ AnimationPlayerCollection::HasCurrentAnimationsForProperties(
size_t aPropertyCount) const size_t aPropertyCount) const
{ {
for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) { for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) {
const AnimationPlayer& player = *mPlayers[playerIdx]; const Animation& player = *mPlayers[playerIdx];
const KeyframeEffectReadonly* effect = player.GetEffect(); const KeyframeEffectReadonly* effect = player.GetEffect();
if (effect && if (effect &&
effect->IsCurrent(player) && effect->IsCurrent(player) &&

View File

@ -15,7 +15,7 @@
#include "nsDisplayList.h" // For nsDisplayItem::Type #include "nsDisplayList.h" // For nsDisplayItem::Type
#include "mozilla/MemoryReporting.h" #include "mozilla/MemoryReporting.h"
#include "mozilla/StyleAnimationValue.h" #include "mozilla/StyleAnimationValue.h"
#include "mozilla/dom/AnimationPlayer.h" #include "mozilla/dom/Animation.h"
#include "mozilla/dom/Element.h" #include "mozilla/dom/Element.h"
#include "mozilla/dom/Nullable.h" #include "mozilla/dom/Nullable.h"
#include "nsStyleStruct.h" #include "nsStyleStruct.h"
@ -223,8 +223,7 @@ private:
} /* end css sub-namespace */ } /* end css sub-namespace */
typedef InfallibleTArray<nsRefPtr<dom::AnimationPlayer> > typedef InfallibleTArray<nsRefPtr<dom::Animation>> AnimationPlayerPtrArray;
AnimationPlayerPtrArray;
enum EnsureStyleRuleFlags { enum EnsureStyleRuleFlags {
EnsureStyleRule_IsThrottled, EnsureStyleRule_IsThrottled,

View File

@ -24,7 +24,7 @@
using namespace mozilla; using namespace mozilla;
using namespace mozilla::css; using namespace mozilla::css;
using mozilla::dom::AnimationPlayer; using mozilla::dom::Animation;
using mozilla::dom::KeyframeEffectReadonly; using mozilla::dom::KeyframeEffectReadonly;
using mozilla::CSSAnimationPlayer; using mozilla::CSSAnimationPlayer;
@ -32,21 +32,21 @@ mozilla::dom::Promise*
CSSAnimationPlayer::GetReady(ErrorResult& aRv) CSSAnimationPlayer::GetReady(ErrorResult& aRv)
{ {
FlushStyle(); FlushStyle();
return AnimationPlayer::GetReady(aRv); return Animation::GetReady(aRv);
} }
void void
CSSAnimationPlayer::Play(LimitBehavior aLimitBehavior) CSSAnimationPlayer::Play(LimitBehavior aLimitBehavior)
{ {
mPauseShouldStick = false; mPauseShouldStick = false;
AnimationPlayer::Play(aLimitBehavior); Animation::Play(aLimitBehavior);
} }
void void
CSSAnimationPlayer::Pause() CSSAnimationPlayer::Pause()
{ {
mPauseShouldStick = true; mPauseShouldStick = true;
AnimationPlayer::Pause(); Animation::Pause();
} }
mozilla::dom::AnimationPlayState mozilla::dom::AnimationPlayState
@ -55,7 +55,7 @@ CSSAnimationPlayer::PlayStateFromJS() const
// Flush style to ensure that any properties controlling animation state // Flush style to ensure that any properties controlling animation state
// (e.g. animation-play-state) are fully updated. // (e.g. animation-play-state) are fully updated.
FlushStyle(); FlushStyle();
return AnimationPlayer::PlayStateFromJS(); return Animation::PlayStateFromJS();
} }
void void
@ -64,7 +64,7 @@ CSSAnimationPlayer::PlayFromJS()
// Note that flushing style below might trigger calls to // Note that flushing style below might trigger calls to
// PlayFromStyle()/PauseFromStyle() on this object. // PlayFromStyle()/PauseFromStyle() on this object.
FlushStyle(); FlushStyle();
AnimationPlayer::PlayFromJS(); Animation::PlayFromJS();
} }
void void
@ -72,7 +72,7 @@ CSSAnimationPlayer::PlayFromStyle()
{ {
mIsStylePaused = false; mIsStylePaused = false;
if (!mPauseShouldStick) { if (!mPauseShouldStick) {
DoPlay(AnimationPlayer::LimitBehavior::Continue); DoPlay(Animation::LimitBehavior::Continue);
} }
} }
@ -327,7 +327,7 @@ nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext,
if (!collection->mPlayers.IsEmpty()) { if (!collection->mPlayers.IsEmpty()) {
for (size_t newIdx = newPlayers.Length(); newIdx-- != 0;) { for (size_t newIdx = newPlayers.Length(); newIdx-- != 0;) {
AnimationPlayer* newPlayer = newPlayers[newIdx]; Animation* newPlayer = newPlayers[newIdx];
// Find the matching animation with this name in the old list // Find the matching animation with this name in the old list
// of animations. We iterate through both lists in a backwards // of animations. We iterate through both lists in a backwards
@ -507,7 +507,7 @@ nsAnimationManager::BuildAnimations(nsStyleContext* aStyleContext,
// not generate animation events. This includes when the animation-name is // not generate animation events. This includes when the animation-name is
// "none" which is represented by an empty name in the StyleAnimation. // "none" which is represented by an empty name in the StyleAnimation.
// Since such animations neither affect style nor dispatch events, we do // Since such animations neither affect style nor dispatch events, we do
// not generate a corresponding AnimationPlayer for them. // not generate a corresponding Animation for them.
nsCSSKeyframesRule* rule = nsCSSKeyframesRule* rule =
src.GetName().IsEmpty() src.GetName().IsEmpty()
? nullptr ? nullptr
@ -753,7 +753,7 @@ nsAnimationManager::UpdateCascadeResults(
for (size_t playerIdx = aElementAnimations->mPlayers.Length(); for (size_t playerIdx = aElementAnimations->mPlayers.Length();
playerIdx-- != 0; ) { playerIdx-- != 0; ) {
const AnimationPlayer* player = aElementAnimations->mPlayers[playerIdx]; const Animation* player = aElementAnimations->mPlayers[playerIdx];
const KeyframeEffectReadonly* effect = player->GetEffect(); const KeyframeEffectReadonly* effect = player->GetEffect();
if (!effect) { if (!effect) {
continue; continue;

View File

@ -9,7 +9,7 @@
#include "mozilla/ContentEvents.h" #include "mozilla/ContentEvents.h"
#include "AnimationCommon.h" #include "AnimationCommon.h"
#include "nsCSSPseudoElements.h" #include "nsCSSPseudoElements.h"
#include "mozilla/dom/AnimationPlayer.h" #include "mozilla/dom/Animation.h"
#include "mozilla/MemoryReporting.h" #include "mozilla/MemoryReporting.h"
#include "mozilla/TimeStamp.h" #include "mozilla/TimeStamp.h"
@ -52,11 +52,11 @@ struct AnimationEventInfo {
typedef InfallibleTArray<AnimationEventInfo> EventArray; typedef InfallibleTArray<AnimationEventInfo> EventArray;
class CSSAnimationPlayer final : public dom::AnimationPlayer class CSSAnimationPlayer final : public dom::Animation
{ {
public: public:
explicit CSSAnimationPlayer(dom::DocumentTimeline* aTimeline) explicit CSSAnimationPlayer(dom::DocumentTimeline* aTimeline)
: dom::AnimationPlayer(aTimeline) : dom::Animation(aTimeline)
, mIsStylePaused(false) , mIsStylePaused(false)
, mPauseShouldStick(false) , mPauseShouldStick(false)
, mPreviousPhaseOrIteration(PREVIOUS_PHASE_BEFORE) , mPreviousPhaseOrIteration(PREVIOUS_PHASE_BEFORE)
@ -125,7 +125,7 @@ protected:
// 'running' A | A | C | C | A // 'running' A | A | C | C | A
// 'paused' E | B | D | D | E // 'paused' E | B | D | D | E
// //
// The base class, AnimationPlayer already provides a boolean value, // The base class, Animation already provides a boolean value,
// mIsPaused which gives us two states. To this we add a further two booleans // mIsPaused which gives us two states. To this we add a further two booleans
// to represent the states as follows. // to represent the states as follows.
// //

View File

@ -33,11 +33,10 @@
using mozilla::TimeStamp; using mozilla::TimeStamp;
using mozilla::TimeDuration; using mozilla::TimeDuration;
using mozilla::dom::AnimationPlayer; using mozilla::dom::Animation;
using mozilla::dom::KeyframeEffectReadonly; using mozilla::dom::KeyframeEffectReadonly;
using namespace mozilla; using namespace mozilla;
using namespace mozilla::layers;
using namespace mozilla::css; using namespace mozilla::css;
const nsString& const nsString&
@ -90,14 +89,14 @@ mozilla::dom::AnimationPlayState
CSSTransitionPlayer::PlayStateFromJS() const CSSTransitionPlayer::PlayStateFromJS() const
{ {
FlushStyle(); FlushStyle();
return AnimationPlayer::PlayStateFromJS(); return Animation::PlayStateFromJS();
} }
void void
CSSTransitionPlayer::PlayFromJS() CSSTransitionPlayer::PlayFromJS()
{ {
FlushStyle(); FlushStyle();
AnimationPlayer::PlayFromJS(); Animation::PlayFromJS();
} }
CommonAnimationManager* CommonAnimationManager*
@ -320,7 +319,7 @@ nsTransitionManager::StyleContextChanged(dom::Element *aElement,
StyleAnimationValue currentValue; StyleAnimationValue currentValue;
do { do {
--i; --i;
AnimationPlayer* player = players[i]; Animation* player = players[i];
dom::KeyframeEffectReadonly* effect = player->GetEffect(); dom::KeyframeEffectReadonly* effect = player->GetEffect();
MOZ_ASSERT(effect && effect->Properties().Length() == 1, MOZ_ASSERT(effect && effect->Properties().Length() == 1,
"Should have one animation property for a transition"); "Should have one animation property for a transition");
@ -808,7 +807,7 @@ nsTransitionManager::FlushTransitions(FlushFlags aFlags)
bool transitionStartedOrEnded = false; bool transitionStartedOrEnded = false;
do { do {
--i; --i;
AnimationPlayer* player = collection->mPlayers[i]; Animation* player = collection->mPlayers[i];
if (!player->GetEffect()->IsFinishedTransition()) { if (!player->GetEffect()->IsFinishedTransition()) {
MOZ_ASSERT(player->GetEffect(), MOZ_ASSERT(player->GetEffect(),
"Transitions should have an effect"); "Transitions should have an effect");

View File

@ -10,7 +10,7 @@
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
#include "mozilla/MemoryReporting.h" #include "mozilla/MemoryReporting.h"
#include "mozilla/dom/AnimationPlayer.h" #include "mozilla/dom/Animation.h"
#include "mozilla/dom/KeyframeEffect.h" #include "mozilla/dom/KeyframeEffect.h"
#include "AnimationCommon.h" #include "AnimationCommon.h"
#include "nsCSSPseudoElements.h" #include "nsCSSPseudoElements.h"
@ -75,11 +75,11 @@ struct ElementPropertyTransition : public dom::KeyframeEffectReadonly
double CurrentValuePortion() const; double CurrentValuePortion() const;
}; };
class CSSTransitionPlayer final : public dom::AnimationPlayer class CSSTransitionPlayer final : public dom::Animation
{ {
public: public:
explicit CSSTransitionPlayer(dom::DocumentTimeline* aTimeline) explicit CSSTransitionPlayer(dom::DocumentTimeline* aTimeline)
: dom::AnimationPlayer(aTimeline) : dom::Animation(aTimeline)
{ {
} }
@ -91,7 +91,7 @@ public:
// A variant of Play() that avoids posting style updates since this method // A variant of Play() that avoids posting style updates since this method
// is expected to be called whilst already updating style. // is expected to be called whilst already updating style.
void PlayFromStyle() { DoPlay(AnimationPlayer::LimitBehavior::Continue); } void PlayFromStyle() { DoPlay(Animation::LimitBehavior::Continue); }
protected: protected:
virtual ~CSSTransitionPlayer() { } virtual ~CSSTransitionPlayer() { }