Title: [272527] branches/safari-611-branch/Source
Revision
272527
Author
[email protected]
Date
2021-02-08 13:03:25 -0800 (Mon, 08 Feb 2021)

Log Message

Cherry-pick r272234. rdar://problem/74105068

    [macOS] Force loading the HEIF reader symbols before transcoding any HEIF image
    https://bugs.webkit.org/show_bug.cgi?id=221191
    <rdar://problem/70942158>

    Reviewed by Tim Horton.

    Source/WebCore:

    Transcoding the HEIF images requires loading the HEIF reader symbols which
    is not happening in macOS Catalina. A workaround for this bug in WebKit is
    to call CGImageSourceGetCount() for the CGImageSource of the HEIF image.

    * platform/graphics/cg/ImageUtilitiesCG.cpp:
    (WebCore::transcodeImage):

    Source/WTF:

    Add a HAVE macro for the fix of <rdar://problem/59589723>.

    * wtf/PlatformHave.h:

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272234 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-611-branch/Source/WTF/ChangeLog (272526 => 272527)


--- branches/safari-611-branch/Source/WTF/ChangeLog	2021-02-08 21:03:21 UTC (rev 272526)
+++ branches/safari-611-branch/Source/WTF/ChangeLog	2021-02-08 21:03:25 UTC (rev 272527)
@@ -1,5 +1,45 @@
 2021-02-08  Russell Epstein  <[email protected]>
 
+        Cherry-pick r272234. rdar://problem/74105068
+
+    [macOS] Force loading the HEIF reader symbols before transcoding any HEIF image
+    https://bugs.webkit.org/show_bug.cgi?id=221191
+    <rdar://problem/70942158>
+    
+    Reviewed by Tim Horton.
+    
+    Source/WebCore:
+    
+    Transcoding the HEIF images requires loading the HEIF reader symbols which
+    is not happening in macOS Catalina. A workaround for this bug in WebKit is
+    to call CGImageSourceGetCount() for the CGImageSource of the HEIF image.
+    
+    * platform/graphics/cg/ImageUtilitiesCG.cpp:
+    (WebCore::transcodeImage):
+    
+    Source/WTF:
+    
+    Add a HAVE macro for the fix of <rdar://problem/59589723>.
+    
+    * wtf/PlatformHave.h:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272234 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-02-02  Said Abou-Hallawa  <[email protected]>
+
+            [macOS] Force loading the HEIF reader symbols before transcoding any HEIF image
+            https://bugs.webkit.org/show_bug.cgi?id=221191
+            <rdar://problem/70942158>
+
+            Reviewed by Tim Horton.
+
+            Add a HAVE macro for the fix of <rdar://problem/59589723>.
+
+            * wtf/PlatformHave.h:
+
+2021-02-08  Russell Epstein  <[email protected]>
+
         Cherry-pick r272188. rdar://problem/74032553
 
     [Cocoa] Disable interstitial events on AVPlayerItem.

Modified: branches/safari-611-branch/Source/WTF/wtf/PlatformHave.h (272526 => 272527)


--- branches/safari-611-branch/Source/WTF/wtf/PlatformHave.h	2021-02-08 21:03:21 UTC (rev 272526)
+++ branches/safari-611-branch/Source/WTF/wtf/PlatformHave.h	2021-02-08 21:03:25 UTC (rev 272527)
@@ -705,6 +705,7 @@
 #define HAVE_LSDATABASECONTEXT 1
 #define HAVE_PRECONNECT_PING 1
 #define HAVE_WEBP 1
+#define HAVE_IMAGEIO_FIX_FOR_RADAR_59589723 1
 #endif
 
 #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 110000) \

Modified: branches/safari-611-branch/Source/WebCore/ChangeLog (272526 => 272527)


--- branches/safari-611-branch/Source/WebCore/ChangeLog	2021-02-08 21:03:21 UTC (rev 272526)
+++ branches/safari-611-branch/Source/WebCore/ChangeLog	2021-02-08 21:03:25 UTC (rev 272527)
@@ -1,5 +1,48 @@
 2021-02-08  Russell Epstein  <[email protected]>
 
+        Cherry-pick r272234. rdar://problem/74105068
+
+    [macOS] Force loading the HEIF reader symbols before transcoding any HEIF image
+    https://bugs.webkit.org/show_bug.cgi?id=221191
+    <rdar://problem/70942158>
+    
+    Reviewed by Tim Horton.
+    
+    Source/WebCore:
+    
+    Transcoding the HEIF images requires loading the HEIF reader symbols which
+    is not happening in macOS Catalina. A workaround for this bug in WebKit is
+    to call CGImageSourceGetCount() for the CGImageSource of the HEIF image.
+    
+    * platform/graphics/cg/ImageUtilitiesCG.cpp:
+    (WebCore::transcodeImage):
+    
+    Source/WTF:
+    
+    Add a HAVE macro for the fix of <rdar://problem/59589723>.
+    
+    * wtf/PlatformHave.h:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272234 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-02-02  Said Abou-Hallawa  <[email protected]>
+
+            [macOS] Force loading the HEIF reader symbols before transcoding any HEIF image
+            https://bugs.webkit.org/show_bug.cgi?id=221191
+            <rdar://problem/70942158>
+
+            Reviewed by Tim Horton.
+
+            Transcoding the HEIF images requires loading the HEIF reader symbols which
+            is not happening in macOS Catalina. A workaround for this bug in WebKit is
+            to call CGImageSourceGetCount() for the CGImageSource of the HEIF image.
+
+            * platform/graphics/cg/ImageUtilitiesCG.cpp:
+            (WebCore::transcodeImage):
+
+2021-02-08  Russell Epstein  <[email protected]>
+
         Cherry-pick r272214. rdar://problem/74032646
 
     Unreviewed, address post-landing review comment by Darin Adler for r272211.

Modified: branches/safari-611-branch/Source/WebCore/platform/graphics/cg/ImageUtilitiesCG.cpp (272526 => 272527)


--- branches/safari-611-branch/Source/WebCore/platform/graphics/cg/ImageUtilitiesCG.cpp	2021-02-08 21:03:21 UTC (rev 272526)
+++ branches/safari-611-branch/Source/WebCore/platform/graphics/cg/ImageUtilitiesCG.cpp	2021-02-08 21:03:25 UTC (rev 272527)
@@ -51,6 +51,18 @@
     if (sourceUTI == destinationUTI)
         return nullString();
 
+#if !HAVE(IMAGEIO_FIX_FOR_RADAR_59589723)
+    auto sourceMIMEType = MIMETypeFromUTI(sourceUTI);
+    if (sourceMIMEType == "image/heif"_s || sourceMIMEType == "image/heic"_s) {
+        static std::once_flag onceFlag;
+        std::call_once(onceFlag, [&] {
+            // This call will force ImageIO to load the symbols of the HEIF reader. This
+            // bug is already fixed in ImageIO of macOS Big Sur <rdar://problem/59589723>.
+            CGImageSourceGetCount(source.get());
+        });
+    }
+#endif
+
     // It is important to add the appropriate file extension to the temporary file path.
     // The File object depends solely on the extension to know the MIME type of the file.
     auto suffix = makeString('.', destinationExtension);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to