Changeset 248717 in webkit
- Timestamp:
- Aug 15, 2019 9:34:00 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r248715 r248717 1 2019-08-15 Alex Christensen <achristensen@webkit.org> 2 3 WKUIDelegate's webView:contextMenuDidEndForElement: should be called when context menus end 4 https://bugs.webkit.org/show_bug.cgi?id=200750 5 <rdar://problem/54232261> and <rdar://problem/52355829> 6 7 Reviewed by Tim Horton. 8 9 * UIProcess/ios/WKContentViewInteraction.mm: 10 (-[WKContentView contextMenuInteraction:willEndForConfiguration:animator:]): 11 1 12 2019-08-14 Brian Burg <bburg@apple.com> 2 13 -
trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
r248690 r248717 8370 8370 // FIXME: This delegate is being called more than once by UIKit. <rdar://problem/51550291> 8371 8371 // This conditional avoids the WKUIDelegate being called twice too. 8372 if ( !_contextMenuElementInfo) {8372 if (_contextMenuElementInfo) { 8373 8373 auto uiDelegate = static_cast<id<WKUIDelegatePrivate>>(_webView.UIDelegate); 8374 8374 if ([uiDelegate respondsToSelector:@selector(webView:contextMenuDidEndForElement:)]) -
trunk/Tools/ChangeLog
r248701 r248717 1 2019-08-15 Alex Christensen <achristensen@webkit.org> 2 3 WKUIDelegate's webView:contextMenuDidEndForElement: should be called when context menus end 4 https://bugs.webkit.org/show_bug.cgi?id=200750 5 <rdar://problem/54232261> and <rdar://problem/52355829> 6 7 Reviewed by Tim Horton. 8 9 * TestWebKitAPI/Tests/WebKitCocoa/ContextMenus.mm: 10 (-[TestContextMenuUIDelegate webView:contextMenuConfigurationForElement:completionHandler:]): 11 (-[TestContextMenuUIDelegate webView:contextMenuForElement:willCommitWithAnimator:]): 12 (-[TestContextMenuUIDelegate webView:contextMenuDidEndForElement:]): 13 (contextMenuWebViewDriver): 14 (TEST): 15 1 16 2019-08-14 Said Abou-Hallawa <sabouhallawa@apple.com> 2 17 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ContextMenus.mm
r248072 r248717 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.