Bug 1411318 - Don't consider an animation playing if its timeline is inactive; r=hiro

When we receive animations on the compositor, we assert that either they're not
playing, or they have a resolved start and origin time.

However, on the main thread we determine if an animation is playing by checking
if it has a timeline, if it's in the correct state, and if it has a non-zero
playback rate.

The problem with this check is that if an animation has a timeline but it is
inactive, that is, its current time is null, we will not be able to get
a resolved origin time -- yet we will still report that is is playing.

This patch fixes this mismatch by treating animations with an inactive timeline
as "not playing".

The IsPlaying() method is used a number of call sites but it appears that they
all would expect an animation with an inactive timeline to be considered "not
playing". Furthermore, this makes IsPlaying() consistent with the check we do
for an active timeline in other functions such as Animation::Tick(),
TriggerNow(), SilentlySetCurrentTime(), UpdateFinishedState(),
and IsPossibleOrphanedPendingAnimation().


MozReview-Commit-ID: BQOBpHHFMoD

--HG--
extra : rebase_source : e84a50a16a61d48553610cb7ea0863f09ba86c60
This commit is contained in:
Brian Birtles 2017-10-26 10:18:42 +09:00
Родитель 41a2709293
Коммит 525200b457
3 изменённых файлов: 17 добавлений и 0 удалений

Просмотреть файл

@ -280,6 +280,7 @@ public:
{
return mPlaybackRate != 0.0 &&
mTimeline &&
!mTimeline->GetCurrentTime().IsNull() &&
(PlayState() == AnimationPlayState::Running ||
mPendingState == PendingState::PlayPending);
}

Просмотреть файл

@ -0,0 +1,15 @@
<html>
<head>
<script>
o1 = (new DOMParser).parseFromString('', 'text/html');
o2 = document.createElement('canvas');
document.documentElement.appendChild(o2);
o3 = o2.animate([{'transform':'unset'}], {'delay':32});
o4 = o3.effect;
o5 = o1.createElement('d');
o6 = new Animation(o4, document.timeline);
o7 = o5.animate([], {});
o7.effect = o6.effect;
</script>
</head>
</html>

Просмотреть файл

@ -37,3 +37,4 @@ pref(dom.animations-api.core.enabled,true) load 1379606-1.html
pref(dom.animations-api.core.enabled,true) load 1393605-1.html
load 1400022-1.html
pref(dom.animations-api.core.enabled,true) load 1401809.html
pref(dom.animations-api.core.enabled,true) load 1411318-1.html