Changeset 261594 in webkit


Ignore:
Timestamp:
May 12, 2020 7:57:03 PM (4 years ago)
Author:
commit-queue@webkit.org
Message:

[CG] Change the UTI of the "WebP" image to be "org.webmproject.webp"
https://bugs.webkit.org/show_bug.cgi?id=211794
<rdar://problem/63031187>

Patch by Said Abou-Hallawa <sabouhallawa@apple.com> on 2020-05-12
Reviewed by Darin Adler.

See https://developers.google.com/speed/webp/docs/riff_container.

  • platform/graphics/cg/UTIRegistry.cpp:

(WebCore::defaultSupportedImageTypes):
Fix review comments from bug 208038.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r261592 r261594  
     12020-05-12  Said Abou-Hallawa  <sabouhallawa@apple.com>
     2
     3        [CG] Change the UTI of the "WebP" image to be "org.webmproject.webp"
     4        https://bugs.webkit.org/show_bug.cgi?id=211794
     5        <rdar://problem/63031187>
     6
     7        Reviewed by Darin Adler.
     8
     9        See https://developers.google.com/speed/webp/docs/riff_container.
     10
     11        * platform/graphics/cg/UTIRegistry.cpp:
     12        (WebCore::defaultSupportedImageTypes):
     13        Fix review comments from bug 208038.
     14
    1152020-05-12  Simon Fraser  <simon.fraser@apple.com>
    216
  • trunk/Source/WebCore/platform/graphics/cg/UTIRegistry.cpp

    r258817 r261594  
    11/*
    2  * Copyright (C) 2017-2018 Apple Inc.  All rights reserved.
     2 * Copyright (C) 2017-2020 Apple Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4141{
    4242    static const auto defaultSupportedImageTypes = makeNeverDestroyed([] {
    43         const String defaultSupportedImageTypes[] = {
     43        HashSet<String> defaultSupportedImageTypes = {
    4444            "com.compuserve.gif"_s,
    4545            "com.microsoft.bmp"_s,
     
    5656            "public.webp"_s,
    5757            "com.google.webp"_s,
     58            "org.webmproject.webp"_s,
    5859#endif
    5960        };
    6061
    61         RetainPtr<CFArrayRef> systemImageTypes = adoptCF(CGImageSourceCopyTypeIdentifiers());
    62         CFIndex count = CFArrayGetCount(systemImageTypes.get());
     62        auto systemSupportedCFImageTypes = adoptCF(CGImageSourceCopyTypeIdentifiers());
     63        CFIndex count = CFArrayGetCount(systemSupportedCFImageTypes.get());
    6364
    64         HashSet<String> defaultCGSupportedImageTypes;
    65         for (auto& imageType : defaultSupportedImageTypes) {
    66             RetainPtr<CFStringRef> string = imageType.createCFString();
    67             if (CFArrayContainsValue(systemImageTypes.get(), CFRangeMake(0, count), string.get()))
    68                 defaultCGSupportedImageTypes.add(imageType);
    69         }
    70         return defaultCGSupportedImageTypes;
     65        HashSet<String> systemSupportedImageTypes;
     66        CFArrayApplyFunction(systemSupportedCFImageTypes.get(), CFRangeMake(0, count), [](const void *value, void *context) {
     67            String imageType = static_cast<CFStringRef>(value);
     68            static_cast<HashSet<String>*>(context)->add(imageType);
     69        }, &systemSupportedImageTypes);
     70
     71        defaultSupportedImageTypes.removeIf([&systemSupportedImageTypes](const String& imageType) {
     72            return !systemSupportedImageTypes.contains(imageType);
     73        });
     74
     75        return defaultSupportedImageTypes;
    7176    }());
    7277
Note: See TracChangeset for help on using the changeset viewer.