Changeset 47042 in webkit


Ignore:
Timestamp:
Aug 11, 2009 12:00:05 PM (15 years ago)
Author:
pkasting@chromium.org
Message:

WebCore: https://bugs.webkit.org/show_bug.cgi?id=28073
Treat icons with no bit count and no color count as 256-color for
purposes of quality ranking. Also fix a couple cases of a style
violation.

Reviewed by Eric Seidel.

Test: fast/images/icon-0colors.html

  • platform/image-decoders/ico/ICOImageDecoder.cpp:

(WebCore::ICOImageDecoder::processDirectory):
(WebCore::ICOImageDecoder::readDirectoryEntry):

LayoutTests: https://bugs.webkit.org/show_bug.cgi?id=28073
Treat icons with no bit count and no color count as 256-color for
purposes of quality ranking.

Reviewed by Eric Seidel.

  • fast/images/icon-0colors.html: Added.
  • fast/images/resources/0colors.ico: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r47039 r47042  
     12009-08-07  Peter Kasting  <pkasting@google.com>
     2
     3        Reviewed by Eric Seidel.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=28073
     6        Treat icons with no bit count and no color count as 256-color for
     7        purposes of quality ranking.
     8
     9        * fast/images/icon-0colors.html: Added.
     10        * fast/images/resources/0colors.ico: Added.
     11
    1122009-08-11  Dmitry Titov  <dimich@chromium.org>
    213
  • trunk/WebCore/ChangeLog

    r47036 r47042  
     12009-08-07  Peter Kasting  <pkasting@google.com>
     2
     3        Reviewed by Eric Seidel.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=28073
     6        Treat icons with no bit count and no color count as 256-color for
     7        purposes of quality ranking.  Also fix a couple cases of a style
     8        violation.
     9
     10        Test: fast/images/icon-0colors.html
     11
     12        * platform/image-decoders/ico/ICOImageDecoder.cpp:
     13        (WebCore::ICOImageDecoder::processDirectory):
     14        (WebCore::ICOImageDecoder::readDirectoryEntry):
     15
    1162009-08-11  Drew Wilson  <atwilson@google.com>
    217
  • trunk/WebCore/platform/image-decoders/ico/ICOImageDecoder.cpp

    r46814 r47042  
    250250        CURSOR = 2,
    251251    };
    252     if (((fileType != ICON) && (fileType != CURSOR)) || (idCount == 0)) {
     252    if (((fileType != ICON) && (fileType != CURSOR)) || (!idCount)) {
    253253        setFailed();
    254254        return false;
     
    304304    // what a zero byte really means).
    305305    int width = static_cast<uint8_t>(m_data->data()[m_decodedOffset]);
    306     if (width == 0)
     306    if (!width)
    307307        width = 256;
    308308    int height = static_cast<uint8_t>(m_data->data()[m_decodedOffset + 1]);
    309     if (height == 0)
     309    if (!height)
    310310        height = 256;
    311311    IconDirectoryEntry entry;
     
    319319    // this value to determine which icon entry is best.
    320320    if (!entry.m_bitCount) {
    321         uint8_t colorCount = m_data->data()[m_decodedOffset + 2];
    322         if (colorCount) {
    323             for (--colorCount; colorCount; colorCount >>= 1)
    324                 ++entry.m_bitCount;
    325         }
     321        int colorCount =
     322            static_cast<uint8_t>(m_data->data()[m_decodedOffset + 2]);
     323        if (!colorCount)
     324            colorCount = 256;  // Vague in the spec, needed by real-world icons.
     325        for (--colorCount; colorCount; colorCount >>= 1)
     326            ++entry.m_bitCount;
    326327    }
    327328
Note: See TracChangeset for help on using the changeset viewer.