Bug 1073336 part 7 - Move style flushing to CSSAnimationPlayer and CSSTransitionPlayer; r=dbaron
Previously AnimationPlayer::Play() and AnimationPlayer::PlayState() would flush styles as part of their operation. This, however, is only needed when the player corresponds to a CSS Animation or CSS Transition. Now that we have concrete subclasses for each of these cases we can move style flushing to the subclasses and remove it from the base class (which is expected to be shared with animations that are not dependent on style).
This commit is contained in:
@@ -115,31 +115,9 @@ AnimationPlayer::GetCurrentTimeAsDouble() const
|
||||
return AnimationUtils::TimeDurationToDouble(GetCurrentTime());
|
||||
}
|
||||
|
||||
AnimationPlayState
|
||||
AnimationPlayer::PlayStateFromJS() const
|
||||
{
|
||||
// FIXME: Once we introduce CSSTransitionPlayer, this should move to an
|
||||
// override of PlayStateFromJS in CSSAnimationPlayer and CSSTransitionPlayer
|
||||
// and we should skip it in the general case.
|
||||
FlushStyle();
|
||||
|
||||
return PlayState();
|
||||
}
|
||||
|
||||
void
|
||||
AnimationPlayer::PlayFromJS()
|
||||
{
|
||||
// Flush style to ensure that any properties controlling animation state
|
||||
// (e.g. animation-play-state) are fully updated before we proceed.
|
||||
//
|
||||
// Note that this might trigger PlayFromStyle()/PauseFromStyle() on this
|
||||
// object.
|
||||
//
|
||||
// FIXME: Once we introduce CSSTransitionPlayer, this should move to an
|
||||
// override of PlayFromJS in CSSAnimationPlayer and CSSTransitionPlayer and
|
||||
// we should skip it in the general case.
|
||||
FlushStyle();
|
||||
|
||||
Play(eUpdateStyle);
|
||||
}
|
||||
|
||||
|
||||
@@ -78,8 +78,8 @@ public:
|
||||
// script but when called from script we perform extra steps such
|
||||
// as flushing style or converting the return type.
|
||||
Nullable<double> GetCurrentTimeAsDouble() const;
|
||||
AnimationPlayState PlayStateFromJS() const;
|
||||
void PlayFromJS();
|
||||
virtual AnimationPlayState PlayStateFromJS() const { return PlayState(); }
|
||||
virtual void PlayFromJS();
|
||||
void PauseFromJS();
|
||||
|
||||
void SetSource(Animation* aSource);
|
||||
|
||||
@@ -41,6 +41,24 @@ CSSAnimationPlayer::Pause(UpdateFlags aUpdateFlags)
|
||||
AnimationPlayer::Pause(aUpdateFlags);
|
||||
}
|
||||
|
||||
mozilla::dom::AnimationPlayState
|
||||
CSSAnimationPlayer::PlayStateFromJS() const
|
||||
{
|
||||
// Flush style to ensure that any properties controlling animation state
|
||||
// (e.g. animation-play-state) are fully updated.
|
||||
FlushStyle();
|
||||
return AnimationPlayer::PlayStateFromJS();
|
||||
}
|
||||
|
||||
void
|
||||
CSSAnimationPlayer::PlayFromJS()
|
||||
{
|
||||
// Note that flushing style below might trigger calls to
|
||||
// PlayFromStyle()/PauseFromStyle() on this object.
|
||||
FlushStyle();
|
||||
AnimationPlayer::PlayFromJS();
|
||||
}
|
||||
|
||||
void
|
||||
CSSAnimationPlayer::PlayFromStyle()
|
||||
{
|
||||
|
||||
@@ -66,6 +66,9 @@ public:
|
||||
virtual void Play(UpdateFlags aUpdateFlags) MOZ_OVERRIDE;
|
||||
virtual void Pause(UpdateFlags aUpdateFlags) MOZ_OVERRIDE;
|
||||
|
||||
virtual dom::AnimationPlayState PlayStateFromJS() const MOZ_OVERRIDE;
|
||||
virtual void PlayFromJS() MOZ_OVERRIDE;
|
||||
|
||||
void PlayFromStyle();
|
||||
void PauseFromStyle();
|
||||
|
||||
|
||||
@@ -70,6 +70,24 @@ ElementPropertyTransition::CurrentValuePortion() const
|
||||
.GetValue(computedTiming.mTimeFraction);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* CSSTransitionPlayer *
|
||||
*****************************************************************************/
|
||||
|
||||
mozilla::dom::AnimationPlayState
|
||||
CSSTransitionPlayer::PlayStateFromJS() const
|
||||
{
|
||||
FlushStyle();
|
||||
return AnimationPlayer::PlayStateFromJS();
|
||||
}
|
||||
|
||||
void
|
||||
CSSTransitionPlayer::PlayFromJS()
|
||||
{
|
||||
FlushStyle();
|
||||
AnimationPlayer::PlayFromJS();
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* nsTransitionManager *
|
||||
*****************************************************************************/
|
||||
|
||||
@@ -76,6 +76,9 @@ public:
|
||||
virtual CSSTransitionPlayer*
|
||||
AsCSSTransitionPlayer() MOZ_OVERRIDE { return this; }
|
||||
|
||||
virtual dom::AnimationPlayState PlayStateFromJS() const MOZ_OVERRIDE;
|
||||
virtual void PlayFromJS() MOZ_OVERRIDE;
|
||||
|
||||
protected:
|
||||
virtual ~CSSTransitionPlayer() { }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user