Title: [231583] trunk/Source/WebKit
Revision
231583
Author
[email protected]
Date
2018-05-09 12:08:30 -0700 (Wed, 09 May 2018)

Log Message

[iOS] Consider the annotation bounds when positioning action sheets near long-pressed PDF links
https://bugs.webkit.org/show_bug.cgi?id=185472
<rdar://problem/39967092>

Reviewed by Daniel Bates.

Adopted new PDFHostViewControllerDelegate methods that include annotation rects
when URLs and page indices are long-pressed. This allows us to avoid obscuring
annotations when positioning action sheet popovers.

We also no longer need to convert the press location into host view coordinate
space, as PDFKit now does that for us.

* UIProcess/ios/WKPDFView.mm:
(-[WKPDFView _showActionSheetForURL:atLocation:withAnnotationRect:]):
(-[WKPDFView pdfHostViewController:didLongPressURL:atLocation:withAnnotationRect:]):
(-[WKPDFView pdfHostViewController:didLongPressPageIndex:atLocation:withAnnotationRect:]):
(-[WKPDFView _showActionSheetForURL:atLocation:]): Deleted.
(-[WKPDFView pdfHostViewController:didLongPressURL:atLocation:]): Deleted.
(-[WKPDFView pdfHostViewController:didLongPressPageIndex:atLocation:]): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (231582 => 231583)


--- trunk/Source/WebKit/ChangeLog	2018-05-09 19:08:02 UTC (rev 231582)
+++ trunk/Source/WebKit/ChangeLog	2018-05-09 19:08:30 UTC (rev 231583)
@@ -1,5 +1,28 @@
 2018-05-09  Andy Estes  <[email protected]>
 
+        [iOS] Consider the annotation bounds when positioning action sheets near long-pressed PDF links
+        https://bugs.webkit.org/show_bug.cgi?id=185472
+        <rdar://problem/39967092>
+
+        Reviewed by Daniel Bates.
+
+        Adopted new PDFHostViewControllerDelegate methods that include annotation rects
+        when URLs and page indices are long-pressed. This allows us to avoid obscuring
+        annotations when positioning action sheet popovers.
+
+        We also no longer need to convert the press location into host view coordinate
+        space, as PDFKit now does that for us.
+
+        * UIProcess/ios/WKPDFView.mm:
+        (-[WKPDFView _showActionSheetForURL:atLocation:withAnnotationRect:]):
+        (-[WKPDFView pdfHostViewController:didLongPressURL:atLocation:withAnnotationRect:]):
+        (-[WKPDFView pdfHostViewController:didLongPressPageIndex:atLocation:withAnnotationRect:]):
+        (-[WKPDFView _showActionSheetForURL:atLocation:]): Deleted.
+        (-[WKPDFView pdfHostViewController:didLongPressURL:atLocation:]): Deleted.
+        (-[WKPDFView pdfHostViewController:didLongPressPageIndex:atLocation:]): Deleted.
+
+2018-05-09  Andy Estes  <[email protected]>
+
         [iOS] Tell PDFHostViewController when animated resizes begin and end
         https://bugs.webkit.org/show_bug.cgi?id=185477
         <rdar://problem/39875372>

Modified: trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm (231582 => 231583)


--- trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm	2018-05-09 19:08:02 UTC (rev 231582)
+++ trunk/Source/WebKit/UIProcess/ios/WKPDFView.mm	2018-05-09 19:08:30 UTC (rev 231583)
@@ -420,17 +420,15 @@
     [self _goToURL:[self _URLWithPageIndex:pageIndex] atLocation:documentViewRect.origin];
 }
 
-- (void)_showActionSheetForURL:(NSURL *)url atLocation:(CGPoint)location
+- (void)_showActionSheetForURL:(NSURL *)url atLocation:(CGPoint)location withAnnotationRect:(CGRect)annotationRect
 {
     WKWebView *webView = _webView.getAutoreleased();
     if (!webView)
         return;
 
-    CGPoint locationInHostView = [webView.scrollView convertPoint:location toView:[_hostViewController view]];
-
     WebKit::InteractionInformationAtPosition positionInformation;
-    positionInformation.bounds = WebCore::roundedIntRect(CGRect { locationInHostView, CGSizeMake(0, 0) });
-    positionInformation.request.point = WebCore::roundedIntPoint(locationInHostView);
+    positionInformation.bounds = WebCore::roundedIntRect(annotationRect);
+    positionInformation.request.point = WebCore::roundedIntPoint(location);
     positionInformation.url = ""
 
     _positionInformation = WTFMove(positionInformation);
@@ -437,14 +435,14 @@
     [_actionSheetAssistant showLinkSheet];
 }
 
-- (void)pdfHostViewController:(PDFHostViewController *)controller didLongPressURL:(NSURL *)url atLocation:(CGPoint)location
+- (void)pdfHostViewController:(PDFHostViewController *)controller didLongPressURL:(NSURL *)url atLocation:(CGPoint)location withAnnotationRect:(CGRect)annotationRect
 {
-    [self _showActionSheetForURL:url atLocation:location];
+    [self _showActionSheetForURL:url atLocation:location withAnnotationRect:annotationRect];
 }
 
-- (void)pdfHostViewController:(PDFHostViewController *)controller didLongPressPageIndex:(NSInteger)pageIndex atLocation:(CGPoint)location
+- (void)pdfHostViewController:(PDFHostViewController *)controller didLongPressPageIndex:(NSInteger)pageIndex atLocation:(CGPoint)location withAnnotationRect:(CGRect)annotationRect
 {
-    [self _showActionSheetForURL:[self _URLWithPageIndex:pageIndex] atLocation:location];
+    [self _showActionSheetForURL:[self _URLWithPageIndex:pageIndex] atLocation:location withAnnotationRect:annotationRect];
 }
 
 #pragma mark WKActionSheetAssistantDelegate
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to