Changeset 221433 in webkit
- Timestamp:
- Aug 31, 2017, 12:20:36 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r221431 r221433 1 2017-08-30 Alex Christensen <achristensen@webkit.org> 2 3 Add WKUIDelegatePrivate equivalent of WKPageUIClient's didClickAutoFillButton 4 https://bugs.webkit.org/show_bug.cgi?id=176139 5 <rdar://problem/29270035> 6 7 Reviewed by Tim Horton. 8 9 Covered by a cool new API test! 10 11 * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: 12 * UIProcess/Cocoa/UIDelegate.h: 13 * UIProcess/Cocoa/UIDelegate.mm: 14 (WebKit::UIDelegate::setDelegate): 15 (WebKit::UIDelegate::UIClient::didClickAutoFillButton): 16 1 17 2017-08-31 Chris Dumez <cdumez@apple.com> 2 18 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h
r221262 r221433 150 150 - (void)_webView:(WKWebView *)webView didNotHandleWheelEvent:(NSEvent *)event WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 151 151 - (void)_webView:(WKWebView *)webView handleAutoplayEvent:(_WKAutoplayEvent)event withFlags:(_WKAutoplayEventFlags)flags WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 152 - (void)_webView:(WKWebView *)webView didClickAutoFillButtonWithUserInfo:(id <NSSecureCoding>)userInfo WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 152 153 - (void)_webView:(WKWebView *)webView saveDataToFile:(NSData *)data suggestedFilename:(NSString *)suggestedFilename mimeType:(NSString *)mimeType originatingURL:(NSURL *)url WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 153 154 - (void)_webView:(WKWebView *)webView didExceedBackgroundResourceLimitWhileInForeground:(_WKResourceLimit)limit WK_API_AVAILABLE(macosx(WK_MAC_TBA)); -
trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h
r221262 r221433 103 103 void didNotHandleWheelEvent(WebPageProxy*, const NativeWebWheelEvent&) final; 104 104 void handleAutoplayEvent(WebPageProxy&, WebCore::AutoplayEvent, OptionSet<WebCore::AutoplayEventFlags>) final; 105 void didClickAutoFillButton(WebPageProxy&, API::Object*) final; 105 106 bool runOpenPanel(WebPageProxy*, WebFrameProxy*, const WebCore::SecurityOriginData&, API::OpenPanelParameters*, WebOpenPanelResultListenerProxy*) final; 106 107 void didExceedBackgroundResourceLimitWhileInForeground(WebPageProxy&, WKResourceLimit) final; … … 151 152 bool webViewDidNotHandleWheelEvent : 1; 152 153 bool webViewHandleAutoplayEventWithFlags : 1; 154 bool webViewDidClickAutoFillButtonWithUserInfo : 1; 153 155 bool webViewDidExceedBackgroundResourceLimitWhileInForeground : 1; 154 156 bool webViewSaveDataToFileSuggestedFilenameMimeTypeOriginatingURL : 1; -
trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm
r221262 r221433 109 109 m_delegateMethods.webViewDidNotHandleWheelEvent = [delegate respondsToSelector:@selector(_webView:didNotHandleWheelEvent:)]; 110 110 m_delegateMethods.webViewHandleAutoplayEventWithFlags = [delegate respondsToSelector:@selector(_webView:handleAutoplayEvent:withFlags:)]; 111 m_delegateMethods.webViewDidClickAutoFillButtonWithUserInfo = [delegate respondsToSelector:@selector(_webView:didClickAutoFillButtonWithUserInfo:)]; 111 112 m_delegateMethods.webViewDidExceedBackgroundResourceLimitWhileInForeground = [delegate respondsToSelector:@selector(_webView:didExceedBackgroundResourceLimitWhileInForeground:)]; 112 113 m_delegateMethods.webViewSaveDataToFileSuggestedFilenameMimeTypeOriginatingURL = [delegate respondsToSelector:@selector(_webView:saveDataToFile:suggestedFilename:mimeType:originatingURL:)]; … … 490 491 } 491 492 493 void UIDelegate::UIClient::didClickAutoFillButton(WebPageProxy&, API::Object* userInfo) 494 { 495 if (!m_uiDelegate.m_delegateMethods.webViewDidClickAutoFillButtonWithUserInfo) 496 return; 497 498 auto delegate = m_uiDelegate.m_delegate.get(); 499 if (!delegate) 500 return; 501 502 [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView didClickAutoFillButtonWithUserInfo:userInfo ?static_cast<id <NSSecureCoding>>(userInfo->wrapper()) : nil]; 503 } 504 492 505 void UIDelegate::UIClient::handleAutoplayEvent(WebKit::WebPageProxy&, WebCore::AutoplayEvent event, OptionSet<WebCore::AutoplayEventFlags> flags) 493 506 { -
trunk/Tools/ChangeLog
r221420 r221433 1 2017-08-30 Alex Christensen <achristensen@webkit.org> 2 3 Add WKUIDelegatePrivate equivalent of WKPageUIClient's didClickAutoFillButton 4 https://bugs.webkit.org/show_bug.cgi?id=176139 5 <rdar://problem/29270035> 6 7 Reviewed by Tim Horton. 8 9 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 10 * TestWebKitAPI/Tests/WebKitCocoa/ClickAutoFillButton.mm: Added. 11 (didClickAutoFillButton): 12 (-[ClickAutoFillButton webProcessPlugIn:didCreateBrowserContextController:]): 13 * TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm: 14 (-[AutoFillDelegate _webView:didClickAutoFillButtonWithUserInfo:]): 15 (-[AutoFillDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]): 16 (TEST): 17 1 18 2017-08-31 Carlos Garcia Campos <cgarcia@igalia.com> 2 19 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r221415 r221433 235 235 5C9E59421D3EB5AC00E3C62E /* ApplicationCache.db-shm in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5C9E593F1D3EB1DE00E3C62E /* ApplicationCache.db-shm */; }; 236 236 5C9E59431D3EB5AC00E3C62E /* ApplicationCache.db-wal in Copy Resources */ = {isa = PBXBuildFile; fileRef = 5C9E59401D3EB1DE00E3C62E /* ApplicationCache.db-wal */; }; 237 5CB18BA81F5645E300EE23C4 /* ClickAutoFillButton.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CB18BA71F5645B200EE23C4 /* ClickAutoFillButton.mm */; }; 237 238 5CB40B4E1F4B98D3007DC7B9 /* UIDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CB40B4D1F4B98BE007DC7B9 /* UIDelegate.mm */; }; 238 239 5CE354D91E70DA5C00BEFE3B /* WKContentExtensionStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CE354D81E70D9C300BEFE3B /* WKContentExtensionStore.mm */; }; … … 1313 1314 5C9E593F1D3EB1DE00E3C62E /* ApplicationCache.db-shm */ = {isa = PBXFileReference; lastKnownFileType = file; path = "ApplicationCache.db-shm"; sourceTree = "<group>"; }; 1314 1315 5C9E59401D3EB1DE00E3C62E /* ApplicationCache.db-wal */ = {isa = PBXFileReference; lastKnownFileType = file; path = "ApplicationCache.db-wal"; sourceTree = "<group>"; }; 1316 5CB18BA71F5645B200EE23C4 /* ClickAutoFillButton.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ClickAutoFillButton.mm; sourceTree = "<group>"; }; 1315 1317 5CB40B4D1F4B98BE007DC7B9 /* UIDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UIDelegate.mm; sourceTree = "<group>"; }; 1316 1318 5CE354D81E70D9C300BEFE3B /* WKContentExtensionStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKContentExtensionStore.mm; sourceTree = "<group>"; }; … … 1898 1900 1C2B817E1C891E4200A5529F /* CancelFontSubresource.mm */, 1899 1901 1C2B81811C891EFA00A5529F /* CancelFontSubresourcePlugIn.mm */, 1902 5CB18BA71F5645B200EE23C4 /* ClickAutoFillButton.mm */, 1900 1903 1AAD19F51C7CE20300831E47 /* Coding.mm */, 1901 1904 7C3DB8E21D12129B00AE8CC3 /* CommandBackForward.mm */, … … 3436 3439 37A709AF1E3EA97E00CA5969 /* BundleRangeHandlePlugIn.mm in Sources */, 3437 3440 1C2B81831C891F0900A5529F /* CancelFontSubresourcePlugIn.mm in Sources */, 3441 5CB18BA81F5645E300EE23C4 /* ClickAutoFillButton.mm in Sources */, 3438 3442 A14FC58B1B89927100D107EB /* ContentFilteringPlugIn.mm in Sources */, 3439 3443 A13EBBAB1B87434600097110 /* PlatformUtilitiesCocoa.mm in Sources */, -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm
r221220 r221433 32 32 #import "TestWKWebView.h" 33 33 #import "Utilities.h" 34 #import "WKWebViewConfigurationExtras.h" 34 35 #import <Carbon/Carbon.h> 35 36 #import <WebKit/WKUIDelegatePrivate.h> … … 88 89 89 90 ASSERT_EQ(webViewFromDelegateCallback, createdWebView); 91 } 92 93 static bool readyForClick; 94 95 @interface AutoFillDelegate : NSObject <WKUIDelegatePrivate> 96 @end 97 98 @implementation AutoFillDelegate 99 100 - (void)_webView:(WKWebView *)webView didClickAutoFillButtonWithUserInfo:(id <NSSecureCoding>)userInfo 101 { 102 ASSERT_TRUE([(id<NSObject>)userInfo isKindOfClass:[NSString class]]); 103 ASSERT_STREQ([(NSString*)userInfo UTF8String], "user data string"); 104 done = true; 105 } 106 107 - (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler 108 { 109 completionHandler(); 110 ASSERT_STREQ(message.UTF8String, "ready for click!"); 111 readyForClick = true; 112 } 113 114 @end 115 116 TEST(WebKit2, ClickAutoFillButton) 117 { 118 WKWebViewConfiguration *configuration = [WKWebViewConfiguration _test_configurationWithTestPlugInClassName:@"ClickAutoFillButton"]; 119 120 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600) configuration:configuration]); 121 auto delegate = adoptNS([[AutoFillDelegate alloc] init]); 122 [webView setUIDelegate:delegate.get()]; 123 TestWebKitAPI::Util::run(&readyForClick); 124 NSPoint buttonLocation = NSMakePoint(130, 575); 125 [webView mouseDownAtPoint:buttonLocation simulatePressure:NO]; 126 [webView mouseUpAtPoint:buttonLocation]; 127 TestWebKitAPI::Util::run(&done); 90 128 } 91 129
Note:
See TracChangeset
for help on using the changeset viewer.