Bug 47302 - Treat GIFs with no loop count as "loop once"
Summary: Treat GIFs with no loop count as "loop once"
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC All
: P2 Normal
Assignee: Peter Kasting
Depends on:
Reported: 2010-10-06 14:04 PDT by Peter Kasting
Modified: 2010-10-31 19:04 PDT (History)
1 user (show)

See Also:

patch v1 (3.46 KB, patch)
2010-10-06 14:09 PDT, Peter Kasting
jamesr: review-
Details | Formatted Diff | Diff
patch with test (12.39 KB, patch)
2010-10-29 12:06 PDT, Peter Kasting
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.