Changeset 71001 in webkit


Ignore:
Timestamp:
Oct 31, 2010 7:04:27 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2010-10-31 Peter Kasting <pkasting@google.com>

Reviewed by Adam Barth.

Treat GIFs with no loop count as "loop once".
https://bugs.webkit.org/show_bug.cgi?id=47302

  • fast/images/gif-loop-count-expected.checksum: Added.
  • fast/images/gif-loop-count-expected.png: Added.
  • fast/images/gif-loop-count-expected.txt: Added.
  • fast/images/gif-loop-count.html: Added.
  • fast/images/resources/gif-loop-count.gif: Added.
  • fast/images/resources/gif-loop-count.png: Added.

2010-10-31 Peter Kasting <pkasting@google.com>

Reviewed by Adam Barth.

Treat GIFs with no loop count as "loop once".
https://bugs.webkit.org/show_bug.cgi?id=47302

Test: fast/images/gif-loop-count.html

  • platform/image-decoders/gif/GIFImageDecoder.cpp: (WebCore::GIFImageDecoder::repetitionCount): (WebCore::GIFImageDecoder::gifComplete):
Location:
trunk
Files:
6 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r70998 r71001  
     12010-10-31  Peter Kasting  <pkasting@google.com>
     2
     3        Reviewed by Adam Barth.
     4
     5        Treat GIFs with no loop count as "loop once".
     6        https://bugs.webkit.org/show_bug.cgi?id=47302
     7
     8        * fast/images/gif-loop-count-expected.checksum: Added.
     9        * fast/images/gif-loop-count-expected.png: Added.
     10        * fast/images/gif-loop-count-expected.txt: Added.
     11        * fast/images/gif-loop-count.html: Added.
     12        * fast/images/resources/gif-loop-count.gif: Added.
     13        * fast/images/resources/gif-loop-count.png: Added.
     14
    1152010-10-31  James Simonsen  <simonjam@chromium.org>
    216
  • trunk/WebCore/ChangeLog

    r71000 r71001  
     12010-10-31  Peter Kasting  <pkasting@google.com>
     2
     3        Reviewed by Adam Barth.
     4
     5        Treat GIFs with no loop count as "loop once".
     6        https://bugs.webkit.org/show_bug.cgi?id=47302
     7
     8        Test: fast/images/gif-loop-count.html
     9
     10        * platform/image-decoders/gif/GIFImageDecoder.cpp:
     11        (WebCore::GIFImageDecoder::repetitionCount):
     12        (WebCore::GIFImageDecoder::gifComplete):
     13
    1142010-10-31  No'am Rosenthal  <noam.rosenthal@nokia.com>
    215
  • trunk/WebCore/platform/image-decoders/gif/GIFImageDecoder.cpp

    r68564 r71001  
    9797    // in the wild declare it near the beginning of the file, so it usually is
    9898    // set by the time we've decoded the size, but (depending on the GIF and the
    99     // packets sent back by the webserver) not always.  Our caller is
    100     // responsible for waiting until image decoding has finished to ask this if
    101     // it needs an authoritative answer.  In the meantime, we should default to
    102     // "loop once".
    103     if (m_reader) {
    104         // Added wrinkle: ImageSource::clear() may destroy the reader, making
    105         // the result from the reader _less_ authoritative on future calls.  To
    106         // detect this, the reader returns cLoopCountNotSeen (-2) instead of
    107         // cAnimationLoopOnce (0) when its current incarnation hasn't actually
    108         // seen a loop count yet; in this case we return our previously-cached
    109         // value.
    110         const int repetitionCount = m_reader->loop_count;
    111         if (repetitionCount != cLoopCountNotSeen)
    112             m_repetitionCount = repetitionCount;
    113     }
     99    // packets sent back by the webserver) not always.  If the reader hasn't
     100    // seen a loop count yet, it will return cLoopCountNotSeen, in which case we
     101    // should default to looping once (the initial value for
     102    // |m_repetitionCount|).
     103    //
     104    // There are two additional wrinkles here.  First, ImageSource::clear() may
     105    // destroy the reader, making the result from the reader _less_
     106    // authoritative on future calls if the recreated reader hasn't seen the
     107    // loop count.  We don't need to special-case this because in this case the
     108    // new reader will once again return cLoopCountNotSeen, and we won't
     109    // overwrite the cached correct value.
     110    //
     111    // Second, a GIF might never set a loop count at all, in which case we
     112    // should continue to treat it as a "loop once" animation.  We don't need
     113    // special code here either, because in this case we'll never change
     114    // |m_repetitionCount| from its default value.
     115    if (m_reader && (m_reader->loop_count != cLoopCountNotSeen))
     116        m_repetitionCount = m_reader->loop_count;
    114117    return m_repetitionCount;
    115118}
     
    296299void GIFImageDecoder::gifComplete()
    297300{
    298     if (m_reader)
    299         m_repetitionCount = m_reader->loop_count;
     301    // Cache the repetition count, which is now as authoritative as it's ever
     302    // going to be.
     303    repetitionCount();
     304
    300305    m_reader.clear();
    301306}
Note: See TracChangeset for help on using the changeset viewer.