Title: [250454] branches/safari-608-branch
Revision
250454
Author
[email protected]
Date
2019-09-27 13:25:55 -0700 (Fri, 27 Sep 2019)

Log Message

Cherry-pick r250401. rdar://problem/55770702

    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):

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250401 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Diff

Modified: branches/safari-608-branch/Source/WebKit/ChangeLog (250453 => 250454)


--- branches/safari-608-branch/Source/WebKit/ChangeLog	2019-09-27 20:25:52 UTC (rev 250453)
+++ branches/safari-608-branch/Source/WebKit/ChangeLog	2019-09-27 20:25:55 UTC (rev 250454)
@@ -1,5 +1,49 @@
 2019-09-27  Alan Coon  <[email protected]>
 
+        Cherry-pick r250401. rdar://problem/55770702
+
+    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):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250401 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-27  Alan Coon  <[email protected]>
+
         Cherry-pick r250392. rdar://problem/55770703
 
     [iOS 13] Tapping on a non-editable text selection should toggle callout bar visibility instead of clearing selection

Modified: branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (250453 => 250454)


--- branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-09-27 20:25:52 UTC (rev 250453)
+++ branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-09-27 20:25:55 UTC (rev 250454)
@@ -8243,7 +8243,7 @@
             return;
         }
 
-        if (strongSelf->_positionInformation.isImage) {
+        if (strongSelf->_positionInformation.isImage && !strongSelf->_positionInformation.isLink) {
             ASSERT(strongSelf->_positionInformation.image);
             auto cgImage = strongSelf->_positionInformation.image->makeCGImageCopy();
 

Modified: branches/safari-608-branch/Tools/ChangeLog (250453 => 250454)


--- branches/safari-608-branch/Tools/ChangeLog	2019-09-27 20:25:52 UTC (rev 250453)
+++ branches/safari-608-branch/Tools/ChangeLog	2019-09-27 20:25:55 UTC (rev 250454)
@@ -1,5 +1,54 @@
 2019-09-27  Alan Coon  <[email protected]>
 
+        Cherry-pick r250401. rdar://problem/55770702
+
+    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):
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@250401 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    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-27  Alan Coon  <[email protected]>
+
         Cherry-pick r250391. rdar://problem/55770728
 
     TestWebKitAPI.WebKit.ReloadWithDifferingInitialScale is failing consistently

Modified: branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ContextMenus.mm (250453 => 250454)


--- branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ContextMenus.mm	2019-09-27 20:25:52 UTC (rev 250453)
+++ branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ContextMenus.mm	2019-09-27 20:25:55 UTC (rev 250454)
@@ -174,7 +174,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