WebKit Bugzilla
Attachment 341705 Details for
Bug 186167
: [Cocoa] Web Automation: use the session delegate to perform window maximize
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-186167-20180531164800.patch (text/plain), 10.28 KB, created by
BJ Burg
on 2018-05-31 16:48:01 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
BJ Burg
Created:
2018-05-31 16:48:01 PDT
Size:
10.28 KB
patch
obsolete
>Subversion Revision: 232196 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 433aadd872a8964dc62a0fb866f8bb72e3bf0eea..db6cf74f6399b552b45e9285add1a221e4ac1ecc 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,19 @@ >+2018-05-31 Brian Burg <bburg@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 NOBODY (OOPS!). >+ >+ 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-05-25 Adrian Perez de Castro <aperez@igalia.com> > > Unreviewed. Update OptionsGTK.cmake and NEWS for 2.21.2 release. >diff --git a/Source/WebKit/UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h b/Source/WebKit/UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h >index a59f6a0be647ae00fcfce086e5b95151d412bdf8..7c0541ed7584b2d214bc211e360e5eda9727b551 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h >+++ b/Source/WebKit/UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h >@@ -54,6 +54,7 @@ typedef NS_ENUM(NSUInteger, _WKAutomationSessionBrowsingContextOptions) { > - (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 @@ typedef NS_ENUM(NSUInteger, _WKAutomationSessionBrowsingContextOptions) { > - (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)); >diff --git a/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.h b/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.h >index 7b0f2205e09766423d5cf147b6557f6b1b28a9c5..32e95d8b5f2d1e4f03541279b6bc4c8053c294d1 100644 >--- a/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.h >+++ b/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.h >@@ -49,6 +49,7 @@ private: > 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 @@ private: > 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 @@ private: > bool requestSwitchToPage : 1; > bool requestHideWindowOfPage : 1; > bool requestRestoreWindowOfPage : 1; >+ bool requestMaximizeWindowOfPage : 1; > bool isShowingJavaScriptDialogOnPage : 1; > bool dismissCurrentJavaScriptDialogOnPage : 1; > bool acceptCurrentJavaScriptDialogOnPage : 1; >diff --git a/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm b/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm >index 7970ba39a8554d2d3fec1850c721bdcca24cc3c6..74f49115c6f89020aae76a68e1c935d5bc2c444c 100644 >--- a/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm >+++ b/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm >@@ -47,6 +47,7 @@ AutomationSessionClient::AutomationSessionClient(id <_WKAutomationSessionDelegat > 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 @@ AutomationSessionClient::AutomationSessionClient(id <_WKAutomationSessionDelegat > 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 @@ void AutomationSessionClient::requestRestoreWindowOfPage(WebAutomationSession& s > [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)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
timothy
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186167
: 341705