Title: [237026] trunk/Source/WebKit
Revision
237026
Author
[email protected]
Date
2018-10-10 20:03:58 -0700 (Wed, 10 Oct 2018)

Log Message

Safari crashes when attempting to share a YouTube video while in full-screen
https://bugs.webkit.org/show_bug.cgi?id=190456
<rdar://problem/45130748>

Reviewed by Wenson Hsieh.

* Platform/spi/ios/UIKitSPI.h:
* UIProcess/Cocoa/WKShareSheet.mm:
(-[WKShareSheet presentWithParameters:completionHandler:]):
Allow the share sheet to present centered, since we don't have enough
context to put it in a more sensible place.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (237025 => 237026)


--- trunk/Source/WebKit/ChangeLog	2018-10-11 02:27:18 UTC (rev 237025)
+++ trunk/Source/WebKit/ChangeLog	2018-10-11 03:03:58 UTC (rev 237026)
@@ -1,5 +1,19 @@
 2018-10-10  Tim Horton  <[email protected]>
 
+        Safari crashes when attempting to share a YouTube video while in full-screen
+        https://bugs.webkit.org/show_bug.cgi?id=190456
+        <rdar://problem/45130748>
+
+        Reviewed by Wenson Hsieh.
+
+        * Platform/spi/ios/UIKitSPI.h:
+        * UIProcess/Cocoa/WKShareSheet.mm:
+        (-[WKShareSheet presentWithParameters:completionHandler:]):
+        Allow the share sheet to present centered, since we don't have enough
+        context to put it in a more sensible place.
+
+2018-10-10  Tim Horton  <[email protected]>
+
         REGRESSION (r236935): Layout test fast/events/ios/keyboard-scrolling-distance.html is timing out
         https://bugs.webkit.org/show_bug.cgi?id=190444
         <rdar://problem/45110698>

Modified: trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h (237025 => 237026)


--- trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2018-10-11 02:27:18 UTC (rev 237025)
+++ trunk/Source/WebKit/Platform/spi/ios/UIKitSPI.h	2018-10-11 03:03:58 UTC (rev 237026)
@@ -52,6 +52,7 @@
 #import <UIKit/UIPeripheralHost_Private.h>
 #import <UIKit/UIPickerContentView_Private.h>
 #import <UIKit/UIPickerView_Private.h>
+#import <UIKit/UIPopoverPresentationController_Private.h>
 #import <UIKit/UIPresentationController_Private.h>
 #import <UIKit/UIResponder_Private.h>
 #import <UIKit/UIScrollView_Private.h>
@@ -1003,6 +1004,10 @@
 + (UIBlurEffect *)effectWithBlurRadius:(CGFloat)blurRadius;
 @end
 
+@interface UIPopoverPresentationController ()
+@property (assign, nonatomic, setter=_setCentersPopoverIfSourceViewNotSet:, getter=_centersPopoverIfSourceViewNotSet) BOOL _centersPopoverIfSourceViewNotSet;
+@end
+
 #endif // USE(APPLE_INTERNAL_SDK)
 
 @interface UIPhysicalKeyboardEvent : UIPressesEvent

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WKShareSheet.mm (237025 => 237026)


--- trunk/Source/WebKit/UIProcess/Cocoa/WKShareSheet.mm	2018-10-11 02:27:18 UTC (rev 237025)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKShareSheet.mm	2018-10-11 03:03:58 UTC (rev 237026)
@@ -95,6 +95,8 @@
         return;
     }
     
+    WKWebView *webView = _webView.getAutoreleased();
+    
 #if PLATFORM(MAC)
     _sharingServicePicker = adoptNS([[NSSharingServicePicker alloc] initWithItems:shareDataArray.get()]);
     _sharingServicePicker.get().delegate = self;
@@ -101,9 +103,9 @@
     
     NSPoint location = [NSEvent mouseLocation];
     NSRect mouseLocationRect = NSMakeRect(location.x, location.y, 1.0, 1.0);
-    NSRect mouseLocationInWindow = [[_webView window] convertRectFromScreen:mouseLocationRect];
-    NSRect mouseLocationInView = [_webView convertRect:mouseLocationInWindow fromView:nil];
-    [_sharingServicePicker showRelativeToRect:mouseLocationInView ofView:_webView.getAutoreleased() preferredEdge:NSMinYEdge];
+    NSRect mouseLocationInWindow = [webView.window convertRectFromScreen:mouseLocationRect];
+    NSRect mouseLocationInView = [webView convertRect:mouseLocationInWindow fromView:nil];
+    [_sharingServicePicker showRelativeToRect:mouseLocationInView ofView:webView preferredEdge:NSMinYEdge];
 #else
     _shareSheetViewController = adoptNS([[UIActivityViewController alloc] initWithActivityItems:shareDataArray.get() applicationActivities:nil]);
     [_shareSheetViewController setCompletionWithItemsHandler:^(NSString *, BOOL completed, NSArray *, NSError *) {
@@ -110,7 +112,11 @@
         [self _didCompleteWithSuccess:completed];
         [self dispatchDidDismiss];
     }];
-    _presentationViewController = [UIViewController _viewControllerForFullScreenPresentationFromView:_webView.getAutoreleased()];
+    
+    UIPopoverPresentationController *popoverController = [_shareSheetViewController popoverPresentationController];
+    popoverController._centersPopoverIfSourceViewNotSet = YES;
+    
+    _presentationViewController = [UIViewController _viewControllerForFullScreenPresentationFromView:webView];
     [_presentationViewController presentViewController:_shareSheetViewController.get() animated:YES completion:nil];
 #endif
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to