[webkit-changes] [WebKit/WebKit] 00c3f5: Camera RAW files picked via file input are returne...

Aditya Keerthi noreply at github.com
Thu Jul 13 15:05:06 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 00c3f53f2de429d9828d9e065dc989d0063b6fc8
      https://github.com/WebKit/WebKit/commit/00c3f53f2de429d9828d9e065dc989d0063b6fc8
  Author: Aditya Keerthi <akeerthi at apple.com>
  Date:   2023-07-13 (Thu, 13 Jul 2023)

  Changed paths:
    M LayoutTests/TestExpectations
    A LayoutTests/fast/forms/file/entries-api/png-raw-open-panel-expected.txt
    A LayoutTests/fast/forms/file/entries-api/png-raw-open-panel.html
    A LayoutTests/fast/forms/file/entries-api/resources/images/image.nef
    M LayoutTests/platform/mac-wk2/TestExpectations
    M Source/WebCore/platform/cocoa/MIMETypeRegistryCocoa.mm

  Log Message:
  -----------
  Camera RAW files picked via file input are returned as PNG on change
https://bugs.webkit.org/show_bug.cgi?id=258467
rdar://111231838

Reviewed by Cameron McCormack.

Camera RAW type identifiers are registered with the system via the RawCamera
bundle. While the list of supported RAW types is fairly comprehensive, many
type identifiers are missing an associated MIME type.

Consequently, when choosing a RAW file (such as NEF) for an input that supports
RAW files and PNGs, the lack of correct information in the RawCamera bundle
results in ".nef" getting mapped to a nil MIME type.

WebKit also contains logic to automatically transcode images selected in file
inputs to an accepted MIME type, if the current MIME type is unsupported, and
the file is an image type. For file inputs that specify `accept` values in the
form of extensions, the extensions are normalized to MIME types.

For an input that supports RAW files and PNGs, WebKit attempts to transcode
the image, as "image/png" is the only recognized MIME type, following the system
lookup. Transcoding then succeeds, since ImageIO knows about the RAW type, and
is able to convert it to a PNG.

To fix, workaround the missing MIME type mappings in RawCamera.bundle, by
explicitly declaring them in WebKit.

* LayoutTests/TestExpectations:
* LayoutTests/fast/forms/file/entries-api/png-raw-open-panel-expected.txt: Added.
* LayoutTests/fast/forms/file/entries-api/png-raw-open-panel.html: Added.
* LayoutTests/fast/forms/file/entries-api/resources/images/image.nef: Added.
* LayoutTests/platform/mac-wk2/TestExpectations:
* Source/WebCore/platform/cocoa/MIMETypeRegistryCocoa.mm:
(WebCore::additionalMimeTypesMap):
(WebCore::additionalExtensionsMap):
(WebCore::MIMETypeRegistry::mimeTypeForExtension):
(WebCore::MIMETypeRegistry::extensionsForMIMEType):
(WebCore::MIMETypeRegistry::preferredExtensionForMIMEType):

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




More information about the webkit-changes mailing list