Changeset 248742 in webkit
- Timestamp:
- Aug 15, 2019 1:49:52 PM (5 years ago)
- Location:
- branches/safari-608-branch
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-608-branch/Source/WebKit/ChangeLog
r248725 r248742 1 2019-08-15 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r248717. rdar://problem/54360854 4 5 WKUIDelegate's webView:contextMenuDidEndForElement: should be called when context menus end 6 https://bugs.webkit.org/show_bug.cgi?id=200750 7 <rdar://problem/54232261> and <rdar://problem/52355829> 8 9 Patch by Alex Christensen <achristensen@webkit.org> on 2019-08-15 10 Reviewed by Tim Horton. 11 12 Source/WebKit: 13 14 * UIProcess/ios/WKContentViewInteraction.mm: 15 (-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]): 16 17 Tools: 18 19 * TestWebKitAPI/Tests/WebKitCocoa/ContextMenus.mm: 20 (-[TestContextMenuUIDelegate webView:contextMenuConfigurationForElement:completionHandler:]): 21 (-[TestContextMenuUIDelegate webView:contextMenuForElement:willCommitWithAnimator:]): 22 (-[TestContextMenuUIDelegate webView:contextMenuDidEndForElement:]): 23 (contextMenuWebViewDriver): 24 (TEST): 25 26 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248717 268f45cc-cd09-0410-ab3c-d52691b4dbfc 27 28 2019-08-15 Alex Christensen <achristensen@webkit.org> 29 30 WKUIDelegate's webView:contextMenuDidEndForElement: should be called when context menus end 31 https://bugs.webkit.org/show_bug.cgi?id=200750 32 <rdar://problem/54232261> and <rdar://problem/52355829> 33 34 Reviewed by Tim Horton. 35 36 * UIProcess/ios/WKContentViewInteraction.mm: 37 (-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]): 38 1 39 2019-08-15 Alan Coon <alancoon@apple.com> 2 40 -
branches/safari-608-branch/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r248725 r248742 8372 8372 // FIXME: This delegate is being called more than once by UIKit. <rdar://problem/51550291> 8373 8373 // This conditional avoids the WKUIDelegate being called twice too. 8374 if ( !_contextMenuElementInfo) {8374 if (_contextMenuElementInfo) { 8375 8375 auto uiDelegate = static_cast<id<WKUIDelegatePrivate>>(_webView.UIDelegate); 8376 8376 if ([uiDelegate respondsToSelector:@selector(webView:contextMenuDidEndForElement:)]) -
branches/safari-608-branch/Tools/ChangeLog
r248726 r248742 1 2019-08-15 Alan Coon <alancoon@apple.com> 2 3 Cherry-pick r248717. rdar://problem/54360854 4 5 WKUIDelegate's webView:contextMenuDidEndForElement: should be called when context menus end 6 https://bugs.webkit.org/show_bug.cgi?id=200750 7 <rdar://problem/54232261> and <rdar://problem/52355829> 8 9 Patch by Alex Christensen <achristensen@webkit.org> on 2019-08-15 10 Reviewed by Tim Horton. 11 12 Source/WebKit: 13 14 * UIProcess/ios/WKContentViewInteraction.mm: 15 (-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]): 16 17 Tools: 18 19 * TestWebKitAPI/Tests/WebKitCocoa/ContextMenus.mm: 20 (-[TestContextMenuUIDelegate webView:contextMenuConfigurationForElement:completionHandler:]): 21 (-[TestContextMenuUIDelegate webView:contextMenuForElement:willCommitWithAnimator:]): 22 (-[TestContextMenuUIDelegate webView:contextMenuDidEndForElement:]): 23 (contextMenuWebViewDriver): 24 (TEST): 25 26 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248717 268f45cc-cd09-0410-ab3c-d52691b4dbfc 27 28 2019-08-15 Alex Christensen <achristensen@webkit.org> 29 30 WKUIDelegate's webView:contextMenuDidEndForElement: should be called when context menus end 31 https://bugs.webkit.org/show_bug.cgi?id=200750 32 <rdar://problem/54232261> and <rdar://problem/52355829> 33 34 Reviewed by Tim Horton. 35 36 * TestWebKitAPI/Tests/WebKitCocoa/ContextMenus.mm: 37 (-[TestContextMenuUIDelegate webView:contextMenuConfigurationForElement:completionHandler:]): 38 (-[TestContextMenuUIDelegate webView:contextMenuForElement:willCommitWithAnimator:]): 39 (-[TestContextMenuUIDelegate webView:contextMenuDidEndForElement:]): 40 (contextMenuWebViewDriver): 41 (TEST): 42 1 43 2019-08-15 Alan Coon <alancoon@apple.com> 2 44 -
branches/safari-608-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/ContextMenus.mm
r248125 r248742 35 35 #import <WebKit/WebKit.h> 36 36 37 static bool contextMenuRequested; 37 38 static bool willPresentCalled; 38 static bool contextMenuRequested; 39 static bool willCommitCalled; 40 static bool didEndCalled; 39 41 static RetainPtr<NSURL> simpleURL; 40 42 … … 48 50 EXPECT_TRUE([elementInfo.linkURL.absoluteString isEqualToString:[simpleURL absoluteString]]); 49 51 contextMenuRequested = true; 50 completionHandler([UIContextMenuConfiguration configurationWithIdentifier:nil previewProvider:nil actionProvider:nil]); 52 UIContextMenuContentPreviewProvider previewProvider = ^UIViewController * () 53 { 54 return [UIViewController new]; 55 }; 56 UIContextMenuActionProvider actionProvider = ^UIMenu *(NSArray<UIMenuElement *> *suggestedActions) 57 { 58 return [UIMenu menuWithTitle:@"" children:suggestedActions]; 59 }; 60 completionHandler([UIContextMenuConfiguration configurationWithIdentifier:nil previewProvider:previewProvider actionProvider:actionProvider]); 51 61 } 52 62 … … 58 68 - (void)webView:(WKWebView *)webView contextMenuForElement:(WKContextMenuElementInfo *)elementInfo willCommitWithAnimator:(id<UIContextMenuInteractionCommitAnimating>)animator 59 69 { 70 willCommitCalled = true; 60 71 } 61 72 62 73 - (void)webView:(WKWebView *)webView contextMenuDidEndForElement:(WKContextMenuElementInfo *)elementInfo 63 74 { 75 didEndCalled = true; 64 76 } 65 77 66 78 @end 67 79 68 TEST(WebKit, DISABLED_ContextMenuBasic)80 static RetainPtr<TestContextMenuDriver> contextMenuWebViewDriver() 69 81 { 70 auto window = adoptNS([[UIWindow alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);71 auto driver = adoptNS([TestContextMenuDriver new]);72 auto uiDelegate = adoptNS([TestContextMenuUIDelegate new]);73 auto configuration = adoptNS([WKWebViewConfiguration new]);82 static auto window = adoptNS([[UIWindow alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]); 83 static auto driver = adoptNS([TestContextMenuDriver new]); 84 static auto uiDelegate = adoptNS([TestContextMenuUIDelegate new]); 85 static auto configuration = adoptNS([WKWebViewConfiguration new]); 74 86 [configuration _setClickInteractionDriverForTesting:(id<_UIClickInteractionDriving>)driver.get()]; 75 auto webViewController = adoptNS([[TestWKWebViewController alloc] initWithFrame:CGRectMake(0, 0, 200, 200) configuration:configuration.get()]);87 static auto webViewController = adoptNS([[TestWKWebViewController alloc] initWithFrame:CGRectMake(0, 0, 200, 200) configuration:configuration.get()]); 76 88 TestWKWebView *webView = [webViewController webView]; 77 89 [window addSubview:webView]; 78 90 [webView setUIDelegate:uiDelegate.get()]; 79 80 91 simpleURL = [[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; 81 92 [webView synchronouslyLoadHTMLString:[NSString stringWithFormat:@"<a href='%@'>This is a link</a>", simpleURL.get()]]; 93 return driver; 94 } 95 96 TEST(WebKit, ContextMenuClick) 97 { 98 auto driver = contextMenuWebViewDriver(); 82 99 [driver begin:^(BOOL result) { 83 if (result) { 84 [driver clickDown]; 85 [driver clickUp]; 86 [driver end]; 87 } 100 EXPECT_TRUE(result); 101 [driver clickDown]; 102 [driver clickUp]; 88 103 }]; 89 104 TestWebKitAPI::Util::run(&willPresentCalled); 105 EXPECT_TRUE(contextMenuRequested); 106 EXPECT_TRUE(willPresentCalled); 107 EXPECT_FALSE(willCommitCalled); 108 EXPECT_FALSE(didEndCalled); 90 109 } 91 110 111 TEST(WebKit, ContextMenuEnd) 112 { 113 auto driver = contextMenuWebViewDriver(); 114 [driver begin:^(BOOL result) { 115 EXPECT_TRUE(result); 116 [driver end]; 117 }]; 118 TestWebKitAPI::Util::run(&didEndCalled); 119 EXPECT_TRUE(contextMenuRequested); 120 EXPECT_FALSE(willPresentCalled); 121 EXPECT_FALSE(willCommitCalled); 122 EXPECT_TRUE(didEndCalled); 123 } 92 124 #endif // PLATFORM(IOS) && USE(UICONTEXTMENU)
Note: See TracChangeset
for help on using the changeset viewer.