Bug 47302

Summary: Treat GIFs with no loop count as "loop once"
Product: WebKit Reporter: Peter Kasting <pkasting>
Component: ImagesAssignee: Peter Kasting <pkasting>
Severity: Normal CC: commit-queue
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: All   
Description Flags
patch v1
jamesr: review-
patch with test none

Description Peter Kasting 2010-10-06 14:04:32 PDT
While decoding GIFs with no loop count, we treat them as "loop once".  But, due to an oversight, when we reach the end and still haven't seen the loop count, we think the loop count is the internally-used value "-2" ("not seen"), which the animation code in BitmapImage.cpp interprets as "don't animate".

This means that, after the GIF animates, if script then changes another <img>'s "src" to point at it, it will display the first frame and stop instead of looping once.
Comment 1 Peter Kasting 2010-10-06 14:09:17 PDT
Created attachment 69987 [details]
patch v1

Simple fix.

I haven't had time to create a good layout test.  Testing this will be a little tricky; I'll need to create a custom 2-frame GIF with no loop count and write a pixel test based on based on the "index.html" reduction in http://crbug.com/56077 .
Comment 2 James Robinson 2010-10-06 16:40:50 PDT
Comment on attachment 69987 [details]
patch v1

This really should have a test.  I don't think the bug fix is so critical that it should land untested.
Comment 3 Peter Kasting 2010-10-29 12:06:40 PDT
Created attachment 72361 [details]
patch with test

Same as the above patch, but this time with a test.
Comment 4 Adam Barth 2010-10-31 18:04:33 PDT
Comment on attachment 72361 [details]
patch with test

Yay tests.
Comment 5 WebKit Commit Bot 2010-10-31 19:04:42 PDT
Comment on attachment 72361 [details]
patch with test

Clearing flags on attachment: 72361

Committed r71001: <http://trac.webkit.org/changeset/71001>
Comment 6 WebKit Commit Bot 2010-10-31 19:04:46 PDT
All reviewed patches have been landed.  Closing bug.