Changeset 221922 in webkit
- Timestamp:
- Sep 12, 2017, 9:37:04 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r221920 r221922 1 2017-09-12 Alex Christensen <achristensen@webkit.org> 2 3 Add WKUIDelegatePrivate equivalent of WKPageUIClient's runModal 4 https://bugs.webkit.org/show_bug.cgi?id=176728 5 <rdar://problem/29270035> 6 7 Covered by a new API test. 8 9 Reviewed by Tim Horton. 10 11 * UIProcess/API/APIUIClient.h: 12 (API::UIClient::runModal): 13 * UIProcess/API/C/WKPage.cpp: 14 (WKPageSetPageUIClient): 15 * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: 16 * UIProcess/Cocoa/UIDelegate.h: 17 * UIProcess/Cocoa/UIDelegate.mm: 18 (WebKit::UIDelegate::setDelegate): 19 (WebKit::UIDelegate::UIClient::canRunModal const): 20 (WebKit::UIDelegate::UIClient::runModal): 21 * UIProcess/WebPageProxy.cpp: 22 (WebKit::WebPageProxy::runModal): 23 1 24 2017-09-12 Alex Christensen <achristensen@webkit.org> 2 25 -
trunk/Source/WebKit/UIProcess/API/APIUIClient.h
r221899 r221922 138 138 139 139 virtual bool canRunModal() const { return false; } 140 virtual void runModal(WebKit::WebPageProxy *) { }140 virtual void runModal(WebKit::WebPageProxy&) { } 141 141 142 142 virtual void saveDataToFileInDownloadsFolder(WebKit::WebPageProxy*, const WTF::String&, const WTF::String&, const WebCore::URL&, Data&) { } -
trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp
r221899 r221922 2034 2034 } 2035 2035 2036 void runModal(WebPageProxy *page) final2036 void runModal(WebPageProxy& page) final 2037 2037 { 2038 2038 if (!m_client.runModal) 2039 2039 return; 2040 2040 2041 m_client.runModal(toAPI( page), m_client.base.clientInfo);2041 m_client.runModal(toAPI(&page), m_client.base.clientInfo); 2042 2042 } 2043 2043 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h
r221920 r221922 155 155 - (void)_unfocusWebView:(WKWebView *)webView WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 156 156 - (void)_webViewDidScroll:(WKWebView *)webView WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 157 - (void)_webViewRunModal:(WKWebView *)webView WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 157 158 - (void)_webView:(WKWebView *)webView takeFocus:(_WKFocusDirection)direction WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 158 159 - (void)_webView:(WKWebView *)webView didNotHandleWheelEvent:(NSEvent *)event WK_API_AVAILABLE(macosx(WK_MAC_TBA)); -
trunk/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp
r221899 r221922 211 211 bool canRunModal() const final { return true; } 212 212 213 void runModal(WebPageProxy *) final213 void runModal(WebPageProxy&) final 214 214 { 215 215 webkitWebViewRunAsModal(m_webView); -
trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h
r221920 r221922 99 99 void focus(WebPageProxy*) final; 100 100 void unfocus(WebPageProxy*) final; 101 bool canRunModal() const final; 102 void runModal(WebPageProxy&) final; 101 103 void pageDidScroll(WebPageProxy*) final; 102 104 void didNotHandleWheelEvent(WebPageProxy*, const NativeWebWheelEvent&) final; … … 153 155 bool focusWebView : 1; 154 156 bool unfocusWebView : 1; 157 bool webViewRunModal : 1; 155 158 bool webViewTakeFocus : 1; 156 159 bool webViewDidScroll : 1; -
trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm
r221920 r221922 111 111 m_delegateMethods.unfocusWebView = [delegate respondsToSelector:@selector(_unfocusWebView:)]; 112 112 m_delegateMethods.webViewTakeFocus = [delegate respondsToSelector:@selector(_webView:takeFocus:)]; 113 m_delegateMethods.webViewRunModal = [delegate respondsToSelector:@selector(_webViewRunModal:)]; 113 114 m_delegateMethods.webViewDidScroll = [delegate respondsToSelector:@selector(_webViewDidScroll:)]; 114 115 m_delegateMethods.webViewGetToolbarsAreVisibleWithCompletionHandler = [delegate respondsToSelector:@selector(_webView:getToolbarsAreVisibleWithCompletionHandler:)]; … … 401 402 402 403 [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView takeFocus:toWKFocusDirection(direction)]; 404 } 405 406 bool UIDelegate::UIClient::canRunModal() const 407 { 408 return m_uiDelegate.m_delegateMethods.webViewRunModal; 409 } 410 411 void UIDelegate::UIClient::runModal(WebPageProxy&) 412 { 413 if (!m_uiDelegate.m_delegateMethods.webViewRunModal) 414 return; 415 416 auto delegate = m_uiDelegate.m_delegate.get(); 417 if (!delegate) 418 return; 419 420 [(id <WKUIDelegatePrivate>)delegate _webViewRunModal:m_uiDelegate.m_webView]; 403 421 } 404 422 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r221899 r221922 5960 5960 m_process->connection()->wakeUpRunLoop(); 5961 5961 5962 m_uiClient->runModal( this);5962 m_uiClient->runModal(*this); 5963 5963 } 5964 5964 -
trunk/Tools/ChangeLog
r221921 r221922 1 2017-09-12 Alex Christensen <achristensen@webkit.org> 2 3 Add WKUIDelegatePrivate equivalent of WKPageUIClient's runModal 4 https://bugs.webkit.org/show_bug.cgi?id=176728 5 <rdar://problem/29270035> 6 7 Reviewed by Tim Horton. 8 9 * TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm: 10 (-[ModalDelegate _webViewRunModal:]): 11 (-[ModalDelegate webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:]): 12 (TEST): 13 1 14 2017-09-12 Daniel Bates <dabates@apple.com> 2 15 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm
r221920 r221922 149 149 } 150 150 151 @interface ModalDelegate : NSObject <WKUIDelegatePrivate> 152 @end 153 154 @implementation ModalDelegate 155 156 - (void)_webViewRunModal:(WKWebView *)webView 157 { 158 EXPECT_EQ(webView, createdWebView.get()); 159 done = true; 160 } 161 162 - (nullable WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures 163 { 164 createdWebView = [[[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration] autorelease]; 165 [createdWebView setUIDelegate:self]; 166 return createdWebView.get(); 167 } 168 169 @end 170 171 TEST(WebKit, RunModal) 172 { 173 auto delegate = adoptNS([[ModalDelegate alloc] init]); 174 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600)]); 175 [webView setUIDelegate:delegate.get()]; 176 NSURL *url = [[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]; 177 NSString *html = [NSString stringWithFormat:@"%@%@%@", @"<script> function openModal() { window.showModalDialog('", url, @"'); } </script> <input type='button' value='Click to open modal' onclick='openModal();'>"]; 178 [webView synchronouslyLoadHTMLString:html]; 179 [webView sendClicksAtPoint:NSMakePoint(20, 600 - 20) numberOfClicks:1]; 180 TestWebKitAPI::Util::run(&done); 181 } 151 182 152 183 #if PLATFORM(MAC)
Note:
See TracChangeset
for help on using the changeset viewer.