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 305894 b979622ece878a5eceb812a7ded7bad6fe8acbb1
parent 305893 1f2c834df0db955921199939b3977829f976ad1f
child 305895 3760df5754587ef476f339032068eb22b682c87e
push id79704
push usermfowler@mozilla.com
push dateWed, 20 Jul 2016 23:31:20 +0000
treeherdermozilla-inbound@6bb7f6c316bb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersedwin
bugs1288040
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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();