Title: [238941] trunk/Source/WebKit
- Revision
- 238941
- Author
- [email protected]
- Date
- 2018-12-06 14:11:45 -0800 (Thu, 06 Dec 2018)
Log Message
Web Share API: share overlay does not stick to the Safari window
https://bugs.webkit.org/show_bug.cgi?id=192469
<rdar://problem/46074833>
Reviewed by Wenson Hsieh.
* UIProcess/Cocoa/WKShareSheet.mm:
(-[WKShareSheet sharingServicePicker:didChooseSharingService:]):
(-[WKShareSheet sharingServicePicker:delegateForSharingService:]):
(-[WKShareSheet sharingService:sourceWindowForShareItems:sharingContentScope:]):
(-[WKShareSheet sharingService:didFailToShareItems:error:]):
(-[WKShareSheet sharingService:didShareItems:]):
Implement another NSSharingServicePickerDelegate method to return
an *NSSharingService* delegate when needed.
Implement an NSSharingServiceDelegate method to return the window that
the service's UI should attach to.
Also, instead of notifying the Web Content process when a service is picked
(or not) in the NSSharingServicePicker, wait until the share has completed
(or failed) to send didComplete. This both makes the return completion
value more accurate (matching iOS, if you cancel the share during the
recipient choice step, it will now fail), and avoids explicitly tearing
down the NSSharingServicePicker too early, which breaks the UI attaching mechanism.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (238940 => 238941)
--- trunk/Source/WebKit/ChangeLog 2018-12-06 22:09:19 UTC (rev 238940)
+++ trunk/Source/WebKit/ChangeLog 2018-12-06 22:11:45 UTC (rev 238941)
@@ -1,3 +1,30 @@
+2018-12-06 Tim Horton <[email protected]>
+
+ Web Share API: share overlay does not stick to the Safari window
+ https://bugs.webkit.org/show_bug.cgi?id=192469
+ <rdar://problem/46074833>
+
+ Reviewed by Wenson Hsieh.
+
+ * UIProcess/Cocoa/WKShareSheet.mm:
+ (-[WKShareSheet sharingServicePicker:didChooseSharingService:]):
+ (-[WKShareSheet sharingServicePicker:delegateForSharingService:]):
+ (-[WKShareSheet sharingService:sourceWindowForShareItems:sharingContentScope:]):
+ (-[WKShareSheet sharingService:didFailToShareItems:error:]):
+ (-[WKShareSheet sharingService:didShareItems:]):
+ Implement another NSSharingServicePickerDelegate method to return
+ an *NSSharingService* delegate when needed.
+
+ Implement an NSSharingServiceDelegate method to return the window that
+ the service's UI should attach to.
+
+ Also, instead of notifying the Web Content process when a service is picked
+ (or not) in the NSSharingServicePicker, wait until the share has completed
+ (or failed) to send didComplete. This both makes the return completion
+ value more accurate (matching iOS, if you cancel the share during the
+ recipient choice step, it will now fail), and avoids explicitly tearing
+ down the NSSharingServicePicker too early, which breaks the UI attaching mechanism.
+
2018-12-06 Wenson Hsieh <[email protected]>
[iOS] WKWebView should match UITextView behavior when editing text with an RTL keyboard
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WKShareSheet.mm (238940 => 238941)
--- trunk/Source/WebKit/UIProcess/Cocoa/WKShareSheet.mm 2018-12-06 22:09:19 UTC (rev 238940)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKShareSheet.mm 2018-12-06 22:11:45 UTC (rev 238941)
@@ -42,7 +42,7 @@
#endif
#if PLATFORM(MAC)
-@interface WKShareSheet () <NSSharingServicePickerDelegate>
+@interface WKShareSheet () <NSSharingServiceDelegate, NSSharingServicePickerDelegate>
@end
#endif
@@ -124,9 +124,35 @@
#if PLATFORM(MAC)
- (void)sharingServicePicker:(NSSharingServicePicker *)sharingServicePicker didChooseSharingService:(NSSharingService *)service
{
- [self _didCompleteWithSuccess:!!service];
+ if (service)
+ return;
+
+ [self _didCompleteWithSuccess:NO];
[self dispatchDidDismiss];
}
+
+- (id <NSSharingServiceDelegate>)sharingServicePicker:(NSSharingServicePicker *)sharingServicePicker delegateForSharingService:(NSSharingService *)sharingService
+{
+ return self;
+}
+
+- (NSWindow *)sharingService:(NSSharingService *)sharingService sourceWindowForShareItems:(NSArray *)items sharingContentScope:(NSSharingContentScope *)sharingContentScope
+{
+ return [_webView window];
+}
+
+- (void)sharingService:(NSSharingService *)sharingService didFailToShareItems:(NSArray *)items error:(NSError *)error
+{
+ [self _didCompleteWithSuccess:NO];
+ [self dispatchDidDismiss];
+}
+
+- (void)sharingService:(NSSharingService *)sharingService didShareItems:(NSArray *)items
+{
+ [self _didCompleteWithSuccess:YES];
+ [self dispatchDidDismiss];
+}
+
#endif
- (void)_didCompleteWithSuccess:(BOOL)success
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes