Title: [295370] trunk/Source
Revision
295370
Author
[email protected]
Date
2022-06-07 17:33:40 -0700 (Tue, 07 Jun 2022)

Log Message

Upstream support for new share sheet behaviors in macOS Ventura
https://bugs.webkit.org/show_bug.cgi?id=241384
rdar://94558182

Reviewed by Wenson Hsieh.

Upstream new share sheet changes. Remove staging code now that
changes have been in the build for a significant amount of time.

* Source/WTF/wtf/PlatformHave.h:
* Source/WebKit/UIProcess/Cocoa/WKShareSheet.h:
* Source/WebKit/UIProcess/Cocoa/WKShareSheet.mm:
(-[WKShareSheet presentWithShareDataArray:inRect:]):
(-[WKShareSheet canShowPickerAsync:]): Deleted.
(-[WKShareSheet showPickerAsync:showRelativeToRect:ofView:completion:]): Deleted.

Canonical link: https://commits.webkit.org/251378@main

Modified Paths

Diff

Modified: trunk/Source/WTF/wtf/PlatformHave.h (295369 => 295370)


--- trunk/Source/WTF/wtf/PlatformHave.h	2022-06-08 00:26:51 UTC (rev 295369)
+++ trunk/Source/WTF/wtf/PlatformHave.h	2022-06-08 00:33:40 UTC (rev 295370)
@@ -1218,3 +1218,7 @@
 #if !defined(HAVE_UIKIT_RESIZABLE_WINDOWS) && PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 160000
 #define HAVE_UIKIT_RESIZABLE_WINDOWS 1
 #endif
+
+#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 130000)
+#define HAVE_SHARING_SERVICE_PICKER_POPOVER_SPI 1
+#endif

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WKShareSheet.h (295369 => 295370)


--- trunk/Source/WebKit/UIProcess/Cocoa/WKShareSheet.h	2022-06-08 00:26:51 UTC (rev 295369)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKShareSheet.h	2022-06-08 00:33:40 UTC (rev 295370)
@@ -41,11 +41,6 @@
 - (void)presentWithParameters:(const WebCore::ShareDataWithParsedURL&)data inRect:(std::optional<WebCore::FloatRect>)rect completionHandler:(WTF::CompletionHandler<void(bool)>&&)completionHandler;
 - (void)dismiss;
 
-#if PLATFORM(MAC)
-- (BOOL)canShowPickerAsync:(NSSharingServicePicker *)picker;
-- (void)showPickerAsync:(NSSharingServicePicker *)picker showRelativeToRect:(NSRect)presentationRect ofView:(WKWebView *)webView completion:(void (^)(void))completionHandler;
-#endif
-
 @property (nonatomic, weak) id <WKShareSheetDelegate> delegate;
 @end
 

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WKShareSheet.mm (295369 => 295370)


--- trunk/Source/WebKit/UIProcess/Cocoa/WKShareSheet.mm	2022-06-08 00:26:51 UTC (rev 295369)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKShareSheet.mm	2022-06-08 00:33:40 UTC (rev 295370)
@@ -46,10 +46,6 @@
 #import <pal/spi/mac/NSSharingServicePickerSPI.h>
 #endif
 
-#if USE(APPLE_INTERNAL_SDK) && PLATFORM(MAC)
-#import <WebKitAdditions/WKShareSheetAdditionsBefore.mm>
-#endif
-
 #if PLATFORM(MAC)
 @interface WKShareSheet () <NSSharingServiceDelegate, NSSharingServicePickerDelegate>
 @end
@@ -183,11 +179,12 @@
         presentationRect = [webView convertRect:mouseLocationInWindow fromView:nil];
     }
 
-    if ([self canShowPickerAsync:_sharingServicePicker.get()])
-        [self showPickerAsync:_sharingServicePicker.get() showRelativeToRect:presentationRect ofView:webView completion:^{ }];
-    else
-        [_sharingServicePicker showRelativeToRect:presentationRect ofView:webView preferredEdge:NSMinYEdge];
+#if HAVE(SHARING_SERVICE_PICKER_POPOVER_SPI)
+    [_sharingServicePicker.get() showPopoverRelativeToRect:presentationRect ofView:webView preferredEdge:NSMinYEdge completion:^(NSSharingService *sharingService) { }];
 #else
+    [_sharingServicePicker showRelativeToRect:presentationRect ofView:webView preferredEdge:NSMinYEdge];
+#endif
+#else
     _shareSheetViewController = adoptNS([[UIActivityViewController alloc] initWithActivityItems:sharingItems applicationActivities:nil]);
 
 #if HAVE(UIACTIVITYTYPE_SHAREPLAY)
@@ -370,21 +367,6 @@
     return fileURL;
 }
 
-#if PLATFORM(MAC)
-#if USE(APPLE_INTERNAL_SDK)
-#import <WebKitAdditions/WKShareSheetAdditions.mm>
-#else
-- (BOOL)canShowPickerAsync:(NSSharingServicePicker *)picker
-{
-    return false;
-}
-- (void)showPickerAsync:(NSSharingServicePicker *)picker showRelativeToRect:(NSRect)presentationRect ofView:(WKWebView *)webView completion:(void (^)(void))completionHandler
-{
-
-}
-#endif
-#endif
-
 @end
 
 #endif // PLATFORM(COCOA) && !PLATFORM(WATCHOS) && !PLATFORM(APPLETV)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to