diff --git a/gfx/src/shared/gfxImageFrame.cpp b/gfx/src/shared/gfxImageFrame.cpp index 89e7831702b7..75819b6be151 100644 --- a/gfx/src/shared/gfxImageFrame.cpp +++ b/gfx/src/shared/gfxImageFrame.cpp @@ -348,7 +348,10 @@ NS_IMETHODIMP gfxImageFrame::GetTimeout(PRInt32 *aTimeout) if (!mInitalized) return NS_ERROR_NOT_INITIALIZED; - *aTimeout = mTimeout; + if (mTimeout == 0) + *aTimeout = 100; // Ensure a minimal time between updates so we don't throttle the UI thread. + else + *aTimeout = mTimeout; return NS_OK; } diff --git a/gfx2/src/gfxImageFrame.cpp b/gfx2/src/gfxImageFrame.cpp index 89e7831702b7..75819b6be151 100644 --- a/gfx2/src/gfxImageFrame.cpp +++ b/gfx2/src/gfxImageFrame.cpp @@ -348,7 +348,10 @@ NS_IMETHODIMP gfxImageFrame::GetTimeout(PRInt32 *aTimeout) if (!mInitalized) return NS_ERROR_NOT_INITIALIZED; - *aTimeout = mTimeout; + if (mTimeout == 0) + *aTimeout = 100; // Ensure a minimal time between updates so we don't throttle the UI thread. + else + *aTimeout = mTimeout; return NS_OK; } diff --git a/modules/libpr0n/src/imgContainer.cpp b/modules/libpr0n/src/imgContainer.cpp index 2170dc64e1f7..5fc00cc767b1 100644 --- a/modules/libpr0n/src/imgContainer.cpp +++ b/modules/libpr0n/src/imgContainer.cpp @@ -174,8 +174,7 @@ NS_IMETHODIMP imgContainer::AppendFrame(gfxIImageFrame *item) nsCOMPtr currentFrame; this->GetFrameAt(mCurrentDecodingFrameIndex, getter_AddRefs(currentFrame)); currentFrame->GetTimeout(&timeout); - if (timeout != -1 && - timeout >= 0) { // -1 means display this frame forever + if (timeout > 0) { // -1 means display this frame forever if(mAnimating) { // Since we have more than one frame we need a timer @@ -216,8 +215,7 @@ NS_IMETHODIMP imgContainer::EndFrameDecode(PRUint32 aFrameNum, PRUint32 aTimeout PRUint32 numFrames; this->GetNumFrames(&numFrames); if (numFrames > 1) { - if (aTimeout != -1 && - aTimeout >= 0) { // -1 means display this frame forever + if (aTimeout > 0) { // -1 means display this frame forever mAnimating = PR_TRUE; mTimer = do_CreateInstance("@mozilla.org/timer;1"); @@ -269,8 +267,7 @@ NS_IMETHODIMP imgContainer::StartAnimation() this->GetCurrentFrame(getter_AddRefs(currentFrame)); if (currentFrame) { currentFrame->GetTimeout(&timeout); - if (timeout != -1 && - timeout >= 0) { // -1 means display this frame forever + if (timeout > 0) { // -1 means display this frame forever mAnimating = PR_TRUE; if(!mTimer) mTimer = do_CreateInstance("@mozilla.org/timer;1"); @@ -381,7 +378,7 @@ NS_IMETHODIMP_(void) imgContainer::Notify(nsITimer *timer) if(!nextFrame) return; } - if(timeout >= 0) + if(timeout > 0) mTimer->SetDelay(timeout); else this->StopAnimation();