Title: [249140] trunk/Source/WebCore
Revision
249140
Author
[email protected]
Date
2019-08-27 07:59:32 -0700 (Tue, 27 Aug 2019)

Log Message

Image pasted from screenshot into Mail compose window via share sheet has the wrong aspect ratio
https://bugs.webkit.org/show_bug.cgi?id=201171
<rdar://problem/54671275>

Reviewed by Tim Horton.

Augments an existing app-specific hack to include the Mail composition service, in addition to Mail.

* platform/RuntimeApplicationChecks.h:
* platform/cocoa/RuntimeApplicationChecksCocoa.mm:
(WebCore::IOSApplication::isMailCompositionService):

Add a new bundle checking method for the Mail composition service (com.apple.MailCompositionService).

* platform/ios/PlatformPasteboardIOS.mm:
(WebCore::PlatformPasteboard::informationForItemAtIndex):

Only plumb the preferred presentation height through to the web process if the application is neither Mail nor
the Mail composition service. In the future, we should consider putting this hack behind SPI, or maybe only
expose the preferred presentation width in all apps (it isn't difficult to imagine a use case where a "Mail-
compose-like" web app has `img { max-width: 100%; }` in their stylesheet).

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (249139 => 249140)


--- trunk/Source/WebCore/ChangeLog	2019-08-27 12:31:51 UTC (rev 249139)
+++ trunk/Source/WebCore/ChangeLog	2019-08-27 14:59:32 UTC (rev 249140)
@@ -1,3 +1,27 @@
+2019-08-27  Wenson Hsieh  <[email protected]>
+
+        Image pasted from screenshot into Mail compose window via share sheet has the wrong aspect ratio
+        https://bugs.webkit.org/show_bug.cgi?id=201171
+        <rdar://problem/54671275>
+
+        Reviewed by Tim Horton.
+
+        Augments an existing app-specific hack to include the Mail composition service, in addition to Mail.
+
+        * platform/RuntimeApplicationChecks.h:
+        * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
+        (WebCore::IOSApplication::isMailCompositionService):
+
+        Add a new bundle checking method for the Mail composition service (com.apple.MailCompositionService).
+
+        * platform/ios/PlatformPasteboardIOS.mm:
+        (WebCore::PlatformPasteboard::informationForItemAtIndex):
+
+        Only plumb the preferred presentation height through to the web process if the application is neither Mail nor
+        the Mail composition service. In the future, we should consider putting this hack behind SPI, or maybe only
+        expose the preferred presentation width in all apps (it isn't difficult to imagine a use case where a "Mail-
+        compose-like" web app has `img { max-width: 100%; }` in their stylesheet).
+
 2019-08-27  Carlos Garcia Campos  <[email protected]>
 
         Origin header not included in WebSocket handshake request when using platform WebSocket API

Modified: trunk/Source/WebCore/platform/RuntimeApplicationChecks.h (249139 => 249140)


--- trunk/Source/WebCore/platform/RuntimeApplicationChecks.h	2019-08-27 12:31:51 UTC (rev 249139)
+++ trunk/Source/WebCore/platform/RuntimeApplicationChecks.h	2019-08-27 14:59:32 UTC (rev 249140)
@@ -77,6 +77,7 @@
 namespace IOSApplication {
 
 WEBCORE_EXPORT bool isMobileMail();
+WEBCORE_EXPORT bool isMailCompositionService();
 WEBCORE_EXPORT bool isMobileSafari();
 WEBCORE_EXPORT bool isIMDb();
 WEBCORE_EXPORT bool isWebBookmarksD();

Modified: trunk/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm (249139 => 249140)


--- trunk/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm	2019-08-27 12:31:51 UTC (rev 249139)
+++ trunk/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm	2019-08-27 14:59:32 UTC (rev 249140)
@@ -202,6 +202,12 @@
     return isMobileMail;
 }
 
+bool IOSApplication::isMailCompositionService()
+{
+    static bool isMailCompositionService = applicationBundleIsEqualTo("com.apple.MailCompositionService"_s);
+    return isMailCompositionService;
+}
+
 bool IOSApplication::isMobileSafari()
 {
     static bool isMobileSafari = applicationBundleIsEqualTo("com.apple.mobilesafari"_s);

Modified: trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm (249139 => 249140)


--- trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm	2019-08-27 12:31:51 UTC (rev 249139)
+++ trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm	2019-08-27 14:59:32 UTC (rev 249140)
@@ -158,7 +158,7 @@
 #endif
     if (!CGSizeEqualToSize(itemProvider.preferredPresentationSize, CGSizeZero)) {
         auto adjustedPreferredPresentationHeight = [](auto height) -> Optional<double> {
-            if (!IOSApplication::isMobileMail())
+            if (!IOSApplication::isMobileMail() && !IOSApplication::isMailCompositionService())
                 return { height };
             // Mail's max-width: 100%; default style is in conflict with the preferred presentation size and can lead to unexpectedly stretched images. Not setting the height forces layout to preserve the aspect ratio.
             return { };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to