Diff
Modified: trunk/Source/WebKit/ChangeLog (221886 => 221887)
--- trunk/Source/WebKit/ChangeLog 2017-09-11 22:43:30 UTC (rev 221886)
+++ trunk/Source/WebKit/ChangeLog 2017-09-11 22:51:18 UTC (rev 221887)
@@ -1,3 +1,82 @@
+2017-09-11 Alex Christensen <[email protected]>
+
+ Modernize and make API::UIClient more asynchronous
+ https://bugs.webkit.org/show_bug.cgi?id=176583
+
+ Reviewed by Brian Burg.
+
+ API::UIClient calls that return values synchronously require synchronous APIs unnecessarily.
+ Having them call completion handlers with the results instead allows us to make asynchronous
+ APIs, and existing synchronous APIs can just call the completion handlers immediately.
+
+ Unfortunately an assumption that API::UIClient::windowFrame returns synchronously had worked
+ its way into the WebAutomationSession, which calls WebPageProxy::getWindowFrame. Making it
+ asynchronous required making some automation protocols asynchronous so they can send their
+ result once they have the resulting frames from the UIClient.
+
+ No change in behaviour.
+
+ * UIProcess/API/APIUIClient.h:
+ (API::UIClient::setToolbarsAreVisible):
+ (API::UIClient::menuBarIsVisible):
+ (API::UIClient::setMenuBarIsVisible):
+ (API::UIClient::statusBarIsVisible):
+ (API::UIClient::setStatusBarIsVisible):
+ (API::UIClient::isResizable):
+ (API::UIClient::setIsResizable):
+ (API::UIClient::setWindowFrame):
+ (API::UIClient::windowFrame):
+ (API::UIClient::headerHeight):
+ (API::UIClient::footerHeight):
+ (API::UIClient::drawHeader):
+ (API::UIClient::drawFooter):
+ (API::UIClient::printFrame):
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetPageUIClient):
+ * UIProcess/Automation/Automation.json:
+ * UIProcess/Automation/WebAutomationSession.cpp:
+ (WebKit::WebAutomationSession::buildBrowsingContextForPage):
+ (WebKit::WebAutomationSession::getNextContext):
+ (WebKit::WebAutomationSession::getBrowsingContexts):
+ (WebKit::WebAutomationSession::getBrowsingContext):
+ (WebKit::WebAutomationSession::resizeWindowOfBrowsingContext):
+ (WebKit::WebAutomationSession::moveWindowOfBrowsingContext):
+ (WebKit::WebAutomationSession::performMouseInteraction):
+ * UIProcess/Automation/WebAutomationSession.h:
+ * UIProcess/Cocoa/UIDelegate.h:
+ * UIProcess/Cocoa/UIDelegate.mm:
+ (WebKit::UIDelegate::UIClient::printFrame):
+ * UIProcess/Cocoa/WebViewImpl.mm:
+ (WebKit::WebViewImpl::printOperationWithPrintInfo):
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::runJavaScriptPrompt):
+ (WebKit::WebPageProxy::setToolbarsAreVisible):
+ (WebKit::WebPageProxy::setMenuBarIsVisible):
+ (WebKit::WebPageProxy::getMenuBarIsVisible):
+ (WebKit::WebPageProxy::setStatusBarIsVisible):
+ (WebKit::WebPageProxy::getStatusBarIsVisible):
+ (WebKit::WebPageProxy::setIsResizable):
+ (WebKit::WebPageProxy::getIsResizable):
+ (WebKit::WebPageProxy::setWindowFrame):
+ (WebKit::WebPageProxy::getWindowFrame):
+ (WebKit::WebPageProxy::getWindowFrameWithCompletionHandler):
+ (WebKit::WebPageProxy::screenToRootView):
+ (WebKit::WebPageProxy::rootViewToScreen):
+ (WebKit::WebPageProxy::printFrame):
+ (WebKit::WebPageProxy::headerHeight):
+ (WebKit::WebPageProxy::footerHeight):
+ (WebKit::WebPageProxy::drawHeader):
+ (WebKit::WebPageProxy::drawFooter):
+ * UIProcess/WebPageProxy.h:
+ * UIProcess/WebPageProxy.messages.in:
+ * UIProcess/mac/WKPrintingView.h:
+ * UIProcess/mac/WKPrintingView.mm:
+ (-[WKPrintingView initWithFrameProxy:view:]):
+ (-[WKPrintingView _adjustPrintingMarginsForHeaderAndFooter]):
+ (-[WKPrintingView drawPageBorderWithSize:]):
+ * UIProcess/mac/WebPageProxyMac.mm:
+ (WebKit::WebPageProxy::windowAndViewFramesChanged):
+
2017-09-11 Stephan Szabo <[email protected]>
[WinCairo] Add entry Web Process files for wincairo webkit
Modified: trunk/Source/WebKit/UIProcess/API/APIUIClient.h (221886 => 221887)
--- trunk/Source/WebKit/UIProcess/API/APIUIClient.h 2017-09-11 22:43:30 UTC (rev 221886)
+++ trunk/Source/WebKit/UIProcess/API/APIUIClient.h 2017-09-11 22:51:18 UTC (rev 221887)
@@ -99,16 +99,16 @@
virtual void didNotHandleWheelEvent(WebKit::WebPageProxy*, const WebKit::NativeWebWheelEvent&) { }
virtual void toolbarsAreVisible(WebKit::WebPageProxy&, Function<void(bool)>&& completionHandler) { completionHandler(true); }
- virtual void setToolbarsAreVisible(WebKit::WebPageProxy*, bool) { }
- virtual bool menuBarIsVisible(WebKit::WebPageProxy*) { return true; }
- virtual void setMenuBarIsVisible(WebKit::WebPageProxy*, bool) { }
- virtual bool statusBarIsVisible(WebKit::WebPageProxy*) { return true; }
- virtual void setStatusBarIsVisible(WebKit::WebPageProxy*, bool) { }
- virtual bool isResizable(WebKit::WebPageProxy*) { return true; }
- virtual void setIsResizable(WebKit::WebPageProxy*, bool) { }
+ virtual void setToolbarsAreVisible(WebKit::WebPageProxy&, bool) { }
+ virtual void menuBarIsVisible(WebKit::WebPageProxy&, Function<void(bool)>&& completionHandler) { completionHandler(true); }
+ virtual void setMenuBarIsVisible(WebKit::WebPageProxy&, bool) { }
+ virtual void statusBarIsVisible(WebKit::WebPageProxy&, Function<void(bool)>&& completionHandler) { completionHandler(true); }
+ virtual void setStatusBarIsVisible(WebKit::WebPageProxy&, bool) { }
+ virtual void isResizable(WebKit::WebPageProxy&, Function<void(bool)>&& completionHandler) { completionHandler(true); }
+ virtual void setIsResizable(WebKit::WebPageProxy&, bool) { }
- virtual void setWindowFrame(WebKit::WebPageProxy*, const WebCore::FloatRect&) { }
- virtual WebCore::FloatRect windowFrame(WebKit::WebPageProxy*) { return WebCore::FloatRect(); }
+ virtual void setWindowFrame(WebKit::WebPageProxy&, const WebCore::FloatRect&) { }
+ virtual void windowFrame(WebKit::WebPageProxy&, Function<void(WebCore::FloatRect)>&& completionHandler) { completionHandler({ }); }
virtual bool canRunBeforeUnloadConfirmPanel() const { return false; }
virtual void runBeforeUnloadConfirmPanel(WebKit::WebPageProxy*, const WTF::String&, WebKit::WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void (bool)>&& completionHandler) { completionHandler(true); }
@@ -132,11 +132,11 @@
virtual bool decidePolicyForNotificationPermissionRequest(WebKit::WebPageProxy*, SecurityOrigin*, WebKit::NotificationPermissionRequest*) { return false; }
// Printing.
- virtual float headerHeight(WebKit::WebPageProxy*, WebKit::WebFrameProxy*) { return 0; }
- virtual float footerHeight(WebKit::WebPageProxy*, WebKit::WebFrameProxy*) { return 0; }
- virtual void drawHeader(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, const WebCore::FloatRect&) { }
- virtual void drawFooter(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, const WebCore::FloatRect&) { }
- virtual void printFrame(WebKit::WebPageProxy*, WebKit::WebFrameProxy*) { }
+ virtual float headerHeight(WebKit::WebPageProxy&, WebKit::WebFrameProxy&) { return 0; }
+ virtual float footerHeight(WebKit::WebPageProxy&, WebKit::WebFrameProxy&) { return 0; }
+ virtual void drawHeader(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, WebCore::FloatRect&&) { }
+ virtual void drawFooter(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, WebCore::FloatRect&&) { }
+ virtual void printFrame(WebKit::WebPageProxy&, WebKit::WebFrameProxy&) { }
virtual bool canRunModal() const { return false; }
virtual void runModal(WebKit::WebPageProxy*) { }
Modified: trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp (221886 => 221887)
--- trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp 2017-09-11 22:43:30 UTC (rev 221886)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp 2017-09-11 22:51:18 UTC (rev 221887)
@@ -1839,69 +1839,69 @@
completionHandler(m_client.toolbarsAreVisible(toAPI(&page), m_client.base.clientInfo));
}
- void setToolbarsAreVisible(WebPageProxy* page, bool visible) final
+ void setToolbarsAreVisible(WebPageProxy& page, bool visible) final
{
if (!m_client.setToolbarsAreVisible)
return;
- m_client.setToolbarsAreVisible(toAPI(page), visible, m_client.base.clientInfo);
+ m_client.setToolbarsAreVisible(toAPI(&page), visible, m_client.base.clientInfo);
}
- bool menuBarIsVisible(WebPageProxy* page) final
+ void menuBarIsVisible(WebPageProxy& page, Function<void(bool)>&& completionHandler) final
{
if (!m_client.menuBarIsVisible)
- return true;
- return m_client.menuBarIsVisible(toAPI(page), m_client.base.clientInfo);
+ return completionHandler(true);
+ completionHandler(m_client.menuBarIsVisible(toAPI(&page), m_client.base.clientInfo));
}
- void setMenuBarIsVisible(WebPageProxy* page, bool visible) final
+ void setMenuBarIsVisible(WebPageProxy& page, bool visible) final
{
if (!m_client.setMenuBarIsVisible)
return;
- m_client.setMenuBarIsVisible(toAPI(page), visible, m_client.base.clientInfo);
+ m_client.setMenuBarIsVisible(toAPI(&page), visible, m_client.base.clientInfo);
}
- bool statusBarIsVisible(WebPageProxy* page) final
+ void statusBarIsVisible(WebPageProxy& page, Function<void(bool)>&& completionHandler) final
{
if (!m_client.statusBarIsVisible)
- return true;
- return m_client.statusBarIsVisible(toAPI(page), m_client.base.clientInfo);
+ return completionHandler(true);
+ completionHandler(m_client.statusBarIsVisible(toAPI(&page), m_client.base.clientInfo));
}
- void setStatusBarIsVisible(WebPageProxy* page, bool visible) final
+ void setStatusBarIsVisible(WebPageProxy& page, bool visible) final
{
if (!m_client.setStatusBarIsVisible)
return;
- m_client.setStatusBarIsVisible(toAPI(page), visible, m_client.base.clientInfo);
+ m_client.setStatusBarIsVisible(toAPI(&page), visible, m_client.base.clientInfo);
}
- bool isResizable(WebPageProxy* page) final
+ void isResizable(WebPageProxy& page, Function<void(bool)>&& completionHandler) final
{
if (!m_client.isResizable)
- return true;
- return m_client.isResizable(toAPI(page), m_client.base.clientInfo);
+ return completionHandler(true);
+ completionHandler(m_client.isResizable(toAPI(&page), m_client.base.clientInfo));
}
- void setIsResizable(WebPageProxy* page, bool resizable) final
+ void setIsResizable(WebPageProxy& page, bool resizable) final
{
if (!m_client.setIsResizable)
return;
- m_client.setIsResizable(toAPI(page), resizable, m_client.base.clientInfo);
+ m_client.setIsResizable(toAPI(&page), resizable, m_client.base.clientInfo);
}
- void setWindowFrame(WebPageProxy* page, const FloatRect& frame) final
+ void setWindowFrame(WebPageProxy& page, const FloatRect& frame) final
{
if (!m_client.setWindowFrame)
return;
- m_client.setWindowFrame(toAPI(page), toAPI(frame), m_client.base.clientInfo);
+ m_client.setWindowFrame(toAPI(&page), toAPI(frame), m_client.base.clientInfo);
}
- FloatRect windowFrame(WebPageProxy* page) final
+ void windowFrame(WebPageProxy& page, Function<void(WebCore::FloatRect)>&& completionHandler) final
{
if (!m_client.getWindowFrame)
- return FloatRect();
+ return completionHandler({ });
- return toFloatRect(m_client.getWindowFrame(toAPI(page), m_client.base.clientInfo));
+ completionHandler(toFloatRect(m_client.getWindowFrame(toAPI(&page), m_client.base.clientInfo)));
}
bool canRunBeforeUnloadConfirmPanel() const final
@@ -1989,44 +1989,44 @@
}
// Printing.
- float headerHeight(WebPageProxy* page, WebFrameProxy* frame) final
+ float headerHeight(WebPageProxy& page, WebFrameProxy& frame) final
{
if (!m_client.headerHeight)
return 0;
- return m_client.headerHeight(toAPI(page), toAPI(frame), m_client.base.clientInfo);
+ return m_client.headerHeight(toAPI(&page), toAPI(&frame), m_client.base.clientInfo);
}
- float footerHeight(WebPageProxy* page, WebFrameProxy* frame) final
+ float footerHeight(WebPageProxy& page, WebFrameProxy& frame) final
{
if (!m_client.footerHeight)
return 0;
- return m_client.footerHeight(toAPI(page), toAPI(frame), m_client.base.clientInfo);
+ return m_client.footerHeight(toAPI(&page), toAPI(&frame), m_client.base.clientInfo);
}
- void drawHeader(WebPageProxy* page, WebFrameProxy* frame, const WebCore::FloatRect& rect) final
+ void drawHeader(WebPageProxy& page, WebFrameProxy& frame, WebCore::FloatRect&& rect) final
{
if (!m_client.drawHeader)
return;
- m_client.drawHeader(toAPI(page), toAPI(frame), toAPI(rect), m_client.base.clientInfo);
+ m_client.drawHeader(toAPI(&page), toAPI(&frame), toAPI(rect), m_client.base.clientInfo);
}
- void drawFooter(WebPageProxy* page, WebFrameProxy* frame, const WebCore::FloatRect& rect) final
+ void drawFooter(WebPageProxy& page, WebFrameProxy& frame, WebCore::FloatRect&& rect) final
{
if (!m_client.drawFooter)
return;
- m_client.drawFooter(toAPI(page), toAPI(frame), toAPI(rect), m_client.base.clientInfo);
+ m_client.drawFooter(toAPI(&page), toAPI(&frame), toAPI(rect), m_client.base.clientInfo);
}
- void printFrame(WebPageProxy* page, WebFrameProxy* frame) final
+ void printFrame(WebPageProxy& page, WebFrameProxy& frame) final
{
if (!m_client.printFrame)
return;
- m_client.printFrame(toAPI(page), toAPI(frame), m_client.base.clientInfo);
+ m_client.printFrame(toAPI(&page), toAPI(&frame), m_client.base.clientInfo);
}
bool canRunModal() const final
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp (221886 => 221887)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp 2017-09-11 22:43:30 UTC (rev 221886)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp 2017-09-11 22:51:18 UTC (rev 221887)
@@ -53,28 +53,28 @@
return webkitWebViewCreateNewPage(m_webView, windowFeatures, &navigationAction);
}
- void showPage(WebPageProxy*) override
+ void showPage(WebPageProxy*) final
{
webkitWebViewReadyToShowPage(m_webView);
}
- void close(WebPageProxy*) override
+ void close(WebPageProxy*) final
{
webkitWebViewClosePage(m_webView);
}
- void runJavaScriptAlert(WebPageProxy*, const String& message, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void ()>&& completionHandler) override
+ void runJavaScriptAlert(WebPageProxy*, const String& message, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void()>&& completionHandler) final
{
webkitWebViewRunJavaScriptAlert(m_webView, message.utf8());
completionHandler();
}
- void runJavaScriptConfirm(WebPageProxy*, const String& message, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void (bool)>&& completionHandler) override
+ void runJavaScriptConfirm(WebPageProxy*, const String& message, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void(bool)>&& completionHandler) final
{
completionHandler(webkitWebViewRunJavaScriptConfirm(m_webView, message.utf8()));
}
- void runJavaScriptPrompt(WebPageProxy*, const String& message, const String& defaultValue, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void (const String&)>&& completionHandler) override
+ void runJavaScriptPrompt(WebPageProxy*, const String& message, const String& defaultValue, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void(const String&)>&& completionHandler) final
{
CString result = webkitWebViewRunJavaScriptPrompt(m_webView, message.utf8(), defaultValue.utf8());
if (result.isNull()) {
@@ -85,9 +85,9 @@
completionHandler(String::fromUTF8(result.data()));
}
- bool canRunBeforeUnloadConfirmPanel() const override { return true; }
+ bool canRunBeforeUnloadConfirmPanel() const final { return true; }
- void runBeforeUnloadConfirmPanel(WebPageProxy*, const String& message, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void (bool)>&& completionHandler) override
+ void runBeforeUnloadConfirmPanel(WebPageProxy*, const String& message, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void(bool)>&& completionHandler) final
{
completionHandler(webkitWebViewRunJavaScriptBeforeUnloadConfirm(m_webView, message.utf8()));
}
@@ -97,47 +97,47 @@
webkitWebViewMouseTargetChanged(m_webView, data, modifiers);
}
- void toolbarsAreVisible(WebPageProxy&, Function<void(bool)>&& completionHandler) override
+ void toolbarsAreVisible(WebPageProxy&, Function<void(bool)>&& completionHandler) final
{
completionHandler(webkit_window_properties_get_toolbar_visible(webkit_web_view_get_window_properties(m_webView)));
}
- void setToolbarsAreVisible(WebPageProxy*, bool visible) override
+ void setToolbarsAreVisible(WebPageProxy&, bool visible) final
{
webkitWindowPropertiesSetToolbarVisible(webkit_web_view_get_window_properties(m_webView), visible);
}
- bool menuBarIsVisible(WebPageProxy*) override
+ void menuBarIsVisible(WebPageProxy&, Function<void(bool)>&& completionHandler) final
{
- return webkit_window_properties_get_menubar_visible(webkit_web_view_get_window_properties(m_webView));
+ completionHandler(webkit_window_properties_get_menubar_visible(webkit_web_view_get_window_properties(m_webView)));
}
- void setMenuBarIsVisible(WebPageProxy*, bool visible) override
+ void setMenuBarIsVisible(WebPageProxy&, bool visible) final
{
webkitWindowPropertiesSetToolbarVisible(webkit_web_view_get_window_properties(m_webView), visible);
}
- bool statusBarIsVisible(WebPageProxy*) override
+ void statusBarIsVisible(WebPageProxy&, Function<void(bool)>&& completionHandler) final
{
- return webkit_window_properties_get_statusbar_visible(webkit_web_view_get_window_properties(m_webView));
+ completionHandler(webkit_window_properties_get_statusbar_visible(webkit_web_view_get_window_properties(m_webView)));
}
- void setStatusBarIsVisible(WebPageProxy*, bool visible) override
+ void setStatusBarIsVisible(WebPageProxy&, bool visible) final
{
webkitWindowPropertiesSetStatusbarVisible(webkit_web_view_get_window_properties(m_webView), visible);
}
- bool isResizable(WebPageProxy*) override
+ void isResizable(WebPageProxy&, Function<void(bool)>&& completionHandler) final
{
- return webkit_window_properties_get_resizable(webkit_web_view_get_window_properties(m_webView));
+ completionHandler(webkit_window_properties_get_resizable(webkit_web_view_get_window_properties(m_webView)));
}
- void setIsResizable(WebPageProxy*, bool resizable) override
+ void setIsResizable(WebPageProxy&, bool resizable) final
{
webkitWindowPropertiesSetResizable(webkit_web_view_get_window_properties(m_webView), resizable);
}
- void setWindowFrame(WebPageProxy*, const WebCore::FloatRect& frame) override
+ void setWindowFrame(WebPageProxy&, const WebCore::FloatRect& frame) final
{
#if PLATFORM(GTK)
GdkRectangle geometry = WebCore::IntRect(frame);
@@ -152,7 +152,7 @@
#endif
}
- WebCore::FloatRect windowFrame(WebPageProxy*) override
+ void windowFrame(WebPageProxy&, Function<void(WebCore::FloatRect)>&& completionHandler) final
{
#if PLATFORM(GTK)
GdkRectangle geometry = { 0, 0, 0, 0 };
@@ -161,14 +161,14 @@
gtk_window_get_position(GTK_WINDOW(window), &geometry.x, &geometry.y);
gtk_window_get_size(GTK_WINDOW(window), &geometry.width, &geometry.height);
}
- return WebCore::FloatRect(geometry);
+ completionHandler(WebCore::FloatRect(geometry));
#elif PLATFORM(WPE)
// FIXME: I guess this is actually the view size in WPE. We need more refactoring here.
- return { };
+ completionHandler({ });
#endif
}
- void exceededDatabaseQuota(WebPageProxy*, WebFrameProxy*, API::SecurityOrigin*, const String&, const String&, unsigned long long /*currentQuota*/, unsigned long long /*currentOriginUsage*/, unsigned long long /*currentDatabaseUsage*/, unsigned long long /*expectedUsage*/, Function<void (unsigned long long)>&& completionHandler) override
+ void exceededDatabaseQuota(WebPageProxy*, WebFrameProxy*, API::SecurityOrigin*, const String&, const String&, unsigned long long /*currentQuota*/, unsigned long long /*currentOriginUsage*/, unsigned long long /*currentDatabaseUsage*/, unsigned long long /*expectedUsage*/, Function<void(unsigned long long)>&& completionHandler) final
{
static const unsigned long long defaultQuota = 5 * 1024 * 1204; // 5 MB
// FIXME: Provide API for this.
@@ -175,7 +175,7 @@
completionHandler(defaultQuota);
}
- bool runOpenPanel(WebPageProxy*, WebFrameProxy*, const WebCore::SecurityOriginData&, API::OpenPanelParameters* parameters, WebOpenPanelResultListenerProxy* listener) override
+ bool runOpenPanel(WebPageProxy*, WebFrameProxy*, const WebCore::SecurityOriginData&, API::OpenPanelParameters* parameters, WebOpenPanelResultListenerProxy* listener) final
{
GRefPtr<WebKitFileChooserRequest> request = adoptGRef(webkitFileChooserRequestCreate(parameters, listener));
webkitWebViewRunFileChooserRequest(m_webView, request.get());
@@ -188,7 +188,7 @@
webkitWebViewMakePermissionRequest(m_webView, WEBKIT_PERMISSION_REQUEST(geolocationPermissionRequest.get()));
}
- bool decidePolicyForUserMediaPermissionRequest(WebPageProxy&, WebFrameProxy&, API::SecurityOrigin& userMediaDocumentOrigin, API::SecurityOrigin& topLevelDocumentOrigin, UserMediaPermissionRequestProxy& permissionRequest) override
+ bool decidePolicyForUserMediaPermissionRequest(WebPageProxy&, WebFrameProxy&, API::SecurityOrigin& userMediaDocumentOrigin, API::SecurityOrigin& topLevelDocumentOrigin, UserMediaPermissionRequestProxy& permissionRequest) final
{
GRefPtr<WebKitUserMediaPermissionRequest> userMediaPermissionRequest = adoptGRef(webkitUserMediaPermissionRequestCreate(permissionRequest, userMediaDocumentOrigin, topLevelDocumentOrigin));
webkitWebViewMakePermissionRequest(m_webView, WEBKIT_PERMISSION_REQUEST(userMediaPermissionRequest.get()));
@@ -195,7 +195,7 @@
return true;
}
- bool decidePolicyForNotificationPermissionRequest(WebPageProxy*, API::SecurityOrigin*, NotificationPermissionRequest* permissionRequest) override
+ bool decidePolicyForNotificationPermissionRequest(WebPageProxy*, API::SecurityOrigin*, NotificationPermissionRequest* permissionRequest) final
{
GRefPtr<WebKitNotificationPermissionRequest> notificationPermissionRequest = adoptGRef(webkitNotificationPermissionRequestCreate(permissionRequest));
webkitWebViewMakePermissionRequest(m_webView, WEBKIT_PERMISSION_REQUEST(notificationPermissionRequest.get()));
@@ -203,15 +203,15 @@
}
#if PLATFORM(GTK)
- void printFrame(WebPageProxy*, WebFrameProxy* frame) override
+ void printFrame(WebPageProxy&, WebFrameProxy& frame) final
{
- webkitWebViewPrintFrame(m_webView, frame);
+ webkitWebViewPrintFrame(m_webView, &frame);
}
#endif
- bool canRunModal() const override { return true; }
+ bool canRunModal() const final { return true; }
- void runModal(WebPageProxy*) override
+ void runModal(WebPageProxy*) final
{
webkitWebViewRunAsModal(m_webView);
}
Modified: trunk/Source/WebKit/UIProcess/Automation/Automation.json (221886 => 221887)
--- trunk/Source/WebKit/UIProcess/Automation/Automation.json 2017-09-11 22:43:30 UTC (rev 221886)
+++ trunk/Source/WebKit/UIProcess/Automation/Automation.json 2017-09-11 22:51:18 UTC (rev 221887)
@@ -225,7 +225,8 @@
"description": "Fetches information about all open browsing contexts (windows and tabs) in the automation session.",
"returns": [
{ "name": "contexts", "type": "array", "items": { "$ref": "BrowsingContext" }, "description": "All known browsing contexts available to the session." }
- ]
+ ],
+ "async": true
},
{
"name": "getBrowsingContext",
@@ -235,7 +236,8 @@
],
"returns": [
{ "name": "context", "$ref": "BrowsingContext", "description": "The browsing context available to the session." }
- ]
+ ],
+ "async": true
},
{
"name": "createBrowsingContext",
@@ -265,7 +267,8 @@
"parameters": [
{ "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context to be resized." },
{ "name": "size", "$ref": "Size", "description": "The new size for the browsing context's window." }
- ]
+ ],
+ "async": true
},
{
"name": "moveWindowOfBrowsingContext",
@@ -273,7 +276,8 @@
"parameters": [
{ "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context to be moved." },
{ "name": "origin", "$ref": "Point", "description": "The new origin for the browsing context's window. The position is interpreted in screen coordinate space, relative to the upper left corner of the screen." }
- ]
+ ],
+ "async": true
},
{
"name": "navigateBrowsingContext",
@@ -365,7 +369,8 @@
],
"returns": [
{ "name": "position", "$ref": "Point", "description": "The updated position of the mouse cursor, specified in viewport coordinates." }
- ]
+ ],
+ "async": true
},
{
"name": "performKeyboardInteractions",
Modified: trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp (221886 => 221887)
--- trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp 2017-09-11 22:43:30 UTC (rev 221886)
+++ trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp 2017-09-11 22:51:18 UTC (rev 221887)
@@ -207,11 +207,8 @@
return handleForWebFrameID(webFrameProxy.frameID());
}
-RefPtr<Inspector::Protocol::Automation::BrowsingContext> WebAutomationSession::buildBrowsingContextForPage(WebPageProxy& page)
+Ref<Inspector::Protocol::Automation::BrowsingContext> WebAutomationSession::buildBrowsingContextForPage(WebPageProxy& page, WebCore::FloatRect windowFrame)
{
- WebCore::FloatRect windowFrame;
- page.getWindowFrame(windowFrame);
-
auto originObject = Inspector::Protocol::Automation::Point::create()
.setX(windowFrame.x())
.setY(windowFrame.y())
@@ -235,28 +232,44 @@
// Platform-independent Commands.
-void WebAutomationSession::getBrowsingContexts(Inspector::ErrorString& errorString, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Automation::BrowsingContext>>& contexts)
+void WebAutomationSession::getNextContext(Ref<WebAutomationSession>&& protectedThis, Vector<Ref<WebPageProxy>>&& pages, Ref<Inspector::Protocol::Array<Inspector::Protocol::Automation::BrowsingContext>> contexts, Ref<WebAutomationSession::GetBrowsingContextsCallback>&& callback)
{
- contexts = Inspector::Protocol::Array<Inspector::Protocol::Automation::BrowsingContext>::create();
-
+ if (pages.isEmpty()) {
+ callback->sendSuccess(WTFMove(contexts));
+ return;
+ }
+ auto page = pages.takeLast();
+ auto& webPageProxy = page.get();
+ webPageProxy.getWindowFrameWithCallback([this, protectedThis = WTFMove(protectedThis), callback = WTFMove(callback), pages = WTFMove(pages), contexts = WTFMove(contexts), page = WTFMove(page)](WebCore::FloatRect windowFrame) mutable {
+ contexts->addItem(protectedThis->buildBrowsingContextForPage(page.get(), windowFrame));
+ getNextContext(WTFMove(protectedThis), WTFMove(pages), WTFMove(contexts), WTFMove(callback));
+ });
+}
+
+void WebAutomationSession::getBrowsingContexts(Inspector::ErrorString& errorString, Ref<GetBrowsingContextsCallback>&& callback)
+{
+ Vector<Ref<WebPageProxy>> pages;
for (auto& process : m_processPool->processes()) {
for (auto* page : process->pages()) {
ASSERT(page);
if (!page->isControlledByAutomation())
continue;
-
- contexts->addItem(buildBrowsingContextForPage(*page));
+ pages.append(*page);
}
}
+
+ getNextContext(makeRef(*this), WTFMove(pages), Inspector::Protocol::Array<Inspector::Protocol::Automation::BrowsingContext>::create(), WTFMove(callback));
}
-void WebAutomationSession::getBrowsingContext(Inspector::ErrorString& errorString, const String& handle, RefPtr<Inspector::Protocol::Automation::BrowsingContext>& context)
+void WebAutomationSession::getBrowsingContext(Inspector::ErrorString& errorString, const String& handle, Ref<GetBrowsingContextCallback>&& callback)
{
WebPageProxy* page = webPageProxyForHandle(handle);
if (!page)
FAIL_WITH_PREDEFINED_ERROR(WindowNotFound);
- context = buildBrowsingContextForPage(*page);
+ page->getWindowFrameWithCallback([protectedThis = makeRef(*this), page = makeRef(*page), callback = WTFMove(callback)](WebCore::FloatRect windowFrame) mutable {
+ callback->sendSuccess(protectedThis->buildBrowsingContextForPage(page.get(), windowFrame));
+ });
}
void WebAutomationSession::createBrowsingContext(Inspector::ErrorString& errorString, String* handle)
@@ -301,7 +314,7 @@
page->process().send(Messages::WebAutomationSessionProxy::FocusFrame(page->pageID(), frameID.value()), 0);
}
-void WebAutomationSession::resizeWindowOfBrowsingContext(Inspector::ErrorString& errorString, const String& handle, const Inspector::InspectorObject& sizeObject)
+void WebAutomationSession::resizeWindowOfBrowsingContext(Inspector::ErrorString& errorString, const String& handle, const Inspector::InspectorObject& sizeObject, Ref<ResizeWindowOfBrowsingContextCallback>&& callback)
{
#if PLATFORM(IOS)
FAIL_WITH_PREDEFINED_ERROR(NotImplemented);
@@ -324,27 +337,30 @@
if (!page)
FAIL_WITH_PREDEFINED_ERROR(WindowNotFound);
- WebCore::FloatRect originalFrame;
- page->getWindowFrame(originalFrame);
+ page->getWindowFrameWithCallback([callback = WTFMove(callback), page = makeRef(*page), width, height](WebCore::FloatRect originalFrame) mutable {
+ WebCore::FloatRect newFrame = WebCore::FloatRect(originalFrame.location(), WebCore::FloatSize(width, height));
+ if (newFrame == originalFrame)
+ return callback->sendSuccess();
- WebCore::FloatRect newFrame = WebCore::FloatRect(originalFrame.location(), WebCore::FloatSize(width, height));
- if (newFrame == originalFrame)
- return;
+ page->setWindowFrame(newFrame);
- page->setWindowFrame(newFrame);
-
-#if !PLATFORM(GTK)
- // If nothing changed at all, it's probably fair to report that something went wrong.
- // (We can't assume that the requested frame size will be honored exactly, however.)
- WebCore::FloatRect updatedFrame;
- page->getWindowFrame(updatedFrame);
- if (originalFrame == updatedFrame)
- FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InternalError, "The window size was expected to have changed, but did not.");
+#if PLATFORM(GTK)
+ callback->sendSuccess();
+#else
+ // If nothing changed at all, it's probably fair to report that something went wrong.
+ // (We can't assume that the requested frame size will be honored exactly, however.)
+ page->getWindowFrameWithCallback([callback = WTFMove(callback), originalFrame](WebCore::FloatRect updatedFrame) {
+ if (originalFrame == updatedFrame)
+ callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_NAME_AND_DETAILS(InternalError, "The window size was expected to have changed, but did not."));
+ else
+ callback->sendSuccess();
+ });
#endif
+ });
#endif
}
-void WebAutomationSession::moveWindowOfBrowsingContext(Inspector::ErrorString& errorString, const String& handle, const Inspector::InspectorObject& positionObject)
+void WebAutomationSession::moveWindowOfBrowsingContext(Inspector::ErrorString& errorString, const String& handle, const Inspector::InspectorObject& positionObject, Ref<MoveWindowOfBrowsingContextCallback>&& callback)
{
#if PLATFORM(IOS)
FAIL_WITH_PREDEFINED_ERROR(NotImplemented);
@@ -368,22 +384,27 @@
FAIL_WITH_PREDEFINED_ERROR(WindowNotFound);
WebCore::FloatRect originalFrame;
- page->getWindowFrame(originalFrame);
+ page->getWindowFrameWithCallback([callback = WTFMove(callback), page = makeRef(*page), x, y](WebCore::FloatRect originalFrame) mutable {
- WebCore::FloatRect newFrame = WebCore::FloatRect(WebCore::FloatPoint(x, y), originalFrame.size());
- if (newFrame == originalFrame)
- return;
+ WebCore::FloatRect newFrame = WebCore::FloatRect(WebCore::FloatPoint(x, y), originalFrame.size());
+ if (newFrame == originalFrame)
+ return callback->sendSuccess();
- page->setWindowFrame(newFrame);
+ page->setWindowFrame(newFrame);
-#if !PLATFORM(GTK)
- // If nothing changed at all, it's probably fair to report that something went wrong.
- // (We can't assume that the requested frame size will be honored exactly, however.)
- WebCore::FloatRect updatedFrame;
- page->getWindowFrame(updatedFrame);
- if (originalFrame == updatedFrame)
- FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InternalError, "The window position was expected to have changed, but did not.");
+#if PLATFORM(GTK)
+ callback->sendSuccess();
+#else
+ // If nothing changed at all, it's probably fair to report that something went wrong.
+ // (We can't assume that the requested frame size will be honored exactly, however.)
+ page->getWindowFrameWithCallback([callback = WTFMove(callback), originalFrame](WebCore::FloatRect updatedFrame) {
+ if (originalFrame == updatedFrame)
+ callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_NAME_AND_DETAILS(InternalError, "The window position was expected to have changed, but did not."));
+ else
+ callback->sendSuccess();
+ });
#endif
+ });
#endif
}
@@ -1221,7 +1242,7 @@
}
#endif // USE(APPKIT)
-void WebAutomationSession::performMouseInteraction(Inspector::ErrorString& errorString, const String& handle, const Inspector::InspectorObject& requestedPositionObject, const String& mouseButtonString, const String& mouseInteractionString, const Inspector::InspectorArray& keyModifierStrings, RefPtr<Inspector::Protocol::Automation::Point>& updatedPositionObject)
+void WebAutomationSession::performMouseInteraction(Inspector::ErrorString& errorString, const String& handle, const Inspector::InspectorObject& requestedPositionObject, const String& mouseButtonString, const String& mouseInteractionString, const Inspector::InspectorArray& keyModifierStrings, Ref<PerformMouseInteractionCallback>&& callback)
{
#if !USE(APPKIT) && !PLATFORM(GTK)
FAIL_WITH_PREDEFINED_ERROR(NotImplemented);
@@ -1238,22 +1259,6 @@
if (!requestedPositionObject.getDouble(WTF::ASCIILiteral("y"), y))
FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(MissingParameter, "The parameter 'y' was not found.");
- WebCore::FloatRect windowFrame;
- page->getWindowFrame(windowFrame);
-
- x = std::min(std::max(0.0f, x), windowFrame.size().width());
- y = std::min(std::max(0.0f, y + page->topContentInset()), windowFrame.size().height());
-
- WebCore::IntPoint viewPosition = WebCore::IntPoint(static_cast<int>(x), static_cast<int>(y));
-
- auto parsedInteraction = Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::MouseInteraction>(mouseInteractionString);
- if (!parsedInteraction)
- FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "The parameter 'interaction' is invalid.");
-
- auto parsedButton = Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::MouseButton>(mouseButtonString);
- if (!parsedButton)
- FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "The parameter 'button' is invalid.");
-
WebEvent::Modifiers keyModifiers = (WebEvent::Modifiers)0;
for (auto it = keyModifierStrings.begin(); it != keyModifierStrings.end(); ++it) {
String modifierString;
@@ -1266,13 +1271,29 @@
WebEvent::Modifiers enumValue = protocolModifierToWebEventModifier(parsedModifier.value());
keyModifiers = (WebEvent::Modifiers)(enumValue | keyModifiers);
}
+
+ page->getWindowFrameWithCallback([this, protectedThis = makeRef(*this), callback = WTFMove(callback), page = makeRef(*page), x, y, mouseInteractionString, mouseButtonString, keyModifiers](WebCore::FloatRect windowFrame) mutable {
- platformSimulateMouseInteraction(*page, viewPosition, parsedInteraction.value(), parsedButton.value(), keyModifiers);
+ x = std::min(std::max(0.0f, x), windowFrame.size().width());
+ y = std::min(std::max(0.0f, y + page->topContentInset()), windowFrame.size().height());
- updatedPositionObject = Inspector::Protocol::Automation::Point::create()
- .setX(x)
- .setY(y - page->topContentInset())
- .release();
+ WebCore::IntPoint viewPosition = WebCore::IntPoint(static_cast<int>(x), static_cast<int>(y));
+
+ auto parsedInteraction = Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::MouseInteraction>(mouseInteractionString);
+ if (!parsedInteraction)
+ return callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_NAME_AND_DETAILS(InvalidParameter, "The parameter 'interaction' is invalid."));
+
+ auto parsedButton = Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::MouseButton>(mouseButtonString);
+ if (!parsedButton)
+ return callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_NAME_AND_DETAILS(InvalidParameter, "The parameter 'button' is invalid."));
+
+ platformSimulateMouseInteraction(page, viewPosition, parsedInteraction.value(), parsedButton.value(), keyModifiers);
+
+ callback->sendSuccess(Inspector::Protocol::Automation::Point::create()
+ .setX(x)
+ .setY(y - page->topContentInset())
+ .release());
+ });
#endif // USE(APPKIT)
}
Modified: trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.h (221886 => 221887)
--- trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.h 2017-09-11 22:43:30 UTC (rev 221886)
+++ trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.h 2017-09-11 22:51:18 UTC (rev 221887)
@@ -115,13 +115,13 @@
// and the --platform argument passed to the protocol bindings generator.
// Platform: Generic
- void getBrowsingContexts(Inspector::ErrorString&, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Automation::BrowsingContext>>&) override;
- void getBrowsingContext(Inspector::ErrorString&, const String&, RefPtr<Inspector::Protocol::Automation::BrowsingContext>&) override;
+ void getBrowsingContexts(Inspector::ErrorString&, Ref<GetBrowsingContextsCallback>&&) final;
+ void getBrowsingContext(Inspector::ErrorString&, const String&, Ref<GetBrowsingContextCallback>&&) final;
void createBrowsingContext(Inspector::ErrorString&, String*) override;
void closeBrowsingContext(Inspector::ErrorString&, const String&) override;
void switchToBrowsingContext(Inspector::ErrorString&, const String& browsingContextHandle, const String* optionalFrameHandle) override;
- void resizeWindowOfBrowsingContext(Inspector::ErrorString&, const String& handle, const Inspector::InspectorObject& size) override;
- void moveWindowOfBrowsingContext(Inspector::ErrorString&, const String& handle, const Inspector::InspectorObject& position) override;
+ void resizeWindowOfBrowsingContext(Inspector::ErrorString&, const String& handle, const Inspector::InspectorObject& size, Ref<ResizeWindowOfBrowsingContextCallback>&&) final;
+ void moveWindowOfBrowsingContext(Inspector::ErrorString&, const String& handle, const Inspector::InspectorObject& position, Ref<MoveWindowOfBrowsingContextCallback>&&) final;
void navigateBrowsingContext(Inspector::ErrorString&, const String& handle, const String& url, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<NavigateBrowsingContextCallback>&&) override;
void goBackInBrowsingContext(Inspector::ErrorString&, const String&, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<GoBackInBrowsingContextCallback>&&) override;
void goForwardInBrowsingContext(Inspector::ErrorString&, const String&, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<GoForwardInBrowsingContextCallback>&&) override;
@@ -128,7 +128,7 @@
void reloadBrowsingContext(Inspector::ErrorString&, const String&, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<ReloadBrowsingContextCallback>&&) override;
void waitForNavigationToComplete(Inspector::ErrorString&, const String& browsingContextHandle, const String* optionalFrameHandle, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<WaitForNavigationToCompleteCallback>&&) override;
void evaluateJavaScriptFunction(Inspector::ErrorString&, const String& browsingContextHandle, const String* optionalFrameHandle, const String& function, const Inspector::InspectorArray& arguments, const bool* optionalExpectsImplicitCallbackArgument, const int* optionalCallbackTimeout, Ref<Inspector::AutomationBackendDispatcherHandler::EvaluateJavaScriptFunctionCallback>&&) override;
- void performMouseInteraction(Inspector::ErrorString&, const String& handle, const Inspector::InspectorObject& requestedPosition, const String& mouseButton, const String& mouseInteraction, const Inspector::InspectorArray& keyModifiers, RefPtr<Inspector::Protocol::Automation::Point>& updatedPosition) override;
+ void performMouseInteraction(Inspector::ErrorString&, const String& handle, const Inspector::InspectorObject& requestedPosition, const String& mouseButton, const String& mouseInteraction, const Inspector::InspectorArray& keyModifiers, Ref<PerformMouseInteractionCallback>&&) final;
void performKeyboardInteractions(Inspector::ErrorString&, const String& handle, const Inspector::InspectorArray& interactions, Ref<PerformKeyboardInteractionsCallback>&&) override;
void takeScreenshot(Inspector::ErrorString&, const String& handle, const String* optionalFrameHandle, const String* optionalNodeHandle, const bool* optionalScrollIntoViewIfNeeded, Ref<TakeScreenshotCallback>&&) override;
void resolveChildFrameHandle(Inspector::ErrorString&, const String& browsingContextHandle, const String* optionalFrameHandle, const int* optionalOrdinal, const String* optionalName, const String* optionalNodeHandle, Ref<ResolveChildFrameHandleCallback>&&) override;
@@ -160,7 +160,8 @@
private:
WebPageProxy* webPageProxyForHandle(const String&);
String handleForWebPageProxy(const WebPageProxy&);
- RefPtr<Inspector::Protocol::Automation::BrowsingContext> buildBrowsingContextForPage(WebPageProxy&);
+ Ref<Inspector::Protocol::Automation::BrowsingContext> buildBrowsingContextForPage(WebPageProxy&, WebCore::FloatRect windowFrame);
+ void getNextContext(Ref<WebAutomationSession>&&, Vector<Ref<WebPageProxy>>&&, Ref<Inspector::Protocol::Array<Inspector::Protocol::Automation::BrowsingContext>>, Ref<WebAutomationSession::GetBrowsingContextsCallback>&&);
std::optional<uint64_t> webFrameIDForHandle(const String&);
String handleForWebFrameID(uint64_t frameID);
Modified: trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h (221886 => 221887)
--- trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h 2017-09-11 22:43:30 UTC (rev 221886)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h 2017-09-11 22:51:18 UTC (rev 221887)
@@ -115,7 +115,7 @@
bool decidePolicyForUserMediaPermissionRequest(WebPageProxy&, WebFrameProxy&, API::SecurityOrigin&, API::SecurityOrigin&, UserMediaPermissionRequestProxy&) final;
bool checkUserMediaPermissionForOrigin(WebPageProxy&, WebFrameProxy&, API::SecurityOrigin&, API::SecurityOrigin&, UserMediaPermissionCheckProxy&) final;
void mediaCaptureStateDidChange(WebCore::MediaProducer::MediaStateFlags) final;
- void printFrame(WebPageProxy*, WebFrameProxy*) final;
+ void printFrame(WebPageProxy&, WebFrameProxy&) final;
#if PLATFORM(IOS)
#if HAVE(APP_LINKS)
bool shouldIncludeAppLinkActionsForElement(_WKActivatedElementInfo *) final;
Modified: trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm (221886 => 221887)
--- trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2017-09-11 22:43:30 UTC (rev 221886)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2017-09-11 22:51:18 UTC (rev 221887)
@@ -851,10 +851,8 @@
}).get()];
}
-void UIDelegate::UIClient::printFrame(WebPageProxy*, WebFrameProxy* webFrameProxy)
+void UIDelegate::UIClient::printFrame(WebPageProxy&, WebFrameProxy& webFrameProxy)
{
- ASSERT_ARG(webFrameProxy, webFrameProxy);
-
if (!m_uiDelegate.m_delegateMethods.webViewPrintFrame)
return;
@@ -862,7 +860,7 @@
if (!delegate)
return;
- [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView printFrame:wrapper(API::FrameHandle::create(webFrameProxy->frameID()))];
+ [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView printFrame:wrapper(API::FrameHandle::create(webFrameProxy.frameID()))];
}
void UIDelegate::UIClient::close(WebPageProxy*)
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (221886 => 221887)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm 2017-09-11 22:43:30 UTC (rev 221886)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm 2017-09-11 22:51:18 UTC (rev 221887)
@@ -1628,7 +1628,7 @@
// FIXME: If the frame cannot be printed (e.g. if it contains an encrypted PDF that disallows
// printing), this function should return nil.
- RetainPtr<WKPrintingView> printingView = adoptNS([[WKPrintingView alloc] initWithFrameProxy:&frame view:m_view.getAutoreleased()]);
+ RetainPtr<WKPrintingView> printingView = adoptNS([[WKPrintingView alloc] initWithFrameProxy:frame view:m_view.getAutoreleased()]);
// NSPrintOperation takes ownership of the view.
NSPrintOperation *printOperation = [NSPrintOperation printOperationWithView:printingView.get() printInfo:printInfo];
[printOperation setCanSpawnSeparateThread:YES];
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (221886 => 221887)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2017-09-11 22:43:30 UTC (rev 221886)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2017-09-11 22:51:18 UTC (rev 221887)
@@ -3959,7 +3959,7 @@
});
}
-void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const SecurityOriginData& securityOrigin, const String& message, const String& defaultValue, RefPtr<Messages::WebPageProxy::RunJavaScriptPrompt::DelayedReply> reply)
+void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const SecurityOriginData& securityOrigin, const String& message, const String& defaultValue, Ref<Messages::WebPageProxy::RunJavaScriptPrompt::DelayedReply>&& reply)
{
WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
@@ -3972,7 +3972,9 @@
automationSession->willShowJavaScriptDialog(*this);
}
- m_uiClient->runJavaScriptPrompt(this, message, defaultValue, frame, securityOrigin, [reply](const String& result) { reply->send(result); });
+ m_uiClient->runJavaScriptPrompt(this, message, defaultValue, frame, securityOrigin, [reply = WTFMove(reply)](const String& result) {
+ reply->send(result);
+ });
}
void WebPageProxy::setStatusText(const String& text)
@@ -4062,7 +4064,7 @@
void WebPageProxy::setToolbarsAreVisible(bool toolbarsAreVisible)
{
- m_uiClient->setToolbarsAreVisible(this, toolbarsAreVisible);
+ m_uiClient->setToolbarsAreVisible(*this, toolbarsAreVisible);
}
void WebPageProxy::getToolbarsAreVisible(Ref<Messages::WebPageProxy::GetToolbarsAreVisible::DelayedReply>&& reply)
@@ -4074,52 +4076,65 @@
void WebPageProxy::setMenuBarIsVisible(bool menuBarIsVisible)
{
- m_uiClient->setMenuBarIsVisible(this, menuBarIsVisible);
+ m_uiClient->setMenuBarIsVisible(*this, menuBarIsVisible);
}
-void WebPageProxy::getMenuBarIsVisible(bool& menuBarIsVisible)
+void WebPageProxy::getMenuBarIsVisible(Ref<Messages::WebPageProxy::GetMenuBarIsVisible::DelayedReply>&& reply)
{
- menuBarIsVisible = m_uiClient->menuBarIsVisible(this);
+ m_uiClient->menuBarIsVisible(*this, [reply = WTFMove(reply)] (bool visible) {
+ reply->send(visible);
+ });
}
void WebPageProxy::setStatusBarIsVisible(bool statusBarIsVisible)
{
- m_uiClient->setStatusBarIsVisible(this, statusBarIsVisible);
+ m_uiClient->setStatusBarIsVisible(*this, statusBarIsVisible);
}
-void WebPageProxy::getStatusBarIsVisible(bool& statusBarIsVisible)
+void WebPageProxy::getStatusBarIsVisible(Ref<Messages::WebPageProxy::GetStatusBarIsVisible::DelayedReply>&& reply)
{
- statusBarIsVisible = m_uiClient->statusBarIsVisible(this);
+ m_uiClient->statusBarIsVisible(*this, [reply = WTFMove(reply)] (bool visible) {
+ reply->send(visible);
+ });
}
void WebPageProxy::setIsResizable(bool isResizable)
{
- m_uiClient->setIsResizable(this, isResizable);
+ m_uiClient->setIsResizable(*this, isResizable);
}
-void WebPageProxy::getIsResizable(bool& isResizable)
+void WebPageProxy::getIsResizable(Ref<Messages::WebPageProxy::GetIsResizable::DelayedReply>&& reply)
{
- isResizable = m_uiClient->isResizable(this);
+ m_uiClient->isResizable(*this, [reply = WTFMove(reply)] (bool resizable) {
+ reply->send(resizable);
+ });
}
void WebPageProxy::setWindowFrame(const FloatRect& newWindowFrame)
{
- m_uiClient->setWindowFrame(this, m_pageClient.convertToDeviceSpace(newWindowFrame));
+ m_uiClient->setWindowFrame(*this, m_pageClient.convertToDeviceSpace(newWindowFrame));
}
-void WebPageProxy::getWindowFrame(FloatRect& newWindowFrame)
+void WebPageProxy::getWindowFrame(Ref<Messages::WebPageProxy::GetWindowFrame::DelayedReply>&& reply)
{
- newWindowFrame = m_pageClient.convertToUserSpace(m_uiClient->windowFrame(this));
+ m_uiClient->windowFrame(*this, [this, protectedThis = makeRef(*this), reply = WTFMove(reply)] (FloatRect frame) {
+ reply->send(m_pageClient.convertToUserSpace(frame));
+ });
}
-
-void WebPageProxy::screenToRootView(const IntPoint& screenPoint, IntPoint& windowPoint)
+
+void WebPageProxy::getWindowFrameWithCallback(Function<void(FloatRect)>&& completionHandler)
{
- windowPoint = m_pageClient.screenToRootView(screenPoint);
+ m_uiClient->windowFrame(*this, WTFMove(completionHandler));
}
+
+void WebPageProxy::screenToRootView(const IntPoint& screenPoint, Ref<Messages::WebPageProxy::ScreenToRootView::DelayedReply>&& reply)
+{
+ reply->send(m_pageClient.screenToRootView(screenPoint));
+}
-void WebPageProxy::rootViewToScreen(const IntRect& viewRect, IntRect& result)
+void WebPageProxy::rootViewToScreen(const IntRect& viewRect, Ref<Messages::WebPageProxy::RootViewToScreen::DelayedReply>&& reply)
{
- result = m_pageClient.rootViewToScreen(viewRect);
+ reply->send(m_pageClient.rootViewToScreen(viewRect));
}
#if PLATFORM(IOS)
@@ -4205,7 +4220,7 @@
WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
- m_uiClient->printFrame(this, frame);
+ m_uiClient->printFrame(*this, *frame);
endPrinting(); // Send a message synchronously while m_isPerformingDOMPrintOperation is still true.
m_isPerformingDOMPrintOperation = false;
@@ -5912,32 +5927,32 @@
m_process->processPool().supplement<WebNotificationManagerProxy>()->didDestroyNotification(this, notificationID);
}
-float WebPageProxy::headerHeight(WebFrameProxy* frame)
+float WebPageProxy::headerHeight(WebFrameProxy& frame)
{
- if (frame->isDisplayingPDFDocument())
+ if (frame.isDisplayingPDFDocument())
return 0;
- return m_uiClient->headerHeight(this, frame);
+ return m_uiClient->headerHeight(*this, frame);
}
-float WebPageProxy::footerHeight(WebFrameProxy* frame)
+float WebPageProxy::footerHeight(WebFrameProxy& frame)
{
- if (frame->isDisplayingPDFDocument())
+ if (frame.isDisplayingPDFDocument())
return 0;
- return m_uiClient->footerHeight(this, frame);
+ return m_uiClient->footerHeight(*this, frame);
}
-void WebPageProxy::drawHeader(WebFrameProxy* frame, const FloatRect& rect)
+void WebPageProxy::drawHeader(WebFrameProxy& frame, FloatRect&& rect)
{
- if (frame->isDisplayingPDFDocument())
+ if (frame.isDisplayingPDFDocument())
return;
- m_uiClient->drawHeader(this, frame, rect);
+ m_uiClient->drawHeader(*this, frame, WTFMove(rect));
}
-void WebPageProxy::drawFooter(WebFrameProxy* frame, const FloatRect& rect)
+void WebPageProxy::drawFooter(WebFrameProxy& frame, FloatRect&& rect)
{
- if (frame->isDisplayingPDFDocument())
+ if (frame.isDisplayingPDFDocument())
return;
- m_uiClient->drawFooter(this, frame, rect);
+ m_uiClient->drawFooter(*this, frame, WTFMove(rect));
}
void WebPageProxy::runModal()
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (221886 => 221887)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.h 2017-09-11 22:43:30 UTC (rev 221886)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h 2017-09-11 22:51:18 UTC (rev 221887)
@@ -808,10 +808,10 @@
void runJavaScriptInMainFrame(const String&, bool, WTF::Function<void (API::SerializedScriptValue*, bool hadException, const WebCore::ExceptionDetails&, CallbackBase::Error)>&& callbackFunction);
void forceRepaint(RefPtr<VoidCallback>&&);
- float headerHeight(WebFrameProxy*);
- float footerHeight(WebFrameProxy*);
- void drawHeader(WebFrameProxy*, const WebCore::FloatRect&);
- void drawFooter(WebFrameProxy*, const WebCore::FloatRect&);
+ float headerHeight(WebFrameProxy&);
+ float footerHeight(WebFrameProxy&);
+ void drawHeader(WebFrameProxy&, WebCore::FloatRect&&);
+ void drawFooter(WebFrameProxy&, WebCore::FloatRect&&);
#if PLATFORM(COCOA)
// Dictionary.
@@ -1168,7 +1168,8 @@
void setFocus(bool focused);
void setWindowFrame(const WebCore::FloatRect&);
- void getWindowFrame(WebCore::FloatRect&);
+ void getWindowFrame(Ref<Messages::WebPageProxy::GetWindowFrame::DelayedReply>&&);
+ void getWindowFrameWithCallback(Function<void(WebCore::FloatRect)>&&);
bool isResourceCachingDisabled() const { return m_isResourceCachingDisabled; }
void setResourceCachingDisabled(bool);
@@ -1296,7 +1297,7 @@
void showPage();
void runJavaScriptAlert(uint64_t frameID, const WebCore::SecurityOriginData&, const String&, Ref<Messages::WebPageProxy::RunJavaScriptAlert::DelayedReply>&&);
void runJavaScriptConfirm(uint64_t frameID, const WebCore::SecurityOriginData&, const String&, Ref<Messages::WebPageProxy::RunJavaScriptConfirm::DelayedReply>&&);
- void runJavaScriptPrompt(uint64_t frameID, const WebCore::SecurityOriginData&, const String&, const String&, RefPtr<Messages::WebPageProxy::RunJavaScriptPrompt::DelayedReply>);
+ void runJavaScriptPrompt(uint64_t frameID, const WebCore::SecurityOriginData&, const String&, const String&, Ref<Messages::WebPageProxy::RunJavaScriptPrompt::DelayedReply>&&);
void setStatusText(const String&);
void mouseDidMoveOverElement(WebHitTestResultData&&, uint32_t modifiers, UserData&&);
@@ -1310,13 +1311,13 @@
void setToolbarsAreVisible(bool toolbarsAreVisible);
void getToolbarsAreVisible(Ref<Messages::WebPageProxy::GetToolbarsAreVisible::DelayedReply>&&);
void setMenuBarIsVisible(bool menuBarIsVisible);
- void getMenuBarIsVisible(bool& menuBarIsVisible);
+ void getMenuBarIsVisible(Ref<Messages::WebPageProxy::GetMenuBarIsVisible::DelayedReply>&&);
void setStatusBarIsVisible(bool statusBarIsVisible);
- void getStatusBarIsVisible(bool& statusBarIsVisible);
+ void getStatusBarIsVisible(Ref<Messages::WebPageProxy::GetStatusBarIsVisible::DelayedReply>&&);
void setIsResizable(bool isResizable);
- void getIsResizable(bool& isResizable);
- void screenToRootView(const WebCore::IntPoint& screenPoint, WebCore::IntPoint& windowPoint);
- void rootViewToScreen(const WebCore::IntRect& viewRect, WebCore::IntRect& result);
+ void getIsResizable(Ref<Messages::WebPageProxy::GetIsResizable::DelayedReply>&&);
+ void screenToRootView(const WebCore::IntPoint& screenPoint, Ref<Messages::WebPageProxy::ScreenToRootView::DelayedReply>&&);
+ void rootViewToScreen(const WebCore::IntRect& viewRect, Ref<Messages::WebPageProxy::RootViewToScreen::DelayedReply>&&);
#if PLATFORM(IOS)
void accessibilityScreenToRootView(const WebCore::IntPoint& screenPoint, WebCore::IntPoint& windowPoint);
void rootViewToAccessibilityScreen(const WebCore::IntRect& viewRect, WebCore::IntRect& result);
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (221886 => 221887)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2017-09-11 22:43:30 UTC (rev 221886)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in 2017-09-11 22:51:18 UTC (rev 221887)
@@ -52,16 +52,16 @@
SetRenderTreeSize(uint64_t treeSize)
SetToolbarsAreVisible(bool toolbarsAreVisible)
GetToolbarsAreVisible() -> (bool toolbarsAreVisible) Delayed
- SetMenuBarIsVisible(bool menuBarIsVisible);
- GetMenuBarIsVisible() -> (bool menuBarIsVisible);
+ SetMenuBarIsVisible(bool menuBarIsVisible)
+ GetMenuBarIsVisible() -> (bool menuBarIsVisible) Delayed
SetStatusBarIsVisible(bool statusBarIsVisible)
- GetStatusBarIsVisible() -> (bool statusBarIsVisible)
+ GetStatusBarIsVisible() -> (bool statusBarIsVisible) Delayed
SetIsResizable(bool isResizable)
- GetIsResizable() -> (bool isResizable)
+ GetIsResizable() -> (bool isResizable) Delayed
SetWindowFrame(WebCore::FloatRect windowFrame)
- GetWindowFrame() -> (WebCore::FloatRect windowFrame)
- ScreenToRootView(WebCore::IntPoint screenPoint) -> (WebCore::IntPoint windowPoint)
- RootViewToScreen(WebCore::IntRect rect) -> (WebCore::IntRect screenFrame)
+ GetWindowFrame() -> (WebCore::FloatRect windowFrame) Delayed
+ ScreenToRootView(WebCore::IntPoint screenPoint) -> (WebCore::IntPoint windowPoint) Delayed
+ RootViewToScreen(WebCore::IntRect rect) -> (WebCore::IntRect screenFrame) Delayed
#if PLATFORM(COCOA)
ShowValidationMessage(WebCore::IntRect anchorRect, String message)
Modified: trunk/Source/WebKit/UIProcess/mac/WKPrintingView.h (221886 => 221887)
--- trunk/Source/WebKit/UIProcess/mac/WKPrintingView.h 2017-09-11 22:43:30 UTC (rev 221886)
+++ trunk/Source/WebKit/UIProcess/mac/WKPrintingView.h 2017-09-11 22:51:18 UTC (rev 221887)
@@ -68,7 +68,7 @@
NSTimer *_autodisplayResumeTimer;
}
-- (id)initWithFrameProxy:(WebKit::WebFrameProxy*)frame view:(NSView *)wkView;
+- (id)initWithFrameProxy:(WebKit::WebFrameProxy&)frame view:(NSView *)wkView;
@end
Modified: trunk/Source/WebKit/UIProcess/mac/WKPrintingView.mm (221886 => 221887)
--- trunk/Source/WebKit/UIProcess/mac/WKPrintingView.mm 2017-09-11 22:43:30 UTC (rev 221886)
+++ trunk/Source/WebKit/UIProcess/mac/WKPrintingView.mm 2017-09-11 22:51:18 UTC (rev 221887)
@@ -51,13 +51,13 @@
@implementation WKPrintingView
-- (id)initWithFrameProxy:(WebKit::WebFrameProxy*)frame view:(NSView *)wkView
+- (id)initWithFrameProxy:(WebKit::WebFrameProxy&)frame view:(NSView *)wkView
{
self = [super init]; // No frame rect to pass to NSView.
if (!self)
return nil;
- _webFrame = frame;
+ _webFrame = &frame;
_wkView = wkView;
return self;
@@ -151,8 +151,8 @@
}
CGFloat scale = [info scalingFactor];
- [info setTopMargin:originalTopMargin + _webFrame->page()->headerHeight(_webFrame.get()) * scale];
- [info setBottomMargin:originalBottomMargin + _webFrame->page()->footerHeight(_webFrame.get()) * scale];
+ [info setTopMargin:originalTopMargin + _webFrame->page()->headerHeight(*_webFrame) * scale];
+ [info setBottomMargin:originalBottomMargin + _webFrame->page()->footerHeight(*_webFrame) * scale];
}
- (BOOL)_isPrintingPreview
@@ -637,18 +637,18 @@
NSSize paperSize = [printInfo paperSize];
CGFloat headerFooterLeft = [printInfo leftMargin] / scale;
CGFloat headerFooterWidth = (paperSize.width - ([printInfo leftMargin] + [printInfo rightMargin])) / scale;
- NSRect footerRect = NSMakeRect(headerFooterLeft, [printInfo bottomMargin] / scale - _webFrame->page()->footerHeight(_webFrame.get()), headerFooterWidth, _webFrame->page()->footerHeight(_webFrame.get()));
- NSRect headerRect = NSMakeRect(headerFooterLeft, (paperSize.height - [printInfo topMargin]) / scale, headerFooterWidth, _webFrame->page()->headerHeight(_webFrame.get()));
+ NSRect footerRect = NSMakeRect(headerFooterLeft, [printInfo bottomMargin] / scale - _webFrame->page()->footerHeight(*_webFrame), headerFooterWidth, _webFrame->page()->footerHeight(*_webFrame));
+ NSRect headerRect = NSMakeRect(headerFooterLeft, (paperSize.height - [printInfo topMargin]) / scale, headerFooterWidth, _webFrame->page()->headerHeight(*_webFrame));
NSGraphicsContext *currentContext = [NSGraphicsContext currentContext];
[currentContext saveGraphicsState];
NSRectClip(headerRect);
- _webFrame->page()->drawHeader(_webFrame.get(), headerRect);
+ _webFrame->page()->drawHeader(*_webFrame, headerRect);
[currentContext restoreGraphicsState];
[currentContext saveGraphicsState];
NSRectClip(footerRect);
- _webFrame->page()->drawFooter(_webFrame.get(), footerRect);
+ _webFrame->page()->drawFooter(*_webFrame, footerRect);
[currentContext restoreGraphicsState];
}
Modified: trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm (221886 => 221887)
--- trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm 2017-09-11 22:43:30 UTC (rev 221886)
+++ trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm 2017-09-11 22:51:18 UTC (rev 221887)
@@ -136,10 +136,10 @@
return;
// In case the UI client overrides getWindowFrame(), we call it here to make sure we send the appropriate window frame.
- FloatRect windowFrameInScreenCoordinates = m_uiClient->windowFrame(this);
- FloatRect windowFrameInUnflippedScreenCoordinates = m_pageClient.convertToUserSpace(windowFrameInScreenCoordinates);
-
- process().send(Messages::WebPage::WindowAndViewFramesChanged(windowFrameInScreenCoordinates, windowFrameInUnflippedScreenCoordinates, viewFrameInWindowCoordinates, accessibilityViewCoordinates), m_pageID);
+ m_uiClient->windowFrame(*this, [this, protectedThis = makeRef(*this), viewFrameInWindowCoordinates, accessibilityViewCoordinates] (FloatRect windowFrameInScreenCoordinates) {
+ FloatRect windowFrameInUnflippedScreenCoordinates = m_pageClient.convertToUserSpace(windowFrameInScreenCoordinates);
+ process().send(Messages::WebPage::WindowAndViewFramesChanged(windowFrameInScreenCoordinates, windowFrameInUnflippedScreenCoordinates, viewFrameInWindowCoordinates, accessibilityViewCoordinates), m_pageID);
+ });
}
void WebPageProxy::setMainFrameIsScrollable(bool isScrollable)