Title: [250401] trunk
Revision
250401
Author
[email protected]
Date
2019-09-26 15:19:32 -0700 (Thu, 26 Sep 2019)

Log Message

ContextMenu on a link in an email no longer shows web preview
https://bugs.webkit.org/show_bug.cgi?id=201120
<rdar://54353617>

Reviewed by Wenson Hsieh.

Source/WebKit:

Only go down the image path if we are not also a link.

* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView continueContextMenuInteraction:]):

Tools:

Test context menus on a link that is also an image.

* TestWebKitAPI/Tests/WebKitCocoa/ContextMenus.mm:
(contextMenuWebViewDriver):
(-[TestContextMenuImageWithoutConfigurationUIDelegate webView:contextMenuConfigurationForElement:completionHandler:]):
(-[TestContextMenuImageWithoutConfigurationUIDelegate webView:contextMenuWillPresentForElement:]):
(-[TestContextMenuImageWithoutConfigurationUIDelegate webView:contextMenuForElement:willCommitWithAnimator:]):
(-[TestContextMenuImageWithoutConfigurationUIDelegate webView:contextMenuDidEndForElement:]):
(TEST):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (250400 => 250401)


--- trunk/Source/WebKit/ChangeLog	2019-09-26 21:54:31 UTC (rev 250400)
+++ trunk/Source/WebKit/ChangeLog	2019-09-26 22:19:32 UTC (rev 250401)
@@ -1,3 +1,16 @@
+2019-09-26  Dean Jackson  <[email protected]>
+
+        ContextMenu on a link in an email no longer shows web preview
+        https://bugs.webkit.org/show_bug.cgi?id=201120
+        <rdar://54353617>
+
+        Reviewed by Wenson Hsieh.
+
+        Only go down the image path if we are not also a link.
+
+        * UIProcess/ios/WKContentViewInteraction.mm:
+        (-[WKContentView continueContextMenuInteraction:]):
+
 2019-09-26  Chris Dumez  <[email protected]>
 
         Stop using testRunner.overridePreference() to turn on Page Cache

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (250400 => 250401)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-09-26 21:54:31 UTC (rev 250400)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-09-26 22:19:32 UTC (rev 250401)
@@ -8274,7 +8274,7 @@
             return;
         }
 
-        if (strongSelf->_positionInformation.isImage) {
+        if (strongSelf->_positionInformation.isImage && !strongSelf->_positionInformation.isLink) {
             ASSERT(strongSelf->_positionInformation.image);
             auto cgImage = strongSelf->_positionInformation.image->makeCGImageCopy();
 

Modified: trunk/Tools/ChangeLog (250400 => 250401)


--- trunk/Tools/ChangeLog	2019-09-26 21:54:31 UTC (rev 250400)
+++ trunk/Tools/ChangeLog	2019-09-26 22:19:32 UTC (rev 250401)
@@ -1,3 +1,21 @@
+2019-09-26  Dean Jackson  <[email protected]>
+
+        ContextMenu on a link in an email no longer shows web preview
+        https://bugs.webkit.org/show_bug.cgi?id=201120
+        <rdar://54353617>
+
+        Reviewed by Wenson Hsieh.
+
+        Test context menus on a link that is also an image.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/ContextMenus.mm:
+        (contextMenuWebViewDriver):
+        (-[TestContextMenuImageWithoutConfigurationUIDelegate webView:contextMenuConfigurationForElement:completionHandler:]):
+        (-[TestContextMenuImageWithoutConfigurationUIDelegate webView:contextMenuWillPresentForElement:]):
+        (-[TestContextMenuImageWithoutConfigurationUIDelegate webView:contextMenuForElement:willCommitWithAnimator:]):
+        (-[TestContextMenuImageWithoutConfigurationUIDelegate webView:contextMenuDidEndForElement:]):
+        (TEST):
+
 2019-09-26  Frederic Wang  <[email protected]>
 
         run-safari --ios-simulator is no longer working with Xcode 11

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ContextMenus.mm (250400 => 250401)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ContextMenus.mm	2019-09-26 21:54:31 UTC (rev 250400)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ContextMenus.mm	2019-09-26 22:19:32 UTC (rev 250401)
@@ -180,7 +180,51 @@
     EXPECT_FALSE(didEndCalled);
 }
 
+@interface TestContextMenuImageWithoutConfigurationUIDelegate : NSObject <WKUIDelegate>
+@end
 
+@implementation TestContextMenuImageWithoutConfigurationUIDelegate
+
+- (void)webView:(WKWebView *)webView contextMenuConfigurationForElement:(WKContextMenuElementInfo *)elementInfo completionHandler:(void(^)(UIContextMenuConfiguration * _Nullable))completionHandler
+{
+    EXPECT_TRUE([elementInfo.linkURL.absoluteString isEqualToString:[linkURL absoluteString]]);
+    contextMenuRequested = true;
+    // check that it is an image
+    completionHandler(nil);
+}
+
+- (void)webView:(WKWebView *)webView contextMenuWillPresentForElement:(WKContextMenuElementInfo *)elementInfo
+{
+    willPresentCalled = true;
+}
+
+- (void)webView:(WKWebView *)webView contextMenuForElement:(WKContextMenuElementInfo *)elementInfo willCommitWithAnimator:(id<UIContextMenuInteractionCommitAnimating>)animator
+{
+    willCommitCalled = true;
+}
+
+- (void)webView:(WKWebView *)webView contextMenuDidEndForElement:(WKContextMenuElementInfo *)elementInfo
+{
+    didEndCalled = true;
+}
+
+@end
+
+TEST(WebKit, ContextMenuImage)
+{
+    auto driver = contextMenuWebViewDriver([TestContextMenuImageWithoutConfigurationUIDelegate class], @"<a href=''><img width='500' height='500' src=''></a>");
+    [driver begin:^(BOOL result) {
+        EXPECT_TRUE(result);
+        [driver clickDown];
+        [driver clickUp];
+    }];
+    TestWebKitAPI::Util::run(&willPresentCalled);
+    EXPECT_TRUE(contextMenuRequested);
+    EXPECT_TRUE(willPresentCalled);
+    EXPECT_FALSE(willCommitCalled);
+    EXPECT_FALSE(didEndCalled);
+}
+
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-declarations"
 #pragma clang diagnostic ignored "-Wdeprecated-implementations"
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to