Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[HEIC] Content-Type: image/heif offers to download the image, rather …
…than showing it as an image document

https://bugs.webkit.org/show_bug.cgi?id=257986
rdar://110667964

Reviewed by Tim Nguyen.

This is simply a data change. HEIC support needs to recognize image/heif too.

* LayoutTests/http/tests/images/heic-as-heif-expected.html: Added.
* LayoutTests/http/tests/images/heic-as-heif.html: Added.
* LayoutTests/http/tests/resources/green-400x400.heic: Added.
* Source/WebCore/platform/MIMETypeRegistry.cpp:
* Source/WebCore/platform/graphics/cg/UTIRegistry.cpp:
(WebCore::defaultSupportedImageTypes):

Canonical link: https://commits.webkit.org/265091@main
  • Loading branch information
litherum committed Jun 12, 2023
1 parent c543451 commit 1ad9aed
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 1 deletion.
10 changes: 10 additions & 0 deletions LayoutTests/http/tests/images/heic-as-heif-expected.html
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
</head>
</body>
<script>
window.location.href = "/resources/load-and-stall.py?name=green-400x400.heic&mimeType=image%2Fheic";
</script>
</body>
</html>
10 changes: 10 additions & 0 deletions LayoutTests/http/tests/images/heic-as-heif.html
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
</head>
</body>
<script>
window.location.href = "/resources/load-and-stall.py?name=green-400x400.heic&mimeType=image%2Fheif";
</script>
</body>
</html>
Binary file added LayoutTests/http/tests/resources/green-400x400.heic
Binary file not shown.
4 changes: 3 additions & 1 deletion Source/WebCore/platform/MIMETypeRegistry.cpp
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2006-2022 Apple Inc. All rights reserved.
* Copyright (C) 2006-2023 Apple Inc. All rights reserved.
* Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -101,6 +101,8 @@ constexpr ComparableCaseFoldingASCIILiteral supportedImageMIMETypeArray[] = {
#if HAVE(HEIC)
"image/heic",
"image/heic-sequence",
"image/heif",
"image/heif-sequence",
#endif
#if USE(CG) || USE(OPENJPEG)
"image/jp2",
Expand Down
1 change: 1 addition & 0 deletions Source/WebCore/platform/graphics/cg/UTIRegistry.cpp
Expand Up @@ -72,6 +72,7 @@ const MemoryCompactLookupOnlyRobinHoodHashSet<String>& defaultSupportedImageType
#if HAVE(HEIC)
"public.heic"_s,
"public.heics"_s,
"public.heif"_s,
#endif
};

Expand Down

0 comments on commit 1ad9aed

Please sign in to comment.