Changeset 31224 in webkit


Ignore:
Timestamp:
Mar 21, 2008 5:39:07 PM (16 years ago)
Author:
weinig@apple.com
Message:

WebCore:

2008-03-21 Sam Weinig <sam@webkit.org>

Reviewed by Oliver Hunt.

Fix <rdar://problem/5788451>
toDataURL not implemented for Windows (need mapping of MIME type to UTI)

Hard code support for just PNG's on windows, the minimum the spec requires.

  • platform/MIMETypeRegistry.cpp: (WebCore::initializeSupportedImageMIMETypesForEncoding):
  • platform/graphics/cg/ImageBufferCG.cpp: (WebCore::utiFromMIMEType): (WebCore::ImageBuffer::toDataURL):

LayoutTests:

2008-03-21 Sam Weinig <sam@webkit.org>

Reviewed by Oliver Hunt.

Enable tests for <rdar://problem/5788451>
toDataURL not implemented for Windows (need mapping of MIME type to UTI)

  • platform/win/Skipped:
  • platform/win/fast/canvas: Added.
  • platform/win/fast/canvas/toDataURL-supportedTypes-expected.txt: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r31213 r31224  
     12008-03-21  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Enable tests for <rdar://problem/5788451>
     6        toDataURL not implemented for Windows (need mapping of MIME type to UTI)
     7
     8        * platform/win/Skipped:
     9        * platform/win/fast/canvas: Added.
     10        * platform/win/fast/canvas/toDataURL-supportedTypes-expected.txt: Added.
     11
    1122008-03-21  Dan Bernstein  <mitz@apple.com>
    213
  • trunk/LayoutTests/platform/win/Skipped

    r30899 r31224  
    326326svg/custom/acid3-test-77.html
    327327
    328 # <rdar://problem/5788451> toDataURL broke Windows build
    329 fast/canvas/toDataURL-noData.html
    330 fast/canvas/toDataURL-supportedTypes.html
    331 
    332328################################################################################
    333329####################### No bugs filed about the below yet#######################
  • trunk/WebCore/ChangeLog

    r31223 r31224  
     12008-03-21  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Fix <rdar://problem/5788451>
     6        toDataURL not implemented for Windows (need mapping of MIME type to UTI)
     7
     8        Hard code support for just PNG's on windows, the minimum the spec requires.
     9
     10        * platform/MIMETypeRegistry.cpp:
     11        (WebCore::initializeSupportedImageMIMETypesForEncoding):
     12        * platform/graphics/cg/ImageBufferCG.cpp:
     13        (WebCore::utiFromMIMEType):
     14        (WebCore::ImageBuffer::toDataURL):
     15
    1162008-03-21  Matt Lilek  <webkit@mattlilek.com>
    217
  • trunk/WebCore/platform/MIMETypeRegistry.cpp

    r30906 r31224  
    125125
    126126#if PLATFORM(CG)
     127#if PLATFORM(MAC)
    127128    RetainPtr<CFArrayRef> supportedTypes(AdoptCF, CGImageDestinationCopyTypeIdentifiers());
    128129    CFIndex count = CFArrayGetCount(supportedTypes.get());
     
    133134            supportedImageMIMETypesForEncoding->add(mimeType);
    134135    }
     136#else
     137    // FIXME: Add Windows support for all the supported UTI's when a way to convert from MIMEType to UTI reliably is found.
     138    // For now, only support PNG, the minimum that the spec requires.
     139    supportedImageMIMETypesForEncoding->add("image/png");
     140#endif
    135141#elif PLATFORM(QT)
    136142    QList<QByteArray> formats = QImageWriter::supportedImageFormats();
  • trunk/WebCore/platform/graphics/cg/ImageBufferCG.cpp

    r30901 r31224  
    216216}
    217217
     218static CFStringRef utiFromMIMEType(const String& mimeType)
     219{
     220#if PLATFORM(MAC)
     221    return UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, mimeType.createCFString(), 0);
     222#else
     223    // FIXME: Add Windows support for all the supported UTI's when a way to convert from MIMEType to UTI reliably is found.
     224    // For now, only support PNG, the minimum that the spec requires.
     225    ASSERT(equalIgnoringCase(mimeType, "image/png"));
     226    static const CFStringRef kUTTypePNG = CFSTR("public.png");
     227    return kUTTypePNG;
     228#endif
     229}
     230
    218231String ImageBuffer::toDataURL(const String& mimeType) const
    219232{
    220 #if PLATFORM(MAC)
    221233    ASSERT(MIMETypeRegistry::isSupportedImageMIMETypeForEncoding(mimeType));
    222234
     
    251263        return String("data:,");
    252264
    253     RetainPtr<CFStringRef> imageUTI(AdoptCF, UTTypeCreatePreferredIdentifierForTag(kUTTagClassMIMEType, mimeType.createCFString(), 0));
     265    RetainPtr<CFStringRef> imageUTI(AdoptCF, utiFromMIMEType(mimeType));
    254266    RetainPtr<CGImageDestinationRef> imageDestination(AdoptCF, CGImageDestinationCreateWithData(transformedImageData.get(), imageUTI.get(), 1, 0));
    255267    if (!imageDestination)
     
    267279
    268280    return String::format("data:%s;base64,%s", mimeType.utf8().data(), out.data());
    269 #else
    270     return String();
    271 #endif
    272281}
    273282
Note: See TracChangeset for help on using the changeset viewer.