Bug 1081007 - Fix relationship between Play/PlayFromJS/PlayFromStyle etc.; r=dholbert

The existing relationship between the particular versions of
AnimationPlayer::Play* (particularly in the CSSAnimationPlayer) subclass are
confusing because, for example, CSSAnimationPlayer::PlayFromStyle needs to be
careful to *not* call Play on CSSAnimationPlayer, but only on the parent
object (since otherwise we reset the sticky pause behavior).

This patch reworks this relationship by adding a protected DoPlay method that
performs the common pausing behavior. Play/PlayFromJS/PlayFromStyle then add
flushing, sticky pausing etc. as necessary.

This patch also removes the UpdateFlags enum and parameters previously used to
control whether we forced an update to style. This is no longer necessary since
we no longer call 'Play' from style. Instead we make Play always post restyles.

If we come across a case where we want to call Play and *not* post restyles, we
can re-add the flags then.

Roughly the same arrangement is true for Pause except that we don't currently
flush styles for CSS animations in PauseFromJS since it currently won't make any
observable difference.
This commit is contained in:
Brian Birtles
2014-11-17 13:46:01 +09:00
parent 3307c6ed04
commit fe23f2815f
4 changed files with 65 additions and 58 deletions

View File

@@ -28,17 +28,17 @@ using mozilla::dom::AnimationPlayer;
using mozilla::CSSAnimationPlayer;
void
CSSAnimationPlayer::Play(UpdateFlags aUpdateFlags)
CSSAnimationPlayer::Play()
{
mPauseShouldStick = false;
AnimationPlayer::Play(aUpdateFlags);
AnimationPlayer::Play();
}
void
CSSAnimationPlayer::Pause(UpdateFlags aUpdateFlags)
CSSAnimationPlayer::Pause()
{
mPauseShouldStick = true;
AnimationPlayer::Pause(aUpdateFlags);
AnimationPlayer::Pause();
}
mozilla::dom::AnimationPlayState
@@ -64,7 +64,7 @@ CSSAnimationPlayer::PlayFromStyle()
{
mIsStylePaused = false;
if (!mPauseShouldStick) {
AnimationPlayer::Play(eNoUpdate);
DoPlay();
}
}
@@ -77,7 +77,7 @@ CSSAnimationPlayer::PauseFromStyle()
}
mIsStylePaused = true;
AnimationPlayer::Pause(eNoUpdate);
DoPause();
}
void