зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
44a6617223
Коммит
a7e4fac5e7
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче