Bug 916602 (Part 1) - Avoid null timestamp assertion in FrameAnimator::GetCurrentImgFrameEndTime. r=seth

This commit is contained in:
Simon Lindholm 2013-09-20 14:12:10 +02:00
Родитель 0790196f1e
Коммит 143a35631c
3 изменённых файлов: 29 добавлений и 30 удалений

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

@ -136,7 +136,6 @@ ImageResource::EvaluateAnimation()
mAnimating = NS_SUCCEEDED(rv); mAnimating = NS_SUCCEEDED(rv);
} else if (mAnimating && !ShouldAnimate()) { } else if (mAnimating && !ShouldAnimate()) {
StopAnimation(); StopAnimation();
mAnimating = false;
} }
} }

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

@ -1436,12 +1436,13 @@ RasterImage::StartAnimation()
EnsureAnimExists(); EnsureAnimExists();
imgFrame* currentFrame = GetCurrentImgFrame(); imgFrame* currentFrame = GetCurrentImgFrame();
if (currentFrame) { // A timeout of -1 means we should display this frame forever.
if (currentFrame->GetTimeout() < 0) { // -1 means display this frame forever if (currentFrame && currentFrame->GetTimeout() < 0) {
mAnimationFinished = true; mAnimationFinished = true;
return NS_ERROR_ABORT; return NS_ERROR_ABORT;
} }
if (mAnim) {
// We need to set the time that this initial frame was first displayed, as // We need to set the time that this initial frame was first displayed, as
// this is used in AdvanceFrame(). // this is used in AdvanceFrame().
mAnim->InitAnimationFrameTimeIfNecessary(); mAnim->InitAnimationFrameTimeIfNecessary();
@ -1457,12 +1458,15 @@ RasterImage::StopAnimation()
{ {
NS_ABORT_IF_FALSE(mAnimating, "Should be animating!"); NS_ABORT_IF_FALSE(mAnimating, "Should be animating!");
if (mError) nsresult rv = NS_OK;
return NS_ERROR_FAILURE; if (mError) {
rv = NS_ERROR_FAILURE;
} else {
mAnim->SetAnimationFrameTime(TimeStamp());
}
mAnim->SetAnimationFrameTime(TimeStamp()); mAnimating = false;
return rv;
return NS_OK;
} }
//****************************************************************************** //******************************************************************************
@ -1483,9 +1487,7 @@ RasterImage::ResetAnimation()
StopAnimation(); StopAnimation();
mFrameBlender.ResetAnimation(); mFrameBlender.ResetAnimation();
if (mAnim) { mAnim->ResetAnimation();
mAnim->ResetAnimation();
}
UpdateImageContainer(); UpdateImageContainer();
@ -1498,13 +1500,9 @@ RasterImage::ResetAnimation()
mStatusTracker->FrameChanged(&rect); mStatusTracker->FrameChanged(&rect);
} }
if (ShouldAnimate()) { // Start the animation again. It may not have been running before, if
StartAnimation(); // mAnimationFinished was true before entering this function.
// The animation may not have been running before, if mAnimationFinished EvaluateAnimation();
// was false (before we changed it to true in this function). So, mark the
// animation as running.
mAnimating = true;
}
return NS_OK; return NS_OK;
} }
@ -1573,10 +1571,8 @@ RasterImage::AddSourceData(const char *aBuffer, uint32_t aCount)
// so that there's no gap for anything to miss us. // so that there's no gap for anything to miss us.
if (mMultipart && mBytesDecoded == 0) { if (mMultipart && mBytesDecoded == 0) {
// Our previous state may have been animated, so let's clean up // Our previous state may have been animated, so let's clean up
if (mAnimating) { if (mAnimating)
StopAnimation(); StopAnimation();
mAnimating = false;
}
mAnimationFinished = false; mAnimationFinished = false;
if (mAnim) { if (mAnim) {
delete mAnim; delete mAnim;

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

@ -432,14 +432,18 @@ VectorImage::StartAnimation()
nsresult nsresult
VectorImage::StopAnimation() VectorImage::StopAnimation()
{ {
if (mError) nsresult rv = NS_OK;
return NS_ERROR_FAILURE; if (mError) {
rv = NS_ERROR_FAILURE;
} else {
MOZ_ASSERT(mIsFullyLoaded && mHaveAnimations,
"Should not have been animating!");
MOZ_ASSERT(mIsFullyLoaded && mHaveAnimations, mSVGDocumentWrapper->StopAnimation();
"Should not have been animating!"); }
mSVGDocumentWrapper->StopAnimation(); mAnimating = false;
return NS_OK; return rv;
} }
bool bool