Title: [260146] trunk/Source/WebKit
Revision
260146
Author
[email protected]
Date
2020-04-15 13:20:21 -0700 (Wed, 15 Apr 2020)

Log Message

Data Detected Actions sheets are presented from odd locations.
https://bugs.webkit.org/show_bug.cgi?id=210531
<rdar://problem/60941346>

Reviewed by Wenson Hsieh.

Use the existing context menu targeted preview code to ensure that the
data detected menus are presented in a good location.

* UIProcess/ios/WKActionSheetAssistant.h:
* UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (260145 => 260146)


--- trunk/Source/WebKit/ChangeLog	2020-04-15 19:51:24 UTC (rev 260145)
+++ trunk/Source/WebKit/ChangeLog	2020-04-15 20:20:21 UTC (rev 260146)
@@ -1,3 +1,20 @@
+2020-04-14  Megan Gardner  <[email protected]>
+
+        Data Detected Actions sheets are presented from odd locations.
+        https://bugs.webkit.org/show_bug.cgi?id=210531
+        <rdar://problem/60941346>
+
+        Reviewed by Wenson Hsieh.
+
+        Use the existing context menu targeted preview code to ensure that the
+        data detected menus are presented in a good location.
+
+        * UIProcess/ios/WKActionSheetAssistant.h:
+        * UIProcess/ios/WKActionSheetAssistant.mm:
+        (-[WKActionSheetAssistant contextMenuInteraction:previewForHighlightingMenuWithConfiguration:]):
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]):
+
 2020-04-15  Per Arne Vollan  <[email protected]>
 
         [iOS] Potential crash under WebProcess::platformInitializeWebProcess

Modified: trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h (260145 => 260146)


--- trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h	2020-04-15 19:51:24 UTC (rev 260145)
+++ trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.h	2020-04-15 20:20:21 UTC (rev 260146)
@@ -63,6 +63,7 @@
 - (NSString *)selectedTextForActionSheetAssistant:(WKActionSheetAssistant *)assistant;
 - (void)actionSheetAssistant:(WKActionSheetAssistant *)assistant getAlternateURLForImage:(UIImage *)image completion:(void (^)(NSURL *alternateURL, NSDictionary *userInfo))completion;
 - (CGPoint)contextMenuPresentationLocationForActionSheetAssistant:(WKActionSheetAssistant *)assistant;
+- (UITargetedPreview *)createTargetedContextMenuHintForActionSheetAssistant:(WKActionSheetAssistant *)assistant;
 
 @end
 

Modified: trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm (260145 => 260146)


--- trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm	2020-04-15 19:51:24 UTC (rev 260145)
+++ trunk/Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm	2020-04-15 20:20:21 UTC (rev 260146)
@@ -752,12 +752,15 @@
 {
     auto delegate = _delegate.get();
     CGPoint center = CGPointZero;
+    
+    if ([delegate respondsToSelector:@selector(createTargetedContextMenuHintForActionSheetAssistant:)])
+        return [delegate createTargetedContextMenuHintForActionSheetAssistant:self];
+    
     if ([delegate respondsToSelector:@selector(contextMenuPresentationLocationForActionSheetAssistant:)])
         center = [delegate contextMenuPresentationLocationForActionSheetAssistant:self];
     RetainPtr<UIPreviewParameters> unusedPreviewParameters = adoptNS([[UIPreviewParameters alloc] init]);
     RetainPtr<UIPreviewTarget> previewTarget = adoptNS([[UIPreviewTarget alloc] initWithContainer:_view.getAutoreleased() center:center]);
     RetainPtr<UITargetedPreview> preview = adoptNS([[UITargetedPreview alloc] initWithView:_view.getAutoreleased() parameters:unusedPreviewParameters.get() target:previewTarget.get()]);
-
     return preview.autorelease();
 }
 

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (260145 => 260146)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-04-15 19:51:24 UTC (rev 260145)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2020-04-15 20:20:21 UTC (rev 260146)
@@ -6899,6 +6899,11 @@
     return [self lastInteractionLocation];
 }
 
+- (UITargetedPreview *)createTargetedContextMenuHintForActionSheetAssistant:(WKActionSheetAssistant *)assistant
+{
+    return [self _createTargetedContextMenuHintPreviewIfPossible];
+}
+
 - (BOOL)_shouldUseContextMenus
 {
 #if HAVE(LINK_PREVIEW) && USE(UICONTEXTMENU)
@@ -9264,9 +9269,12 @@
         // and removing the hint container view will cause the animation to break.
         if (strongSelf->_contextMenuElementInfo)
             return;
-        // We are also using this container for the file upload panel
+        // We are also using this container for the file upload panel...
         if (strongSelf->_fileUploadPanel)
             return;
+        // and the action sheet assistant.
+        if (strongSelf->_actionSheetAssistant)
+            return;
         [std::exchange(strongSelf->_contextMenuHintContainerView, nil) removeFromSuperview];
     }];
 }

Modified: trunk/Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm (260145 => 260146)


--- trunk/Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm	2020-04-15 19:51:24 UTC (rev 260145)
+++ trunk/Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm	2020-04-15 20:20:21 UTC (rev 260146)
@@ -361,8 +361,9 @@
         CGFloat popoverWidth = [datePicker _contentWidth];
         CGFloat popoverHeight = _viewController.get().view.frame.size.height;
         [_viewController setPreferredContentSize:CGSizeMake(popoverWidth, popoverHeight)];
-    } else
-        [_viewController setPreferredContentSize:datePicker.frame.size];
+    } else {
+        [_viewController setPreferredContentSize:CGSizeMake(datePicker.frame.size.width+16, datePicker.frame.size.height)];
+    }
     
     [_viewController setEdgesForExtendedLayout:UIRectEdgeNone];
     [_viewController setTitle:_view.focusedElementInformation.title];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to