[Webkit-unassigned] [Bug 19273] New: BitmapImage.cpp erroneously assumes repetition count is available once size is available

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue May 27 11:51:56 PDT 2008


http://bugs.webkit.org/show_bug.cgi?id=19273

           Summary: BitmapImage.cpp erroneously assumes repetition count is
                    available once size is available
           Product: WebKit
           Version: 526+ (Nightly build)
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Images
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: zerodpx at gmail.com


BitmapImage.cpp:CacheFrame() sets m_repetitionCount during the first call to
it, assuming that the decoder can provide a valid repetition count.  And
GIFImageDecoder.cpp:repetitionCount() (which is not used in Safari) has a
comment that the repetition count is available once the image size is
available.

But, as far as I can tell from reading the GIF89a spec, this is not the case.

The loop count is contained in a Netscape Application Extension block, which,
according the the GIF grammar, can appear anywhere in the set of blocks that
makes up the "data" section (which extends nearly until the end of the file). 
So, in the worst case, the loop count is unavailable until you've actually
decoded the whole image.

The safest way to deal with this is as follows:
* Leave the existing call to get the repetition count in
BitmapImage::cacheFrame(), which will distinguish between GIF and non-animating
image formats, and will in many cases get the right repetition count
immediately.
* When deciding whether to advance the animation in
BitmapImage::startAnimation(), do not advance if the m_repetitionCount ==
cAnimationLoopOnce, m_AllDataReceived == false, and m_currentFrame >=
(frameCount() - 1).  This gives us time to get the true repetition count if it
appears at the end of the data stream, but does not hang the animation any more
than necessary (and no more than could currently happen).
* When advancing the animation in BitmapImage:advanceAnimation(), get the
repetition count again if we're advancing past the last frame, before deciding
whether the loop count has been reached.


-- 
Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list