Diff
Modified: trunk/Source/WebKit/ChangeLog (221921 => 221922)
--- trunk/Source/WebKit/ChangeLog 2017-09-12 16:34:23 UTC (rev 221921)
+++ trunk/Source/WebKit/ChangeLog 2017-09-12 16:37:04 UTC (rev 221922)
@@ -1,5 +1,28 @@
2017-09-12 Alex Christensen <achristen...@webkit.org>
+ Add WKUIDelegatePrivate equivalent of WKPageUIClient's runModal
+ https://bugs.webkit.org/show_bug.cgi?id=176728
+ <rdar://problem/29270035>
+
+ Covered by a new API test.
+
+ Reviewed by Tim Horton.
+
+ * UIProcess/API/APIUIClient.h:
+ (API::UIClient::runModal):
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetPageUIClient):
+ * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
+ * UIProcess/Cocoa/UIDelegate.h:
+ * UIProcess/Cocoa/UIDelegate.mm:
+ (WebKit::UIDelegate::setDelegate):
+ (WebKit::UIDelegate::UIClient::canRunModal const):
+ (WebKit::UIDelegate::UIClient::runModal):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::runModal):
+
+2017-09-12 Alex Christensen <achristen...@webkit.org>
+
Add WKUIDelegatePrivate equivalent of WKPageUIClient's decidePolicyForNotificationPermissionRequest
https://bugs.webkit.org/show_bug.cgi?id=176768
<rdar://problem/29270035>
Modified: trunk/Source/WebKit/UIProcess/API/APIUIClient.h (221921 => 221922)
--- trunk/Source/WebKit/UIProcess/API/APIUIClient.h 2017-09-12 16:34:23 UTC (rev 221921)
+++ trunk/Source/WebKit/UIProcess/API/APIUIClient.h 2017-09-12 16:37:04 UTC (rev 221922)
@@ -137,7 +137,7 @@
virtual void printFrame(WebKit::WebPageProxy&, WebKit::WebFrameProxy&) { }
virtual bool canRunModal() const { return false; }
- virtual void runModal(WebKit::WebPageProxy*) { }
+ virtual void runModal(WebKit::WebPageProxy&) { }
virtual void saveDataToFileInDownloadsFolder(WebKit::WebPageProxy*, const WTF::String&, const WTF::String&, const WebCore::URL&, Data&) { }
Modified: trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp (221921 => 221922)
--- trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp 2017-09-12 16:34:23 UTC (rev 221921)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp 2017-09-12 16:37:04 UTC (rev 221922)
@@ -2033,12 +2033,12 @@
return m_client.runModal;
}
- void runModal(WebPageProxy* page) final
+ void runModal(WebPageProxy& page) final
{
if (!m_client.runModal)
return;
- m_client.runModal(toAPI(page), m_client.base.clientInfo);
+ m_client.runModal(toAPI(&page), m_client.base.clientInfo);
}
void saveDataToFileInDownloadsFolder(WebPageProxy* page, const String& suggestedFilename, const String& mimeType, const WebCore::URL& originatingURL, API::Data& data) final
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (221921 => 221922)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h 2017-09-12 16:34:23 UTC (rev 221921)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h 2017-09-12 16:37:04 UTC (rev 221922)
@@ -154,6 +154,7 @@
- (void)_focusWebView:(WKWebView *)webView WK_API_AVAILABLE(macosx(WK_MAC_TBA));
- (void)_unfocusWebView:(WKWebView *)webView WK_API_AVAILABLE(macosx(WK_MAC_TBA));
- (void)_webViewDidScroll:(WKWebView *)webView WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (void)_webViewRunModal:(WKWebView *)webView WK_API_AVAILABLE(macosx(WK_MAC_TBA));
- (void)_webView:(WKWebView *)webView takeFocus:(_WKFocusDirection)direction WK_API_AVAILABLE(macosx(WK_MAC_TBA));
- (void)_webView:(WKWebView *)webView didNotHandleWheelEvent:(NSEvent *)event WK_API_AVAILABLE(macosx(WK_MAC_TBA));
- (void)_webView:(WKWebView *)webView handleAutoplayEvent:(_WKAutoplayEvent)event withFlags:(_WKAutoplayEventFlags)flags WK_API_AVAILABLE(macosx(WK_MAC_TBA));
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp (221921 => 221922)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp 2017-09-12 16:34:23 UTC (rev 221921)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp 2017-09-12 16:37:04 UTC (rev 221922)
@@ -210,7 +210,7 @@
bool canRunModal() const final { return true; }
- void runModal(WebPageProxy*) final
+ void runModal(WebPageProxy&) final
{
webkitWebViewRunAsModal(m_webView);
}
Modified: trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h (221921 => 221922)
--- trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h 2017-09-12 16:34:23 UTC (rev 221921)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h 2017-09-12 16:37:04 UTC (rev 221922)
@@ -98,6 +98,8 @@
void takeFocus(WebPageProxy*, WKFocusDirection) final;
void focus(WebPageProxy*) final;
void unfocus(WebPageProxy*) final;
+ bool canRunModal() const final;
+ void runModal(WebPageProxy&) final;
void pageDidScroll(WebPageProxy*) final;
void didNotHandleWheelEvent(WebPageProxy*, const NativeWebWheelEvent&) final;
void decidePolicyForNotificationPermissionRequest(WebPageProxy&, API::SecurityOrigin&, Function<void(bool)>&&) final;
@@ -152,6 +154,7 @@
bool showWebView : 1;
bool focusWebView : 1;
bool unfocusWebView : 1;
+ bool webViewRunModal : 1;
bool webViewTakeFocus : 1;
bool webViewDidScroll : 1;
bool webViewDidNotHandleWheelEvent : 1;
Modified: trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm (221921 => 221922)
--- trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2017-09-12 16:34:23 UTC (rev 221921)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2017-09-12 16:37:04 UTC (rev 221922)
@@ -110,6 +110,7 @@
m_delegateMethods.focusWebView = [delegate respondsToSelector:@selector(_focusWebView:)];
m_delegateMethods.unfocusWebView = [delegate respondsToSelector:@selector(_unfocusWebView:)];
m_delegateMethods.webViewTakeFocus = [delegate respondsToSelector:@selector(_webView:takeFocus:)];
+ m_delegateMethods.webViewRunModal = [delegate respondsToSelector:@selector(_webViewRunModal:)];
m_delegateMethods.webViewDidScroll = [delegate respondsToSelector:@selector(_webViewDidScroll:)];
m_delegateMethods.webViewGetToolbarsAreVisibleWithCompletionHandler = [delegate respondsToSelector:@selector(_webView:getToolbarsAreVisibleWithCompletionHandler:)];
m_delegateMethods.webViewDidNotHandleWheelEvent = [delegate respondsToSelector:@selector(_webView:didNotHandleWheelEvent:)];
@@ -402,6 +403,23 @@
[(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView takeFocus:toWKFocusDirection(direction)];
}
+bool UIDelegate::UIClient::canRunModal() const
+{
+ return m_uiDelegate.m_delegateMethods.webViewRunModal;
+}
+
+void UIDelegate::UIClient::runModal(WebPageProxy&)
+{
+ if (!m_uiDelegate.m_delegateMethods.webViewRunModal)
+ return;
+
+ auto delegate = m_uiDelegate.m_delegate.get();
+ if (!delegate)
+ return;
+
+ [(id <WKUIDelegatePrivate>)delegate _webViewRunModal:m_uiDelegate.m_webView];
+}
+
void UIDelegate::UIClient::pageDidScroll(WebPageProxy*)
{
if (!m_uiDelegate.m_delegateMethods.webViewDidScroll)
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (221921 => 221922)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2017-09-12 16:34:23 UTC (rev 221921)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2017-09-12 16:37:04 UTC (rev 221922)
@@ -5959,7 +5959,7 @@
// See http://webkit.org/b/89590 for more discussion.
m_process->connection()->wakeUpRunLoop();
- m_uiClient->runModal(this);
+ m_uiClient->runModal(*this);
}
void WebPageProxy::notifyScrollerThumbIsVisibleInRect(const IntRect& scrollerThumb)
Modified: trunk/Tools/ChangeLog (221921 => 221922)
--- trunk/Tools/ChangeLog 2017-09-12 16:34:23 UTC (rev 221921)
+++ trunk/Tools/ChangeLog 2017-09-12 16:37:04 UTC (rev 221922)
@@ -1,3 +1,16 @@
+2017-09-12 Alex Christensen <achristen...@webkit.org>
+
+ Add WKUIDelegatePrivate equivalent of WKPageUIClient's runModal
+ https://bugs.webkit.org/show_bug.cgi?id=176728
+ <rdar://problem/29270035>
+
+ Reviewed by Tim Horton.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:
+ (-[ModalDelegate _webViewRunModal:]):
+ (-[ModalDelegate webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:]):
+ (TEST):
+
2017-09-12 Daniel Bates <daba...@apple.com>
REGRESSION (r215784): The title of right-to-left pages are empty
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm (221921 => 221922)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm 2017-09-12 16:34:23 UTC (rev 221921)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm 2017-09-12 16:37:04 UTC (rev 221922)
@@ -148,7 +148,38 @@
TestWebKitAPI::Util::run(&done);
}
+@interface ModalDelegate : NSObject <WKUIDelegatePrivate>
+@end
+@implementation ModalDelegate
+
+- (void)_webViewRunModal:(WKWebView *)webView
+{
+ EXPECT_EQ(webView, createdWebView.get());
+ done = true;
+}
+
+- (nullable WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures
+{
+ createdWebView = [[[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration] autorelease];
+ [createdWebView setUIDelegate:self];
+ return createdWebView.get();
+}
+
+@end
+
+TEST(WebKit, RunModal)
+{
+ auto delegate = adoptNS([[ModalDelegate alloc] init]);
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600)]);
+ [webView setUIDelegate:delegate.get()];
+ NSURL *url = "" mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"];
+ NSString *html = [NSString stringWithFormat:@"%@%@%@", @"<script> function openModal() { window.showModalDialog('", url, @"'); } </script> <input type='button' value='Click to open modal' _onclick_='openModal();'>"];
+ [webView synchronouslyLoadHTMLString:html];
+ [webView sendClicksAtPoint:NSMakePoint(20, 600 - 20) numberOfClicks:1];
+ TestWebKitAPI::Util::run(&done);
+}
+
#if PLATFORM(MAC)
@class UITestDelegate;