Changeset 249140 in webkit


Ignore:
Timestamp:
Aug 27, 2019 7:59:32 AM (5 years ago)
Author:
Wenson Hsieh
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).

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r249135 r249140  
     12019-08-27  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Image pasted from screenshot into Mail compose window via share sheet has the wrong aspect ratio
     4        https://bugs.webkit.org/show_bug.cgi?id=201171
     5        <rdar://problem/54671275>
     6
     7        Reviewed by Tim Horton.
     8
     9        Augments an existing app-specific hack to include the Mail composition service, in addition to Mail.
     10
     11        * platform/RuntimeApplicationChecks.h:
     12        * platform/cocoa/RuntimeApplicationChecksCocoa.mm:
     13        (WebCore::IOSApplication::isMailCompositionService):
     14
     15        Add a new bundle checking method for the Mail composition service (com.apple.MailCompositionService).
     16
     17        * platform/ios/PlatformPasteboardIOS.mm:
     18        (WebCore::PlatformPasteboard::informationForItemAtIndex):
     19
     20        Only plumb the preferred presentation height through to the web process if the application is neither Mail nor
     21        the Mail composition service. In the future, we should consider putting this hack behind SPI, or maybe only
     22        expose the preferred presentation width in all apps (it isn't difficult to imagine a use case where a "Mail-
     23        compose-like" web app has `img { max-width: 100%; }` in their stylesheet).
     24
    1252019-08-27  Carlos Garcia Campos  <cgarcia@igalia.com>
    226
  • trunk/Source/WebCore/platform/RuntimeApplicationChecks.h

    r248471 r249140  
    7878
    7979WEBCORE_EXPORT bool isMobileMail();
     80WEBCORE_EXPORT bool isMailCompositionService();
    8081WEBCORE_EXPORT bool isMobileSafari();
    8182WEBCORE_EXPORT bool isIMDb();
  • trunk/Source/WebCore/platform/cocoa/RuntimeApplicationChecksCocoa.mm

    r248471 r249140  
    203203}
    204204
     205bool IOSApplication::isMailCompositionService()
     206{
     207    static bool isMailCompositionService = applicationBundleIsEqualTo("com.apple.MailCompositionService"_s);
     208    return isMailCompositionService;
     209}
     210
    205211bool IOSApplication::isMobileSafari()
    206212{
  • trunk/Source/WebCore/platform/ios/PlatformPasteboardIOS.mm

    r246892 r249140  
    159159    if (!CGSizeEqualToSize(itemProvider.preferredPresentationSize, CGSizeZero)) {
    160160        auto adjustedPreferredPresentationHeight = [](auto height) -> Optional<double> {
    161             if (!IOSApplication::isMobileMail())
     161            if (!IOSApplication::isMobileMail() && !IOSApplication::isMailCompositionService())
    162162                return { height };
    163163            // 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.
Note: See TracChangeset for help on using the changeset viewer.