[webkit-changes] [WebKit/WebKit] b2fab9: When adding image support for "com.adobe.photoshop...

Gerald Squelart noreply at github.com
Tue Aug 22 15:47:33 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b2fab9cbd1d1baf5a80ac164ed4bf46179aabb19
      https://github.com/WebKit/WebKit/commit/b2fab9cbd1d1baf5a80ac164ed4bf46179aabb19
  Author: Gerald Squelart <g_squelart at apple.com>
  Date:   2023-08-22 (Tue, 22 Aug 2023)

  Changed paths:
    M Source/WebCore/platform/graphics/cg/UTIRegistry.cpp
    M Source/WebCore/platform/network/mac/UTIUtilities.h
    M Source/WebCore/platform/network/mac/UTIUtilities.mm
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    A Tools/TestWebKitAPI/Tests/WebCore/cocoa/TestUTIRegistry.cpp
    A Tools/TestWebKitAPI/Tests/WebCore/cocoa/TestUTIUtilities.cpp

  Log Message:
  -----------
  When adding image support for "com.adobe.photoshop-image", also add MIME type "application/x-photoshop"
https://bugs.webkit.org/show_bug.cgi?id=260464
rdar://103614570

Reviewed by Said Abou-Hallawa.

Mail adds "com.adobe.photoshop-image" as supported type, so that Photoshop images may be viewed as images
in emails. At that time, the associated MIME type "image/vnd.adobe.photoshop" also gets added.
However when inserting an attachment with file extension "psd", the system infers its MIME type as
"application/x-photoshop" instead, which is not supported by default, this prevents psd's from appearing
in the Mail editor.

So when adding "com.adobe.photoshop-image", the MIME type "application/x-photoshop" gets added as well to
correctly show attached psd images.

* Source/WebCore/platform/graphics/cg/UTIRegistry.cpp:
(WebCore::setAdditionalSupportedImageTypes):
* Source/WebCore/platform/network/mac/UTIUtilities.h:

* Source/WebCore/platform/network/mac/UTIUtilities.mm:
(WebCore::RequiredMIMETypesFromUTI):
Note: This 1:M UTI->MIME mapping should be exceedingly rare, so a simple `if` test here is enough.

* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/Tests/WebCore/cocoa/TestUTIRegistry.cpp: Added.
(TestWebKitAPI::TEST):
Relevant tests for this fix, but also a check to know if one day this fix is not needed anymore or needs
an update (e.g., if the platform starts to associate *.psd files with "image/vnd.adobe.photoshop" or
another MIME type).

* Tools/TestWebKitAPI/Tests/WebCore/cocoa/TestUTIUtilities.cpp: Added.
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/267153@main




More information about the webkit-changes mailing list