Bug 885277 - Fix animation timing and resetAnimation in the presence of changing animationMode

This commit is contained in:
Simon Lindholm 2013-08-14 12:29:55 +02:00
parent 3bfcccec9b
commit 9e116dddaa
3 changed files with 11 additions and 13 deletions

View File

@ -218,11 +218,9 @@ FrameAnimator::SetAnimationMode(uint16_t aAnimationMode)
}
void
FrameAnimator::InitAnimationFrameTimeIfNecessary()
FrameAnimator::InitAnimationFrameTime()
{
if (mCurrentAnimationFrameTime.IsNull()) {
mCurrentAnimationFrameTime = TimeStamp::Now();
}
mCurrentAnimationFrameTime = TimeStamp::Now();
}
void

View File

@ -99,10 +99,9 @@ public:
void UnionFirstFrameRefreshArea(const nsIntRect& aRect);
/**
* If the animation frame time has not yet been set, set it to
* TimeStamp::Now().
* Set the animation frame time to TimeStamp::Now().
*/
void InitAnimationFrameTimeIfNecessary();
void InitAnimationFrameTime();
/**
* Set the animation frame time to @aTime.

View File

@ -529,12 +529,12 @@ RasterImage::Init(const char* aMimeType,
NS_IMETHODIMP_(void)
RasterImage::RequestRefresh(const mozilla::TimeStamp& aTime)
{
if (!ShouldAnimate()) {
EvaluateAnimation();
if (!mAnimating) {
return;
}
EvaluateAnimation();
FrameAnimator::RefreshResult res;
if (mAnim) {
res = mAnim->RequestRefresh(aTime);
@ -1441,7 +1441,8 @@ RasterImage::StartAnimation()
// We need to set the time that this initial frame was first displayed, as
// this is used in AdvanceFrame().
mAnim->InitAnimationFrameTimeIfNecessary();
if (!mAnimating)
mAnim->InitAnimationFrameTime();
}
return NS_OK;
@ -1487,8 +1488,8 @@ RasterImage::ResetAnimation()
// Note - We probably want to kick off a redecode somewhere around here when
// we fix bug 500402.
// Update display if we were animating before
if (mAnimating && mStatusTracker) {
// Update display
if (mStatusTracker) {
nsIntRect rect = mAnim->GetFirstFrameRefreshArea();
mStatusTracker->FrameChanged(&rect);
}