Changeset 122269 in webkit


Ignore:
Timestamp:
Jul 10, 2012 3:11:54 PM (12 years ago)
Author:
kseo@webkit.org
Message:

Fix a potential bug of BitmapImage::frameCount().
https://bugs.webkit.org/show_bug.cgi?id=90756

Patch by Huang Dongsung <luxtella@company100.net> on 2012-07-10
Reviewed by Simon Fraser.

If an ImageDecoder is not yet initialized, m_source.frameCount() returns 0. This
does not mean that the frame count is actually 0. So we must set
m_haveFrameCount to true only when m_frameCount is not 0.

The current code is okay because BitmapImage::frameCount() is never called
before the decoder is initialized. However, this no longer holds true once we
introduce parallel image decoders.

No new tests, no behavior change.

  • platform/graphics/BitmapImage.cpp:

(WebCore::BitmapImage::frameCount):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r122268 r122269  
     12012-07-10  Huang Dongsung  <luxtella@company100.net>
     2
     3        Fix a potential bug of BitmapImage::frameCount().
     4        https://bugs.webkit.org/show_bug.cgi?id=90756
     5
     6        Reviewed by Simon Fraser.
     7
     8        If an ImageDecoder is not yet initialized, m_source.frameCount() returns 0. This
     9        does not mean that the frame count is actually 0. So we must set
     10        m_haveFrameCount to true only when m_frameCount is not 0.
     11
     12        The current code is okay because BitmapImage::frameCount() is never called
     13        before the decoder is initialized. However, this no longer holds true once we
     14        introduce parallel image decoders.
     15
     16        No new tests, no behavior change.
     17
     18        * platform/graphics/BitmapImage.cpp:
     19        (WebCore::BitmapImage::frameCount):
     20
    1212012-07-10  Ojan Vafai  <ojan@chromium.org>
    222
  • trunk/Source/WebCore/platform/graphics/BitmapImage.cpp

    r121827 r122269  
    264264{
    265265    if (!m_haveFrameCount) {
    266         m_haveFrameCount = true;
    267266        m_frameCount = m_source.frameCount();
    268         didDecodeProperties();
     267        // If decoder is not initialized yet, m_source.frameCount() returns 0.
     268        if (m_frameCount) {
     269            didDecodeProperties();
     270            m_haveFrameCount = true;
     271        }
    269272    }
    270273    return m_frameCount;
Note: See TracChangeset for help on using the changeset viewer.