Bug 1288040 (Part 4) - We only need to check for infinitely long frames in StartAnimation() for the first frame. r=edwin
authorSeth Fowler <mark.seth.fowler@gmail.com>
Tue, 19 Jul 2016 13:45:35 -0700
changeset 331022 b979622ece878a5eceb812a7ded7bad6fe8acbb1
parent 331021 1f2c834df0db955921199939b3977829f976ad1f
child 331023 3760df5754587ef476f339032068eb22b682c87e
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersedwin
bugs1288040
milestone50.0a1
Bug 1288040 (Part 4) - We only need to check for infinitely long frames in StartAnimation() for the first frame. r=edwin
image/RasterImage.cpp
--- a/image/RasterImage.cpp
+++ b/image/RasterImage.cpp
@@ -919,20 +919,20 @@ RasterImage::StartAnimation()
   mPendingAnimation = !mAnimationState || GetNumFrames() < 2;
   if (mPendingAnimation) {
     return NS_OK;
   }
 
   MOZ_ASSERT(mFrameAnimator,
              "Should have a FrameAnimator if we have AnimationState");
 
-  // A timeout of -1 means we should display this frame forever.
-  if (mFrameAnimator->GetTimeoutForFrame(*mAnimationState,
-                                         GetCurrentFrameIndex())
-        < 0) {
+  // If the first frame has a timeout of -1, it means we should display it
+  // forever. Don't bother starting to animate in this case.
+  if (GetCurrentFrameIndex() == 0 &&
+      mFrameAnimator->GetTimeoutForFrame(*mAnimationState, 0) < 0) {
     mAnimationFinished = true;
     return NS_ERROR_ABORT;
   }
 
   // We need to set the time that this initial frame was first displayed, as
   // this is used in AdvanceFrame().
   mAnimationState->InitAnimationFrameTimeIfNecessary();