Diff
Modified: trunk/Source/WebKit/ChangeLog (232395 => 232396)
--- trunk/Source/WebKit/ChangeLog 2018-06-01 16:00:45 UTC (rev 232395)
+++ trunk/Source/WebKit/ChangeLog 2018-06-01 16:08:18 UTC (rev 232396)
@@ -1,3 +1,19 @@
+2018-05-31 Brian Burg <bb...@apple.com>
+
+ [Cocoa] Web Automation: use the session delegate to perform window maximize
+ https://bugs.webkit.org/show_bug.cgi?id=186167
+ <rdar://problem/40544391>
+
+ Reviewed by Timothy Hatcher.
+
+ Add plumbing to hand off window maximizing to the session delegate.
+
+ * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
+ * UIProcess/Cocoa/AutomationSessionClient.h:
+ * UIProcess/Cocoa/AutomationSessionClient.mm:
+ (WebKit::AutomationSessionClient::AutomationSessionClient):
+ (WebKit::AutomationSessionClient::requestMaximizeWindowOfPage):
+
2018-06-01 Carlos Garcia Campos <cgar...@igalia.com>
Unreviewed. Try to fix GTK+ build with old versions of GTK+ after r232390.
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h (232395 => 232396)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h 2018-06-01 16:00:45 UTC (rev 232395)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h 2018-06-01 16:08:18 UTC (rev 232396)
@@ -54,6 +54,7 @@
- (void)_automationSession:(_WKAutomationSession *)automationSession requestNewWebViewWithOptions:(_WKAutomationSessionBrowsingContextOptions)options completionHandler:(void(^)(WKWebView * _Nullable))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
- (void)_automationSession:(_WKAutomationSession *)automationSession requestHideWindowOfWebView:(WKWebView *)webView completionHandler:(void(^)(void))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
- (void)_automationSession:(_WKAutomationSession *)automationSession requestRestoreWindowOfWebView:(WKWebView *)webView completionHandler:(void(^)(void))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (void)_automationSession:(_WKAutomationSession *)automationSession requestMaximizeWindowOfWebView:(WKWebView *)webView completionHandler:(void(^)(void))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
- (void)_automationSession:(_WKAutomationSession *)automationSession requestSwitchToWebView:(WKWebView *)webView completionHandler:(void(^)(void))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
- (BOOL)_automationSession:(_WKAutomationSession *)automationSession isShowingJavaScriptDialogForWebView:(WKWebView *)webView WK_API_AVAILABLE(macosx(10.13), ios(11.0));
- (void)_automationSession:(_WKAutomationSession *)automationSession dismissCurrentJavaScriptDialogForWebView:(WKWebView *)webView WK_API_AVAILABLE(macosx(10.13), ios(11.0));
@@ -67,6 +68,7 @@
- (void)_automationSession:(_WKAutomationSession *)automationSession requestNewPageWithOptions:(_WKAutomationSessionBrowsingContextOptions)options completionHandler:(void(^)(WKPageRef))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
- (void)_automationSession:(_WKAutomationSession *)automationSession requestHideWindowOfPage:(WKPageRef)page completionHandler:(void(^)(void))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
- (void)_automationSession:(_WKAutomationSession *)automationSession requestRestoreWindowOfPage:(WKPageRef)page completionHandler:(void(^)(void))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (void)_automationSession:(_WKAutomationSession *)automationSession requestMaximizeWindowOfPage:(WKPageRef)page completionHandler:(void(^)(void))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
- (void)_automationSession:(_WKAutomationSession *)automationSession requestSwitchToPage:(WKPageRef)page completionHandler:(void(^)(void))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
- (BOOL)_automationSession:(_WKAutomationSession *)automationSession isShowingJavaScriptDialogOnPage:(WKPageRef)page WK_API_AVAILABLE(macosx(10.13), ios(11.0));
- (void)_automationSession:(_WKAutomationSession *)automationSession dismissCurrentJavaScriptDialogOnPage:(WKPageRef)page WK_API_AVAILABLE(macosx(10.13), ios(11.0));
Modified: trunk/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.h (232395 => 232396)
--- trunk/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.h 2018-06-01 16:00:45 UTC (rev 232395)
+++ trunk/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.h 2018-06-01 16:08:18 UTC (rev 232396)
@@ -49,6 +49,7 @@
void requestSwitchToPage(WebKit::WebAutomationSession&, WebKit::WebPageProxy&, CompletionHandler<void()>&&) override;
void requestHideWindowOfPage(WebKit::WebAutomationSession&, WebKit::WebPageProxy&, CompletionHandler<void()>&&) override;
void requestRestoreWindowOfPage(WebKit::WebAutomationSession&, WebKit::WebPageProxy&, CompletionHandler<void()>&&) override;
+ void requestMaximizeWindowOfPage(WebKit::WebAutomationSession&, WebKit::WebPageProxy&, CompletionHandler<void()>&&) override;
bool isShowingJavaScriptDialogOnPage(WebAutomationSession&, WebPageProxy&) override;
void dismissCurrentJavaScriptDialogOnPage(WebAutomationSession&, WebPageProxy&) override;
@@ -66,6 +67,7 @@
bool requestSwitchToWebView : 1;
bool requestHideWindowOfWebView : 1;
bool requestRestoreWindowOfWebView : 1;
+ bool requestMaximizeWindowOfWebView : 1;
bool isShowingJavaScriptDialogForWebView : 1;
bool dismissCurrentJavaScriptDialogForWebView : 1;
bool acceptCurrentJavaScriptDialogForWebView : 1;
@@ -78,6 +80,7 @@
bool requestSwitchToPage : 1;
bool requestHideWindowOfPage : 1;
bool requestRestoreWindowOfPage : 1;
+ bool requestMaximizeWindowOfPage : 1;
bool isShowingJavaScriptDialogOnPage : 1;
bool dismissCurrentJavaScriptDialogOnPage : 1;
bool acceptCurrentJavaScriptDialogOnPage : 1;
Modified: trunk/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm (232395 => 232396)
--- trunk/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm 2018-06-01 16:00:45 UTC (rev 232395)
+++ trunk/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm 2018-06-01 16:08:18 UTC (rev 232396)
@@ -47,6 +47,7 @@
m_delegateMethods.requestSwitchToWebView = [delegate respondsToSelector:@selector(_automationSession:requestSwitchToWebView:completionHandler:)];
m_delegateMethods.requestHideWindowOfWebView = [delegate respondsToSelector:@selector(_automationSession:requestHideWindowOfWebView:completionHandler:)];
m_delegateMethods.requestRestoreWindowOfWebView = [delegate respondsToSelector:@selector(_automationSession:requestRestoreWindowOfWebView:completionHandler:)];
+ m_delegateMethods.requestMaximizeWindowOfWebView = [delegate respondsToSelector:@selector(_automationSession:requestMaximizeWindowOfWebView:completionHandler:)];
m_delegateMethods.isShowingJavaScriptDialogForWebView = [delegate respondsToSelector:@selector(_automationSession:isShowingJavaScriptDialogForWebView:)];
m_delegateMethods.dismissCurrentJavaScriptDialogForWebView = [delegate respondsToSelector:@selector(_automationSession:dismissCurrentJavaScriptDialogForWebView:)];
m_delegateMethods.acceptCurrentJavaScriptDialogForWebView = [delegate respondsToSelector:@selector(_automationSession:acceptCurrentJavaScriptDialogForWebView:)];
@@ -59,6 +60,7 @@
m_delegateMethods.requestSwitchToPage = [delegate respondsToSelector:@selector(_automationSession:requestSwitchToPage:completionHandler:)];
m_delegateMethods.requestHideWindowOfPage = [delegate respondsToSelector:@selector(_automationSession:requestHideWindowOfPage:completionHandler:)];
m_delegateMethods.requestRestoreWindowOfPage = [delegate respondsToSelector:@selector(_automationSession:requestRestoreWindowOfPage:completionHandler:)];
+ m_delegateMethods.requestMaximizeWindowOfPage = [delegate respondsToSelector:@selector(_automationSession:requestMaximizeWindowOfPage:completionHandler:)];
m_delegateMethods.isShowingJavaScriptDialogOnPage = [delegate respondsToSelector:@selector(_automationSession:isShowingJavaScriptDialogOnPage:)];
m_delegateMethods.dismissCurrentJavaScriptDialogOnPage = [delegate respondsToSelector:@selector(_automationSession:dismissCurrentJavaScriptDialogOnPage:)];
m_delegateMethods.acceptCurrentJavaScriptDialogOnPage = [delegate respondsToSelector:@selector(_automationSession:acceptCurrentJavaScriptDialogOnPage:)];
@@ -140,6 +142,20 @@
[m_delegate.get() _automationSession:wrapper(session) requestRestoreWindowOfPage:toAPI(&page) completionHandler:completionBlock.get()];
}
+void AutomationSessionClient::requestMaximizeWindowOfPage(WebAutomationSession& session, WebPageProxy& page, CompletionHandler<void()>&& completionHandler)
+{
+ if (!m_delegateMethods.requestMaximizeWindowOfWebView && !m_delegateMethods.requestMaximizeWindowOfPage) {
+ completionHandler();
+ return;
+ }
+
+ auto completionBlock = BlockPtr<void()>::fromCallable([completionHandler = WTFMove(completionHandler)]() { completionHandler(); });
+ if (m_delegateMethods.requestMaximizeWindowOfWebView)
+ [m_delegate.get() _automationSession:wrapper(session) requestMaximizeWindowOfWebView:fromWebPageProxy(page) completionHandler:completionBlock.get()];
+ else if (m_delegateMethods.requestMaximizeWindowOfPage)
+ [m_delegate.get() _automationSession:wrapper(session) requestMaximizeWindowOfPage:toAPI(&page) completionHandler:completionBlock.get()];
+}
+
bool AutomationSessionClient::isShowingJavaScriptDialogOnPage(WebAutomationSession& session, WebPageProxy& page)
{
if (m_delegateMethods.isShowingJavaScriptDialogForWebView)