mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1109390 part 8 - Rename Start* methods in AnimationPlayer to Trigger*; r=jwatt
This commit is contained in:
parent
f49ade3807
commit
ea73c31149
@ -284,12 +284,11 @@ AnimationPlayer::Tick()
|
||||
}
|
||||
|
||||
void
|
||||
AnimationPlayer::StartOnNextTick(const Nullable<TimeDuration>& aReadyTime)
|
||||
AnimationPlayer::TriggerOnNextTick(const Nullable<TimeDuration>& aReadyTime)
|
||||
{
|
||||
// Normally we expect the play state to be pending but it's possible that,
|
||||
// due to the handling of possibly orphaned players in Tick() [coming
|
||||
// in a later patch in this series], this player got started whilst still
|
||||
// being in another document's pending player map.
|
||||
// due to the handling of possibly orphaned players in Tick(), this player got
|
||||
// started whilst still being in another document's pending player map.
|
||||
if (PlayState() != AnimationPlayState::Pending) {
|
||||
return;
|
||||
}
|
||||
@ -300,7 +299,7 @@ AnimationPlayer::StartOnNextTick(const Nullable<TimeDuration>& aReadyTime)
|
||||
}
|
||||
|
||||
void
|
||||
AnimationPlayer::StartNow()
|
||||
AnimationPlayer::TriggerNow()
|
||||
{
|
||||
MOZ_ASSERT(PlayState() == AnimationPlayState::Pending,
|
||||
"Expected to start a pending player");
|
||||
@ -449,7 +448,7 @@ AnimationPlayer::DoPlay()
|
||||
|
||||
nsIDocument* doc = GetRenderedDocument();
|
||||
if (!doc) {
|
||||
StartOnNextTick(Nullable<TimeDuration>());
|
||||
TriggerOnNextTick(Nullable<TimeDuration>());
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -107,6 +107,8 @@ public:
|
||||
void Tick();
|
||||
|
||||
/**
|
||||
* Set the time to use for starting or pausing a pending player.
|
||||
*
|
||||
* Typically, when a player is played, it does not start immediately but is
|
||||
* added to a table of pending players on the document of its source content.
|
||||
* In the meantime it sets its hold time to the time from which playback
|
||||
@ -119,9 +121,9 @@ public:
|
||||
* players do start, they can be timed from the point when painting
|
||||
* completed.
|
||||
*
|
||||
* After calling StartOnNextTick, players remain in the pending state until
|
||||
* After calling TriggerOnNextTick, players remain in the pending state until
|
||||
* the next refresh driver tick. At that time they transition out of the
|
||||
* pending state using the time passed to StartOnNextTick as the effective
|
||||
* pending state using the time passed to TriggerOnNextTick as the effective
|
||||
* time at which they resumed.
|
||||
*
|
||||
* This approach means that any setup time required for performing the
|
||||
@ -145,20 +147,27 @@ public:
|
||||
* between triggering an animation and its effective start is unacceptably
|
||||
* long.
|
||||
*
|
||||
* For pausing, we apply the same asynchronous approach. This is so that we
|
||||
* synchronize with animations that are running on the compositor. Otherwise
|
||||
* if the main thread lags behind the compositor there will be a noticeable
|
||||
* jump backwards when the main thread takes over. Even though main thread
|
||||
* animations could be paused immediately, we do it asynchronously for
|
||||
* consistency and so that animations paused together end up in step.
|
||||
*
|
||||
* Note that the caller of this method is responsible for removing the player
|
||||
* from any PendingPlayerTracker it may have been added to.
|
||||
*/
|
||||
void StartOnNextTick(const Nullable<TimeDuration>& aReadyTime);
|
||||
void TriggerOnNextTick(const Nullable<TimeDuration>& aReadyTime);
|
||||
|
||||
// Testing only: Start a pending player using the current timeline time.
|
||||
// This is used to support existing tests that expect animations to begin
|
||||
// immediately. Ideally we would rewrite the those tests and get rid of this
|
||||
// method, but there are a lot of them.
|
||||
// Testing only: Start or pause a pending player using the current timeline
|
||||
// time. This is used to support existing tests that expect animations to
|
||||
// begin immediately. Ideally we would rewrite the those tests and get rid of
|
||||
// this method, but there are a lot of them.
|
||||
//
|
||||
// As with StartOnNextTick, the caller of this method is responsible for
|
||||
// As with TriggerOnNextTick, the caller of this method is responsible for
|
||||
// removing the player from any PendingPlayerTracker it may have been added
|
||||
// to.
|
||||
void StartNow();
|
||||
void TriggerNow();
|
||||
|
||||
/**
|
||||
* When StartOnNextTick is called, we store the ready time but we don't apply
|
||||
|
@ -48,8 +48,8 @@ PendingPlayerTracker::IsWaiting(const dom::AnimationPlayer& aPlayer,
|
||||
}
|
||||
|
||||
PLDHashOperator
|
||||
StartPlayerAtTime(nsRefPtrHashKey<dom::AnimationPlayer>* aKey,
|
||||
void* aReadyTime)
|
||||
TriggerPlayerAtTime(nsRefPtrHashKey<dom::AnimationPlayer>* aKey,
|
||||
void* aReadyTime)
|
||||
{
|
||||
dom::AnimationPlayer* player = aKey->GetKey();
|
||||
dom::AnimationTimeline* timeline = player->Timeline();
|
||||
@ -57,7 +57,7 @@ StartPlayerAtTime(nsRefPtrHashKey<dom::AnimationPlayer>* aKey,
|
||||
// When the timeline's refresh driver is under test control, its values
|
||||
// have no correspondance to wallclock times so we shouldn't try to convert
|
||||
// aReadyTime (which is a wallclock time) to a timeline value. Instead, the
|
||||
// animation player will be started when the refresh driver is next
|
||||
// animation player will be started/paused when the refresh driver is next
|
||||
// advanced since this will trigger a call to TriggerPendingPlayersNow.
|
||||
if (timeline->IsUnderTestControl()) {
|
||||
return PL_DHASH_NEXT;
|
||||
@ -65,7 +65,7 @@ StartPlayerAtTime(nsRefPtrHashKey<dom::AnimationPlayer>* aKey,
|
||||
|
||||
Nullable<TimeDuration> readyTime =
|
||||
timeline->ToTimelineTime(*static_cast<const TimeStamp*>(aReadyTime));
|
||||
player->StartOnNextTick(readyTime);
|
||||
player->TriggerOnNextTick(readyTime);
|
||||
|
||||
return PL_DHASH_REMOVE;
|
||||
}
|
||||
@ -74,21 +74,21 @@ void
|
||||
PendingPlayerTracker::TriggerPendingPlayersOnNextTick(const TimeStamp&
|
||||
aReadyTime)
|
||||
{
|
||||
mPlayPendingSet.EnumerateEntries(StartPlayerAtTime,
|
||||
mPlayPendingSet.EnumerateEntries(TriggerPlayerAtTime,
|
||||
const_cast<TimeStamp*>(&aReadyTime));
|
||||
}
|
||||
|
||||
PLDHashOperator
|
||||
StartPlayerNow(nsRefPtrHashKey<dom::AnimationPlayer>* aKey, void*)
|
||||
TriggerPlayerNow(nsRefPtrHashKey<dom::AnimationPlayer>* aKey, void*)
|
||||
{
|
||||
aKey->GetKey()->StartNow();
|
||||
aKey->GetKey()->TriggerNow();
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
void
|
||||
PendingPlayerTracker::TriggerPendingPlayersNow()
|
||||
{
|
||||
mPlayPendingSet.EnumerateEntries(StartPlayerNow, nullptr);
|
||||
mPlayPendingSet.EnumerateEntries(TriggerPlayerNow, nullptr);
|
||||
mPlayPendingSet.Clear();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user