Bug 1109390 part 16 - Update IsCurrent to take a player parameter; r=jwatt

In preparation for introducing IsInPlay (where "in play" is a term in the Web
Animations spec), this patch aligns the existing IsCurrent with the definition
in the spec that says an animation effect is only current if it is attached
to an animation (player in our current naming) that is not finished. In order
to ensure that we need to pass the animation/player into the method.

This actually changes the behavior of IsCurrent since now we will return false
for animations that are finished. As far as I can tell, all the call sites that
are requesting current animations should only be concerned with animations that
are actually running. If not, they need to be adjusted to look for animations
that are either current or in effect.
This commit is contained in:
Brian Birtles 2015-03-27 17:44:38 +09:00
Родитель 44a6617223
Коммит a7e4fac5e7
4 изменённых файлов: 11 добавлений и 6 удалений

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

@ -229,10 +229,12 @@ Animation::ActiveDuration(const AnimationTiming& aTiming)
aTiming.mIterationDuration.MultDouble(aTiming.mIterationCount));
}
// http://w3c.github.io/web-animations/#current
bool
Animation::IsCurrent() const
Animation::IsCurrent(const AnimationPlayer& aPlayer) const
{
if (IsFinishedTransition()) {
if (IsFinishedTransition() ||
aPlayer.PlayState() == AnimationPlayState::Finished) {
return false;
}

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

@ -302,7 +302,7 @@ public:
mIsFinishedTransition = true;
}
bool IsCurrent() const;
bool IsCurrent(const AnimationPlayer& aPlayer) const;
bool IsInEffect() const;
const AnimationProperty*

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

@ -205,7 +205,7 @@ public:
bool HasCurrentSource() const
{
return GetSource() && GetSource()->IsCurrent();
return GetSource() && GetSource()->IsCurrent(*this);
}
bool HasInEffectSource() const
{

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

@ -854,8 +854,11 @@ AnimationPlayerCollection::HasCurrentAnimationsForProperty(nsCSSProperty
aProperty) const
{
for (size_t playerIdx = mPlayers.Length(); playerIdx-- != 0; ) {
const Animation* anim = mPlayers[playerIdx]->GetSource();
if (anim && anim->IsCurrent() && anim->HasAnimationOfProperty(aProperty)) {
const AnimationPlayer& player = *mPlayers[playerIdx];
const Animation* anim = player.GetSource();
if (anim &&
anim->IsCurrent(player) &&
anim->HasAnimationOfProperty(aProperty)) {
return true;
}
}