Title: [265422] trunk
Revision
265422
Author
[email protected]
Date
2020-08-09 22:12:35 -0700 (Sun, 09 Aug 2020)

Log Message

[macOS] Drag/drop an image of a unsupported format to an file input element should convert it to a supported format
https://bugs.webkit.org/show_bug.cgi?id=212482
<rdar://problem/63731672>

Patch by Said Abou-Hallawa <[email protected]> on 2020-08-09
Reviewed by Darin Adler.

Source/WebCore:

Although the list of the dropped files are sent from the UI process to
the Web process through the WebPage channel, the file input settings are
only known by the Web process. So we have to do the image transcoding in
WebCore.

Tests: fast/forms/file/entries-api/image-no-transcode-drag-drop.html
       fast/forms/file/entries-api/image-transcode-drag-drop.html

* SourcesCocoa.txt:
* WebCore.xcodeproj/project.pbxproj:
* html/FileInputType.cpp:
(WebCore::FileInputType::handleDOMActivateEvent):
(WebCore::FileInputType::fileChooserSettings const):
Move filling FileChooserSettings to the function: fileChooserSettings().

(WebCore::FileInputType::applyFileChooserSettings):
Call fileChooserSettings() instead of receiving FileChooserSettings as
an argument.

(WebCore::FileInputType::filesChosen):
Add this function which can be called from receiveDroppedFiles() or
receiveDroppedFilesWithImageTranscoding().

(WebCore::FileInputType::receiveDroppedFilesWithImageTranscoding):
Finds out whether image transcoding is needed for the dropped files. If
it is needed, it will be done in a WorkQueue and call filesChosen() when
it is done. Otherwise it will call filesChosen() immediately.

(WebCore::FileInputType::receiveDroppedFiles):
* html/FileInputType.h:
* platform/graphics/ImageUtilities.h: Added.
* platform/graphics/cg/ImageUtilitiesCG.cpp: Added.
(WebCore::sharedImageTranscodingQueue):
Provide a shared WorkQueue which can be used by WebCore and WebKit.

(WebCore::transcodeImage):
(WebCore::findImagesForTranscoding):
(WebCore::transcodeImages):

Source/WebKit:

Move ImageUtilities.h and ImageUtilitiesCG.cpp from WebKit to WebCore.
Use the image transcoding functions and shared WorkQueue from WebCore.

* Platform/ImageUtilities.h: Removed.
* Platform/cg: Removed.
* SourcesCocoa.txt:
* UIProcess/WebPageProxy.cpp:
(WebKit::m_limitsNavigationsToAppBoundDomains):
(WebKit::WebPageProxy::didChooseFilesForOpenPanelWithImageTranscoding):
(WebKit::m_transcodingQueue): Deleted.
* UIProcess/WebPageProxy.h:
* WebKit.xcodeproj/project.pbxproj:

LayoutTests:

Enable the new tests on macOS WK1. eventSender.beginDragWithFiles is
supported on WK1 only.

* fast/forms/file/entries-api/image-no-transcode-drag-drop-expected.txt: Added.
* fast/forms/file/entries-api/image-no-transcode-drag-drop.html: Added.
* fast/forms/file/entries-api/image-transcode-drag-drop-expected.txt: Added.
* fast/forms/file/entries-api/image-transcode-drag-drop.html: Added.
* platform/ios/TestExpectations:
* platform/win/TestExpectations:
* platform/wincairo/TestExpectations:
* platform/wk2/TestExpectations:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (265421 => 265422)


--- trunk/LayoutTests/ChangeLog	2020-08-10 04:48:37 UTC (rev 265421)
+++ trunk/LayoutTests/ChangeLog	2020-08-10 05:12:35 UTC (rev 265422)
@@ -1,3 +1,23 @@
+2020-08-09  Said Abou-Hallawa  <[email protected]>
+
+        [macOS] Drag/drop an image of a unsupported format to an file input element should convert it to a supported format
+        https://bugs.webkit.org/show_bug.cgi?id=212482
+        <rdar://problem/63731672>
+
+        Reviewed by Darin Adler.
+
+        Enable the new tests on macOS WK1. eventSender.beginDragWithFiles is
+        supported on WK1 only.
+
+        * fast/forms/file/entries-api/image-no-transcode-drag-drop-expected.txt: Added.
+        * fast/forms/file/entries-api/image-no-transcode-drag-drop.html: Added.
+        * fast/forms/file/entries-api/image-transcode-drag-drop-expected.txt: Added.
+        * fast/forms/file/entries-api/image-transcode-drag-drop.html: Added.
+        * platform/ios/TestExpectations:
+        * platform/win/TestExpectations:
+        * platform/wincairo/TestExpectations:
+        * platform/wk2/TestExpectations:
+
 2020-08-08  Myles C. Maxfield  <[email protected]>
 
         Make GlyphBuffers required in the fast text codepath

Added: trunk/LayoutTests/fast/forms/file/entries-api/image-no-transcode-drag-drop-expected.txt (0 => 265422)


--- trunk/LayoutTests/fast/forms/file/entries-api/image-no-transcode-drag-drop-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/file/entries-api/image-no-transcode-drag-drop-expected.txt	2020-08-10 05:12:35 UTC (rev 265422)
@@ -0,0 +1,15 @@
+Tests a HEIC image will not be converted to any supported MIME type when it is dragged and dropped to a file input element which accepts HEIC.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS fileList.length is 1
+PASS file.type is "image/heic"
+PASS file.size is non-zero.
+Image could not be loaded.
+PASS img.width is not 400
+PASS img.height is not 400
+PASS successfullyParsed is true
+
+TEST COMPLETE
+  

Added: trunk/LayoutTests/fast/forms/file/entries-api/image-no-transcode-drag-drop.html (0 => 265422)


--- trunk/LayoutTests/fast/forms/file/entries-api/image-no-transcode-drag-drop.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/file/entries-api/image-no-transcode-drag-drop.html	2020-08-10 05:12:35 UTC (rev 265422)
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script src=""
+    <script src=""
+</head>
+<body>
+    <input type="file" accept="IMAGE/HEIC" _onchange_="changed(event)"></input>
+    <script>
+        description("Tests a HEIC image will not be converted to any supported MIME type when it is dragged and dropped to a file input element which accepts HEIC.");
+        jsTestIsAsync = true;
+
+        function runTest()
+        {
+            if (!window.eventSender || !eventSender.beginDragWithFiles) {
+                finishJSTest();
+                return;
+            }
+
+            var element = document.getElementsByTagName('input')[0];
+            var centerX = element.offsetLeft + element.offsetWidth / 2;
+            var centerY = element.offsetTop + element.offsetHeight / 2;
+
+            eventSender.beginDragWithFiles(["resources/images/green-400x400.heic"]);
+            eventSender.mouseMoveTo(centerX, centerY);
+            eventSender.mouseUp();
+        }
+
+        function changed(event)
+        {
+            fileList = event.target.files;
+            shouldBe("fileList.length", "1");
+
+            file = fileList[0];
+            shouldBeEqualToString("file.type", "image/heic");
+            shouldBeNonZero("file.size");
+
+            img = document.createElement("img");
+            document.body.appendChild(img);
+
+            var reader = new FileReader();
+            reader._onload_ = () => {
+                img._onload_ = () => {
+                    debug("Image was loaded.");
+                    shouldBe("img.width", "400");
+                    shouldBe("img.height", "400");
+                    finishJSTest();
+                };
+                img._onerror_ = () => {
+                    debug("Image could not be loaded.");
+                    shouldNotBe("img.width", "400");
+                    shouldNotBe("img.height", "400");
+                    finishJSTest();
+                };
+                img.src = ""
+            };
+            reader.readAsDataURL(file);
+        }
+        runTest();
+    </script>
+</body>
+</html>

Added: trunk/LayoutTests/fast/forms/file/entries-api/image-transcode-drag-drop-expected.txt (0 => 265422)


--- trunk/LayoutTests/fast/forms/file/entries-api/image-transcode-drag-drop-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/file/entries-api/image-transcode-drag-drop-expected.txt	2020-08-10 05:12:35 UTC (rev 265422)
@@ -0,0 +1,15 @@
+Tests a HEIC image will be converted to a PNG image when it is dragged and dropped to a file input element which accepts PNG.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS fileList.length is 1
+PASS file.type is "image/png"
+PASS file.size is non-zero.
+Image was loaded.
+PASS img.width is 400
+PASS img.height is 400
+PASS successfullyParsed is true
+
+TEST COMPLETE
+  

Added: trunk/LayoutTests/fast/forms/file/entries-api/image-transcode-drag-drop.html (0 => 265422)


--- trunk/LayoutTests/fast/forms/file/entries-api/image-transcode-drag-drop.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/file/entries-api/image-transcode-drag-drop.html	2020-08-10 05:12:35 UTC (rev 265422)
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script src=""
+    <script src=""
+</head>
+<body>
+    <input type="file" accept=".png" _onchange_="changed(event)"></input>
+    <script>
+        description("Tests a HEIC image will be converted to a PNG image when it is dragged and dropped to a file input element which accepts PNG.");
+        jsTestIsAsync = true;
+
+        function runTest()
+        {
+            if (!window.eventSender || !eventSender.beginDragWithFiles) {
+                finishJSTest();
+                return;
+            }
+
+            var element = document.getElementsByTagName('input')[0];
+            var centerX = element.offsetLeft + element.offsetWidth / 2;
+            var centerY = element.offsetTop + element.offsetHeight / 2;
+
+            eventSender.beginDragWithFiles(["resources/images/green-400x400.heic"]);
+            eventSender.mouseMoveTo(centerX, centerY);
+            eventSender.mouseUp();
+        }
+
+        function changed(event)
+        {
+            fileList = event.target.files;
+            shouldBe("fileList.length", "1");
+
+            file = fileList[0];
+            shouldBeEqualToString("file.type", "image/png");
+            shouldBeNonZero("file.size");
+
+            img = document.createElement("img");
+            document.body.appendChild(img);
+
+            var reader = new FileReader();
+            reader._onload_ = () => {
+                img._onload_ = () => {
+                    debug("Image was loaded.");
+                    shouldBe("img.width", "400");
+                    shouldBe("img.height", "400");
+                    finishJSTest();
+                };
+                img._onerror_ = () => {
+                    debug("Image could not be loaded.");
+                    shouldNotBe("img.width", "400");
+                    shouldNotBe("img.height", "400");
+                    finishJSTest();
+                };
+                img.src = ""
+            };
+            reader.readAsDataURL(file);
+        }
+        runTest();
+    </script>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/ios/TestExpectations (265421 => 265422)


--- trunk/LayoutTests/platform/ios/TestExpectations	2020-08-10 04:48:37 UTC (rev 265421)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2020-08-10 05:12:35 UTC (rev 265422)
@@ -593,6 +593,8 @@
 fast/forms/file/input-file-write-files.html [ Skip ]
 fast/forms/file/recover-file-input-in-unposted-form.html [ Skip ]
 fast/forms/file/selected-files-from-history-state.html [ Skip ]
+fast/forms/file/entries-api/image-no-transcode-drag-drop.html [ Skip ]
+fast/forms/file/entries-api/image-transcode-drag-drop.html [ Skip ]
 fast/forms/focus-selection-input.html [ Skip ]
 fast/forms/focus-selection-textarea.html [ Skip ]
 fast/forms/input-appearance-spinbutton-up.html [ Skip ]

Modified: trunk/LayoutTests/platform/win/TestExpectations (265421 => 265422)


--- trunk/LayoutTests/platform/win/TestExpectations	2020-08-10 04:48:37 UTC (rev 265421)
+++ trunk/LayoutTests/platform/win/TestExpectations	2020-08-10 05:12:35 UTC (rev 265422)
@@ -3683,6 +3683,8 @@
 fast/forms/file/entries-api/drag-folder-webkitEntries.html [ Failure ]
 fast/forms/file/entries-api/webkitdirectory-drag-folder-webkitEntries.html [ Failure ]
 fast/forms/file/entries-api/webkitdirectory-drag-folder.html [ Failure ]
+fast/forms/file/entries-api/image-no-transcode-drag-drop.html [ Failure ]
+fast/forms/file/entries-api/image-transcode-drag-drop.html [ Failure ]
 http/tests/multipart/multipart-async-image.html [ Failure ]
 http/tests/security/contentSecurityPolicy/allow-favicon.html [ Failure ]
 http/wpt/entries-api/interfaces.html [ Failure ]

Modified: trunk/LayoutTests/platform/wincairo/TestExpectations (265421 => 265422)


--- trunk/LayoutTests/platform/wincairo/TestExpectations	2020-08-10 04:48:37 UTC (rev 265421)
+++ trunk/LayoutTests/platform/wincairo/TestExpectations	2020-08-10 05:12:35 UTC (rev 265422)
@@ -745,6 +745,8 @@
 fast/forms/file/input-file-value-using-open-panel.html [ Timeout ]
 fast/forms/file/input-file-write-files-using-open-panel.html [ Timeout ]
 fast/forms/file/open-file-panel.html [ Timeout ]
+fast/forms/file/entries-api/image-no-transcode-drag-drop.html [Skip ]
+fast/forms/file/entries-api/image-transcode-drag-drop.html [Skip ]
 fast/history/page-cache-createObjectURL-using-open-panel.html [ Timeout ]
 fast/history/page-cache-createObjectURL.html [ Timeout ]
 

Modified: trunk/LayoutTests/platform/wk2/TestExpectations (265421 => 265422)


--- trunk/LayoutTests/platform/wk2/TestExpectations	2020-08-10 04:48:37 UTC (rev 265421)
+++ trunk/LayoutTests/platform/wk2/TestExpectations	2020-08-10 05:12:35 UTC (rev 265422)
@@ -657,6 +657,8 @@
 security/contentSecurityPolicy/image-with-blob-url-allowed-by-img-src-star-with-AllowContentSecurityPolicySourceStarToMatchAnyProtocol-enabled.html
 security/contentSecurityPolicy/image-with-blob-url-blocked-by-img-src-star.html
 security/contentSecurityPolicy/video-with-blob-url-allowed-by-media-src-star.html
+fast/forms/file/entries-api/image-no-transcode-drag-drop.html
+fast/forms/file/entries-api/image-transcode-drag-drop.html
 
 # WebKitTestRunner doesn't have eventSender.fireKeyboardEventsToElement
 platform/mac/fast/events/objc-keyboard-event-creation.html

Modified: trunk/Source/WebCore/ChangeLog (265421 => 265422)


--- trunk/Source/WebCore/ChangeLog	2020-08-10 04:48:37 UTC (rev 265421)
+++ trunk/Source/WebCore/ChangeLog	2020-08-10 05:12:35 UTC (rev 265422)
@@ -1,3 +1,50 @@
+2020-08-09  Said Abou-Hallawa  <[email protected]>
+
+        [macOS] Drag/drop an image of a unsupported format to an file input element should convert it to a supported format
+        https://bugs.webkit.org/show_bug.cgi?id=212482
+        <rdar://problem/63731672>
+
+        Reviewed by Darin Adler.
+
+        Although the list of the dropped files are sent from the UI process to
+        the Web process through the WebPage channel, the file input settings are
+        only known by the Web process. So we have to do the image transcoding in
+        WebCore.
+
+        Tests: fast/forms/file/entries-api/image-no-transcode-drag-drop.html
+               fast/forms/file/entries-api/image-transcode-drag-drop.html
+
+        * SourcesCocoa.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+        * html/FileInputType.cpp:
+        (WebCore::FileInputType::handleDOMActivateEvent):
+        (WebCore::FileInputType::fileChooserSettings const):
+        Move filling FileChooserSettings to the function: fileChooserSettings().
+
+        (WebCore::FileInputType::applyFileChooserSettings):
+        Call fileChooserSettings() instead of receiving FileChooserSettings as
+        an argument.
+
+        (WebCore::FileInputType::filesChosen):
+        Add this function which can be called from receiveDroppedFiles() or
+        receiveDroppedFilesWithImageTranscoding().        
+
+        (WebCore::FileInputType::receiveDroppedFilesWithImageTranscoding):
+        Finds out whether image transcoding is needed for the dropped files. If
+        it is needed, it will be done in a WorkQueue and call filesChosen() when
+        it is done. Otherwise it will call filesChosen() immediately.
+
+        (WebCore::FileInputType::receiveDroppedFiles):
+        * html/FileInputType.h:
+        * platform/graphics/ImageUtilities.h: Added.
+        * platform/graphics/cg/ImageUtilitiesCG.cpp: Added.
+        (WebCore::sharedImageTranscodingQueue):
+        Provide a shared WorkQueue which can be used by WebCore and WebKit.
+
+        (WebCore::transcodeImage):
+        (WebCore::findImagesForTranscoding):
+        (WebCore::transcodeImages):
+
 2020-08-09  Wenson Hsieh  <[email protected]>
 
         REGRESSION (r260831): Web process crashes under Editor::setComposition() after navigating with marked text

Modified: trunk/Source/WebCore/SourcesCocoa.txt (265421 => 265422)


--- trunk/Source/WebCore/SourcesCocoa.txt	2020-08-10 04:48:37 UTC (rev 265421)
+++ trunk/Source/WebCore/SourcesCocoa.txt	2020-08-10 05:12:35 UTC (rev 265422)
@@ -331,6 +331,7 @@
 platform/graphics/cg/ImageBufferUtilitiesCG.cpp
 platform/graphics/cg/ImageDecoderCG.cpp
 platform/graphics/cg/ImageSourceCGMac.mm
+platform/graphics/cg/ImageUtilitiesCG.cpp
 platform/graphics/cg/IntPointCG.cpp
 platform/graphics/cg/IntRectCG.cpp
 platform/graphics/cg/IntSizeCG.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (265421 => 265422)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-08-10 04:48:37 UTC (rev 265421)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2020-08-10 05:12:35 UTC (rev 265422)
@@ -1762,6 +1762,7 @@
 		55AD09402408964000DE4D2F /* DisplayListDrawingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 72EA09F923FCCC6A008504A5 /* DisplayListDrawingContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		55AD09412408964A00DE4D2F /* ConcreteImageBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 72BAC3A723E17328008D741C /* ConcreteImageBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		55AF14E61EAAC59B0026EEAA /* UTIRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 55AF14E41EAAC59B0026EEAA /* UTIRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		55BBD42924DB560400BB6E0C /* ImageUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 55BBD42824DB53A200BB6E0C /* ImageUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		55DCC52822407B2000C26E32 /* SVGPrimitiveList.h in Headers */ = {isa = PBXBuildFile; fileRef = 55DCC5252240749E00C26E32 /* SVGPrimitiveList.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		55DCC52922407B2A00C26E32 /* SVGList.h in Headers */ = {isa = PBXBuildFile; fileRef = 55DCC523224073FE00C26E32 /* SVGList.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		55EC9599206AA7A0007DD0A9 /* PaintFrequencyTracker.h in Headers */ = {isa = PBXBuildFile; fileRef = 55EC95972069C92D007DD0A9 /* PaintFrequencyTracker.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -8847,6 +8848,8 @@
 		55A336F81D821E3C0022C4C7 /* ImageBackingStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageBackingStore.h; sourceTree = "<group>"; };
 		55AF14E31EAAC59B0026EEAA /* UTIRegistry.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = UTIRegistry.cpp; sourceTree = "<group>"; };
 		55AF14E41EAAC59B0026EEAA /* UTIRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UTIRegistry.h; sourceTree = "<group>"; };
+		55BBD42624DB534300BB6E0C /* ImageUtilitiesCG.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ImageUtilitiesCG.cpp; sourceTree = "<group>"; };
+		55BBD42824DB53A200BB6E0C /* ImageUtilities.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageUtilities.h; sourceTree = "<group>"; };
 		55BE0257223B29C00032F08A /* SVGPropertyRegistry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGPropertyRegistry.h; sourceTree = "<group>"; };
 		55BE0259223B29C10032F08A /* SVGAnimationAdditiveValueFunctionImpl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGAnimationAdditiveValueFunctionImpl.h; sourceTree = "<group>"; };
 		55BE025A223B29C20032F08A /* SVGPointerMemberAccessor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SVGPointerMemberAccessor.h; sourceTree = "<group>"; };
@@ -25625,6 +25628,7 @@
 				555B87EB1CAAF0AB00349425 /* ImageDecoderCG.h */,
 				4B3480920EEF50D400AC1B41 /* ImageSourceCG.h */,
 				4B3480910EEF50D400AC1B41 /* ImageSourceCGMac.mm */,
+				55BBD42624DB534300BB6E0C /* ImageUtilitiesCG.cpp */,
 				B27535320B053814002CE64F /* IntPointCG.cpp */,
 				B27535330B053814002CE64F /* IntRectCG.cpp */,
 				B27535340B053814002CE64F /* IntSizeCG.cpp */,
@@ -25828,6 +25832,7 @@
 				554675771FD1FC1A003B10B0 /* ImageSource.cpp */,
 				554675781FD1FC1A003B10B0 /* ImageSource.h */,
 				5550CB411E955E3C00111AA0 /* ImageTypes.h */,
+				55BBD42824DB53A200BB6E0C /* ImageUtilities.h */,
 				078633F8240715D20087AE21 /* InbandGenericCue.cpp */,
 				078633DE23FEDF220087AE21 /* InbandGenericCue.h */,
 				0706A0D7240830A600E93818 /* InbandGenericCueIdentifier.h */,
@@ -31422,6 +31427,7 @@
 				4B3480940EEF50D400AC1B41 /* ImageSourceCG.h in Headers */,
 				078ED193216D079500775B33 /* ImageTransferSessionVT.h in Headers */,
 				5550CB421E955E3C00111AA0 /* ImageTypes.h in Headers */,
+				55BBD42924DB560400BB6E0C /* ImageUtilities.h in Headers */,
 				26F756B31B3B66F70005DD79 /* ImmutableNFA.h in Headers */,
 				26F756B51B3B68F20005DD79 /* ImmutableNFANodeBuilder.h in Headers */,
 				316FE1180E6E1DA700BF6088 /* ImplicitAnimation.h in Headers */,

Modified: trunk/Source/WebCore/html/FileInputType.cpp (265421 => 265422)


--- trunk/Source/WebCore/html/FileInputType.cpp	2020-08-10 04:48:37 UTC (rev 265421)
+++ trunk/Source/WebCore/html/FileInputType.cpp	2020-08-10 05:12:35 UTC (rev 265422)
@@ -37,6 +37,7 @@
 #include "Icon.h"
 #include "InputTypeNames.h"
 #include "LocalizedStrings.h"
+#include "MIMETypeRegistry.h"
 #include "RenderFileUploadControl.h"
 #include "RuntimeEnabledFeatures.h"
 #include "Settings.h"
@@ -47,6 +48,11 @@
 #include <wtf/TypeCasts.h>
 #include <wtf/text/StringBuilder.h>
 
+#if PLATFORM(MAC)
+#include "ImageUtilities.h"
+#include "UTIUtilities.h"
+#endif
+
 namespace WebCore {
 class UploadButtonElement;
 }
@@ -204,16 +210,7 @@
         return;
 
     if (auto* chrome = this->chrome()) {
-        FileChooserSettings settings;
-        settings.allowsDirectories = allowsDirectories();
-        settings.allowsMultipleFiles = input.hasAttributeWithoutSynchronization(multipleAttr);
-        settings.acceptMIMETypes = input.acceptMIMETypes();
-        settings.acceptFileExtensions = input.acceptFileExtensions();
-        settings.selectedFiles = m_fileList->paths();
-#if ENABLE(MEDIA_CAPTURE)
-        settings.mediaCaptureType = input.mediaCaptureType();
-#endif
-        applyFileChooserSettings(settings);
+        applyFileChooserSettings();
         chrome->runOpenPanel(*input.document().frame(), *m_fileChooser);
     }
 
@@ -332,12 +329,29 @@
     chrome->loadIconForFiles(paths, *m_fileIconLoader);
 }
 
-void FileInputType::applyFileChooserSettings(const FileChooserSettings& settings)
+FileChooserSettings FileInputType::fileChooserSettings() const
 {
+    ASSERT(element());
+    auto& input = *element();
+
+    FileChooserSettings settings;
+    settings.allowsDirectories = allowsDirectories();
+    settings.allowsMultipleFiles = input.hasAttributeWithoutSynchronization(multipleAttr);
+    settings.acceptMIMETypes = input.acceptMIMETypes();
+    settings.acceptFileExtensions = input.acceptFileExtensions();
+    settings.selectedFiles = m_fileList->paths();
+#if ENABLE(MEDIA_CAPTURE)
+    settings.mediaCaptureType = input.mediaCaptureType();
+#endif
+    return settings;
+}
+
+void FileInputType::applyFileChooserSettings()
+{
     if (m_fileChooser)
         m_fileChooser->invalidate();
 
-    m_fileChooser = FileChooser::create(this, settings);
+    m_fileChooser = FileChooser::create(this, fileChooserSettings());
 }
 
 bool FileInputType::allowsDirectories() const
@@ -425,6 +439,22 @@
     m_directoryFileListCreator->start(paths);
 }
 
+void FileInputType::filesChosen(const Vector<String>& paths, const Vector<String>& replacementPaths)
+{
+    ASSERT(element());
+    ASSERT(!paths.isEmpty());
+
+    size_t size = element()->hasAttributeWithoutSynchronization(multipleAttr) ? paths.size() : 1;
+
+    Vector<FileChooserFileInfo> files;
+    files.reserveInitialCapacity(size);
+
+    for (size_t i = 0; i < size; ++i)
+        files.uncheckedAppend({ paths[i], i < replacementPaths.size() ? replacementPaths[i] : nullString(), { } });
+
+    filesChosen(files);
+}
+
 void FileInputType::didCreateFileList(Ref<FileList>&& fileList, RefPtr<Icon>&& icon)
 {
     auto protectedThis = makeRef(*this);
@@ -454,6 +484,45 @@
 }
 
 #if ENABLE(DRAG_SUPPORT)
+bool FileInputType::receiveDroppedFilesWithImageTranscoding(const Vector<String>& paths)
+{
+#if PLATFORM(MAC)
+    auto settings = fileChooserSettings();
+    auto allowedMIMETypes = MIMETypeRegistry::allowedMIMETypes(settings.acceptMIMETypes, settings.acceptFileExtensions);
+    
+    auto transcodingPaths = findImagesForTranscoding(paths, allowedMIMETypes);
+    if (transcodingPaths.isEmpty())
+        return { };
+
+    auto transcodingMIMEType = MIMETypeRegistry::preferredImageMIMETypeForEncoding(allowedMIMETypes, { });
+    if (transcodingMIMEType.isNull())
+        return { };
+
+    auto transcodingUTI = WebCore::UTIFromMIMEType(transcodingMIMEType);
+    auto transcodingExtension = WebCore::MIMETypeRegistry::preferredExtensionForMIMEType(transcodingMIMEType);
+
+    auto callFilesChosen = [protectedThis = makeRef(*this), paths](const Vector<String>& replacementPaths) {
+        protectedThis->filesChosen(paths, replacementPaths);
+    };
+
+    sharedImageTranscodingQueue().dispatch([callFilesChosen = WTFMove(callFilesChosen), transcodingPaths = transcodingPaths.isolatedCopy(), transcodingUTI = transcodingUTI.isolatedCopy(), transcodingExtension = transcodingExtension.isolatedCopy()]() mutable {
+        ASSERT(!RunLoop::isMain());
+
+        auto replacementPaths = transcodeImages(transcodingPaths, transcodingUTI, transcodingExtension);
+        ASSERT(transcodingPaths.size() == replacementPaths.size());
+
+        RunLoop::main().dispatch([callFilesChosen = WTFMove(callFilesChosen), replacementPaths = replacementPaths.isolatedCopy()]() {
+            callFilesChosen(replacementPaths);
+        });
+    });
+
+    return true;
+#else
+    UNUSED_PARAM(paths);
+    return false;
+#endif
+}
+
 bool FileInputType::receiveDroppedFiles(const DragData& dragData)
 {
     auto paths = dragData.asFilenames();
@@ -460,17 +529,10 @@
     if (paths.isEmpty())
         return false;
 
-    ASSERT(element());
-    if (element()->hasAttributeWithoutSynchronization(multipleAttr)) {
-        Vector<FileChooserFileInfo> files;
-        files.reserveInitialCapacity(paths.size());
-        for (auto& path : paths)
-            files.uncheckedAppend({ path, { }, { } });
-
-        filesChosen(files);
-    } else
-        filesChosen({ { paths[0], { }, { } } });
-
+    if (receiveDroppedFilesWithImageTranscoding(paths))
+        return true;
+    
+    filesChosen(paths);
     return true;
 }
 #endif // ENABLE(DRAG_SUPPORT)

Modified: trunk/Source/WebCore/html/FileInputType.h (265421 => 265422)


--- trunk/Source/WebCore/html/FileInputType.h	2020-08-10 04:48:37 UTC (rev 265421)
+++ trunk/Source/WebCore/html/FileInputType.h	2020-08-10 05:12:35 UTC (rev 265422)
@@ -71,6 +71,7 @@
     void setValue(const String&, bool valueChanged, TextFieldEventBehavior) final;
 
 #if ENABLE(DRAG_SUPPORT)
+    bool receiveDroppedFilesWithImageTranscoding(const Vector<String>& paths);
     bool receiveDroppedFiles(const DragData&) final;
 #endif
 
@@ -82,11 +83,13 @@
     String defaultToolTip() const final;
 
     void filesChosen(const Vector<FileChooserFileInfo>&, const String& displayString = { }, Icon* = nullptr) final;
+    void filesChosen(const Vector<String>& paths, const Vector<String>& replacementPaths = { });
 
     // FileIconLoaderClient implementation.
     void iconLoaded(RefPtr<Icon>&&) final;
 
-    void applyFileChooserSettings(const FileChooserSettings&);
+    FileChooserSettings fileChooserSettings() const;
+    void applyFileChooserSettings();
     void didCreateFileList(Ref<FileList>&&, RefPtr<Icon>&&);
     void requestIcon(const Vector<String>&);
 

Copied: trunk/Source/WebCore/platform/graphics/ImageUtilities.h (from rev 265421, trunk/Source/WebKit/Platform/ImageUtilities.h) (0 => 265422)


--- trunk/Source/WebCore/platform/graphics/ImageUtilities.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/ImageUtilities.h	2020-08-10 05:12:35 UTC (rev 265422)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+namespace WebCore {
+
+WEBCORE_EXPORT WorkQueue& sharedImageTranscodingQueue();
+
+// Given a list of files' 'paths' and 'allowedMIMETypes', the function returns a list
+// of strings whose size is the same as the size of 'paths' and its entries are all
+// null strings except the ones whose MIME types are not in 'allowedMIMETypes'.
+WEBCORE_EXPORT Vector<String> findImagesForTranscoding(const Vector<String>& paths, const Vector<String>& allowedMIMETypes);
+
+// Given a list of images' 'paths', this function transcodes these images to a new
+// format whose UTI is destinationUTI. The result of the transcoding will be written
+// to temporary files whose extensions are 'destinationExtension'. It returns a list
+// of paths to the result temporary files. If an entry in 'paths' is null or an error
+// happens while transcoding, a null string will be added to the returned list.
+WEBCORE_EXPORT Vector<String> transcodeImages(const Vector<String>& paths, const String& destinationUTI, const String& destinationExtension);
+
+} // namespace WebCore
+

Copied: trunk/Source/WebCore/platform/graphics/cg/ImageUtilitiesCG.cpp (from rev 265421, trunk/Source/WebKit/Platform/cg/ImageUtilitiesCG.cpp) (0 => 265422)


--- trunk/Source/WebCore/platform/graphics/cg/ImageUtilitiesCG.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageUtilitiesCG.cpp	2020-08-10 05:12:35 UTC (rev 265422)
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2020 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ImageUtilities.h"
+
+#include "Logging.h"
+#include "MIMETypeRegistry.h"
+#include <ImageIO/ImageIO.h>
+#include <wtf/FileSystem.h>
+#include <wtf/text/CString.h>
+
+namespace WebCore {
+
+WorkQueue& sharedImageTranscodingQueue()
+{
+    static NeverDestroyed<Ref<WorkQueue>> queue(WorkQueue::create("com.apple.WebKit.ImageTranscoding"));
+    return queue.get();
+}
+
+static String transcodeImage(const String& path, const String& destinationUTI, const String& destinationExtension)
+{
+    auto sourceURL = adoptCF(CFURLCreateWithFileSystemPath(kCFAllocatorDefault, path.createCFString().get(), kCFURLPOSIXPathStyle, false));
+    auto source = adoptCF(CGImageSourceCreateWithURL(sourceURL.get(), nullptr));
+    if (!source)
+        return nullString();
+
+    auto sourceUTI = String(CGImageSourceGetType(source.get()));
+    if (sourceUTI == destinationUTI)
+        return nullString();
+
+    // 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);
+
+    FileSystem::PlatformFileHandle destinationFileHandle;
+    String destinationPath = FileSystem::openTemporaryFile("tempImage"_s, destinationFileHandle, suffix);
+    if (destinationFileHandle == FileSystem::invalidPlatformFileHandle) {
+        RELEASE_LOG_ERROR(Images, "transcodeImage: Destination image could not be created: %s %s\n", path.utf8().data(), destinationUTI.utf8().data());
+        return nullString();
+    }
+
+    CGDataConsumerCallbacks callbacks = {
+        [](void* info, const void* buffer, size_t count) -> size_t {
+            auto handle = *static_cast<FileSystem::PlatformFileHandle*>(info);
+            return FileSystem::writeToFile(handle, static_cast<const char*>(buffer), count);
+        },
+        nullptr
+    };
+
+    auto consumer = adoptCF(CGDataConsumerCreate(&destinationFileHandle, &callbacks));
+    auto destination = adoptCF(CGImageDestinationCreateWithDataConsumer(consumer.get(), destinationUTI.createCFString().get(), 1, nullptr));
+
+    CGImageDestinationAddImageFromSource(destination.get(), source.get(), 0, nullptr);
+
+    if (!CGImageDestinationFinalize(destination.get())) {
+        RELEASE_LOG_ERROR(Images, "transcodeImage: Image transcoding fails: %s %s\n", path.utf8().data(), destinationUTI.utf8().data());
+        FileSystem::closeFile(destinationFileHandle);
+        FileSystem::deleteFile(destinationPath);
+        return nullString();
+    }
+
+    FileSystem::closeFile(destinationFileHandle);
+    return destinationPath;
+}
+
+Vector<String> findImagesForTranscoding(const Vector<String>& paths, const Vector<String>& allowedMIMETypes)
+{
+    Vector<String> transcodingPaths;
+    transcodingPaths.reserveInitialCapacity(paths.size());
+
+    bool needsTranscoding = false;
+
+    for (auto& path : paths) {
+        // Append a path of the image which needs transcoding. Otherwise append a null string.
+        if (!allowedMIMETypes.contains(WebCore::MIMETypeRegistry::mimeTypeForPath(path))) {
+            transcodingPaths.uncheckedAppend(path);
+            needsTranscoding = true;
+        } else
+            transcodingPaths.uncheckedAppend(nullString());
+    }
+
+    // If none of the files needs image transcoding, return an empty Vector.
+    return needsTranscoding ? transcodingPaths : Vector<String>();
+}
+
+Vector<String> transcodeImages(const Vector<String>& paths, const String& destinationUTI, const String& destinationExtension)
+{
+    ASSERT(!destinationUTI.isNull());
+    ASSERT(!destinationExtension.isNull());
+    
+    Vector<String> transcodedPaths;
+    transcodedPaths.reserveInitialCapacity(paths.size());
+
+    for (auto& path : paths) {
+        // Append the transcoded path if the image needs transcoding. Otherwise append a null string.
+        if (!path.isNull())
+            transcodedPaths.uncheckedAppend(transcodeImage(path, destinationUTI, destinationExtension));
+        else
+            transcodedPaths.uncheckedAppend(nullString());
+    }
+
+    return transcodedPaths;
+}
+
+} // namespace WebCore

Modified: trunk/Source/WebKit/ChangeLog (265421 => 265422)


--- trunk/Source/WebKit/ChangeLog	2020-08-10 04:48:37 UTC (rev 265421)
+++ trunk/Source/WebKit/ChangeLog	2020-08-10 05:12:35 UTC (rev 265422)
@@ -1,3 +1,24 @@
+2020-08-09  Said Abou-Hallawa  <[email protected]>
+
+        [macOS] Drag/drop an image of a unsupported format to an file input element should convert it to a supported format
+        https://bugs.webkit.org/show_bug.cgi?id=212482
+        <rdar://problem/63731672>
+
+        Reviewed by Darin Adler.
+
+        Move ImageUtilities.h and ImageUtilitiesCG.cpp from WebKit to WebCore.
+        Use the image transcoding functions and shared WorkQueue from WebCore.
+
+        * Platform/ImageUtilities.h: Removed.
+        * Platform/cg: Removed.
+        * SourcesCocoa.txt:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::m_limitsNavigationsToAppBoundDomains):
+        (WebKit::WebPageProxy::didChooseFilesForOpenPanelWithImageTranscoding):
+        (WebKit::m_transcodingQueue): Deleted.
+        * UIProcess/WebPageProxy.h:
+        * WebKit.xcodeproj/project.pbxproj:
+
 2020-08-08  Wenson Hsieh  <[email protected]>
 
         [ iOS wk2 ] editing/pasteboard/paste-without-nesting.html is a flaky failure

Deleted: trunk/Source/WebKit/Platform/ImageUtilities.h (265421 => 265422)


--- trunk/Source/WebKit/Platform/ImageUtilities.h	2020-08-10 04:48:37 UTC (rev 265421)
+++ trunk/Source/WebKit/Platform/ImageUtilities.h	2020-08-10 05:12:35 UTC (rev 265422)
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2020 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-namespace WebKit {
-
-// Given a list of files' 'paths' and 'allowedMIMETypes', the function returns a list
-// of strings whose size is the same as the size of 'paths' and its entries are all
-// null strings except the ones whose MIME types are not in 'allowedMIMETypes'.
-Vector<String> findImagesForTranscoding(const Vector<String>& paths, const Vector<String>& allowedMIMETypes);
-
-// Given a list of images' 'paths', this function transcodes these images to a new
-// format whose UTI is destinationUTI. The result of the transcoding will be written
-// to temporary files whose extensions are 'destinationExtension'. It returns a list
-// of paths to the result temporary files. If an entry in 'paths' is null or an error
-// happens while transcoding, a null string will be added to the returned list.
-Vector<String> transcodeImages(const Vector<String>& paths, const String& destinationUTI, const String& destinationExtension);
-
-} // namespace WebKit

Modified: trunk/Source/WebKit/SourcesCocoa.txt (265421 => 265422)


--- trunk/Source/WebKit/SourcesCocoa.txt	2020-08-10 04:48:37 UTC (rev 265421)
+++ trunk/Source/WebKit/SourcesCocoa.txt	2020-08-10 05:12:35 UTC (rev 265422)
@@ -65,8 +65,6 @@
 
 Platform/cf/ModuleCF.cpp
 
-Platform/cg/ImageUtilitiesCG.cpp
-
 Platform/classifier/cocoa/ResourceLoadStatisticsClassifierCocoa.cpp
 Platform/classifier/ResourceLoadStatisticsClassifier.cpp
 

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (265421 => 265422)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-08-10 04:48:37 UTC (rev 265421)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2020-08-10 05:12:35 UTC (rev 265422)
@@ -217,7 +217,7 @@
 #endif
 
 #if PLATFORM(MAC)
-#include "ImageUtilities.h"
+#include <WebCore/ImageUtilities.h>
 #include <WebCore/UTIUtilities.h>
 #endif
 
@@ -492,9 +492,6 @@
     , m_ignoresAppBoundDomains(m_configuration->ignoresAppBoundDomains())
     , m_limitsNavigationsToAppBoundDomains(m_configuration->limitsNavigationsToAppBoundDomains())
 #endif
-#if PLATFORM(MAC)
-    , m_transcodingQueue(WorkQueue::create("com.apple.WebKit.ImageTranscoding"))
-#endif
 {
     RELEASE_LOG_IF_ALLOWED(Loading, "constructor:");
 
@@ -6683,7 +6680,7 @@
     auto transcodingUTI = WebCore::UTIFromMIMEType(transcodingMIMEType);
     auto transcodingExtension = WebCore::MIMETypeRegistry::preferredExtensionForMIMEType(transcodingMIMEType);
 
-    m_transcodingQueue->dispatch([this, protectedThis = makeRef(*this), fileURLs = fileURLs.isolatedCopy(), transcodingURLs = transcodingURLs.isolatedCopy(), transcodingUTI = transcodingUTI.isolatedCopy(), transcodingExtension = transcodingExtension.isolatedCopy()]() mutable {
+    sharedImageTranscodingQueue().dispatch([this, protectedThis = makeRef(*this), fileURLs = fileURLs.isolatedCopy(), transcodingURLs = transcodingURLs.isolatedCopy(), transcodingUTI = transcodingUTI.isolatedCopy(), transcodingExtension = transcodingExtension.isolatedCopy()]() mutable {
         ASSERT(!RunLoop::isMain());
 
         auto transcodedURLs = transcodeImages(transcodingURLs, transcodingUTI, transcodingExtension);

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (265421 => 265422)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2020-08-10 04:48:37 UTC (rev 265421)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2020-08-10 05:12:35 UTC (rev 265422)
@@ -2850,9 +2850,6 @@
     bool m_userScriptsNotified { false };
     bool m_limitsNavigationsToAppBoundDomains { false };
     bool m_hasExecutedAppBoundBehaviorBeforeNavigation { false };
-#if PLATFORM(MAC)
-    Ref<WorkQueue> m_transcodingQueue;
-#endif
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (265421 => 265422)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2020-08-10 04:48:37 UTC (rev 265421)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2020-08-10 05:12:35 UTC (rev 265422)
@@ -290,7 +290,6 @@
 		1A9FBA8D13FF04E600DEED67 /* PluginComplexTextInputState.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A9FBA8C13FF04E600DEED67 /* PluginComplexTextInputState.h */; };
 		1AA13212191D5924009C1489 /* WKNavigationResponsePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA13211191D5924009C1489 /* WKNavigationResponsePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		1AA20D5118AD50E0005D1ED4 /* WKNavigationDelegatePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA20D5018AD50E0005D1ED4 /* WKNavigationDelegatePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		1AA2E51D12E4C05E00BC4966 /* ImageUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA2E51B12E4C05E00BC4966 /* ImageUtilities.h */; };
 		1AA2E56718D77508003814BD /* WKWebProcessBundleParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA2E56518D77508003814BD /* WKWebProcessBundleParameters.h */; };
 		1AA3D75C1651B44F008713D0 /* RemoteLayerTreeHost.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA3D75A1651B44F008713D0 /* RemoteLayerTreeHost.h */; };
 		1AA417CB12C00CCA002BE67B /* TextChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AA417C912C00CCA002BE67B /* TextChecker.h */; };
@@ -2516,8 +2515,6 @@
 		1AA1CC5C100FA1A10078DEBC /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; };
 		1AA1CD06100FA1BA0078DEBC /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
 		1AA20D5018AD50E0005D1ED4 /* WKNavigationDelegatePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNavigationDelegatePrivate.h; sourceTree = "<group>"; };
-		1AA2E51B12E4C05E00BC4966 /* ImageUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageUtilities.h; sourceTree = "<group>"; };
-		1AA2E51C12E4C05E00BC4966 /* ImageUtilitiesCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageUtilitiesCG.cpp; sourceTree = "<group>"; };
 		1AA2E56418D77508003814BD /* WKWebProcessBundleParameters.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebProcessBundleParameters.mm; sourceTree = "<group>"; };
 		1AA2E56518D77508003814BD /* WKWebProcessBundleParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebProcessBundleParameters.h; sourceTree = "<group>"; };
 		1AA3D7591651B44F008713D0 /* RemoteLayerTreeHost.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteLayerTreeHost.mm; sourceTree = "<group>"; };
@@ -5960,14 +5957,6 @@
 			path = mac;
 			sourceTree = "<group>";
 		};
-		1AA2E51A12E4C05600BC4966 /* cg */ = {
-			isa = PBXGroup;
-			children = (
-				1AA2E51C12E4C05E00BC4966 /* ImageUtilitiesCG.cpp */,
-			);
-			path = cg;
-			sourceTree = "<group>";
-		};
 		1AAC4DDE16B1CBF6009425E3 /* WebStorage */ = {
 			isa = PBXGroup;
 			children = (
@@ -9588,7 +9577,6 @@
 			isa = PBXGroup;
 			children = (
 				3709504118A88BA40087AE5D /* cf */,
-				1AA2E51A12E4C05600BC4966 /* cg */,
 				6BE969C21E54D467008B7483 /* classifier */,
 				4450AEBE1DC3FAAC009943F2 /* cocoa */,
 				3709504218A88CDE0087AE5D /* foundation */,
@@ -9599,7 +9587,6 @@
 				51B15A7D138439B200321AD8 /* unix */,
 				ECA680D31E6904B500731D20 /* ExtraPrivateSymbolsForTAPI.h */,
 				ECBFC1DB1E6A4D66000300C7 /* ExtraPublicSymbolsForTAPI.h */,
-				1AA2E51B12E4C05E00BC4966 /* ImageUtilities.h */,
 				51A7F2F4125BF8D4008AEB1D /* Logging.cpp */,
 				51A7F2F2125BF820008AEB1D /* Logging.h */,
 				0FDCD7F61D47E92A009F08BC /* LogInitialization.h */,
@@ -10865,7 +10852,6 @@
 				51C0C9741DDD76000032CAD3 /* IconLoadingDelegate.h in Headers */,
 				51E351CB180F2CCC00E53BE9 /* IDBUtilities.h in Headers */,
 				BCCF6B2512C93E7A008F9C35 /* ImageOptions.h in Headers */,
-				1AA2E51D12E4C05E00BC4966 /* ImageUtilities.h in Headers */,
 				1A1EC69E1872092100B951F0 /* ImportanceAssertion.h in Headers */,
 				BC204EE311C83E98008F3375 /* InjectedBundle.h in Headers */,
 				BCEE7DC5128B645D009827DA /* InjectedBundleClient.h in Headers */,
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to