Changeset 221887 in webkit
- Timestamp:
- Sep 11, 2017 3:51:18 PM (7 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r221874 r221887 1 2017-09-11 Alex Christensen <achristensen@webkit.org> 2 3 Modernize and make API::UIClient more asynchronous 4 https://bugs.webkit.org/show_bug.cgi?id=176583 5 6 Reviewed by Brian Burg. 7 8 API::UIClient calls that return values synchronously require synchronous APIs unnecessarily. 9 Having them call completion handlers with the results instead allows us to make asynchronous 10 APIs, and existing synchronous APIs can just call the completion handlers immediately. 11 12 Unfortunately an assumption that API::UIClient::windowFrame returns synchronously had worked 13 its way into the WebAutomationSession, which calls WebPageProxy::getWindowFrame. Making it 14 asynchronous required making some automation protocols asynchronous so they can send their 15 result once they have the resulting frames from the UIClient. 16 17 No change in behaviour. 18 19 * UIProcess/API/APIUIClient.h: 20 (API::UIClient::setToolbarsAreVisible): 21 (API::UIClient::menuBarIsVisible): 22 (API::UIClient::setMenuBarIsVisible): 23 (API::UIClient::statusBarIsVisible): 24 (API::UIClient::setStatusBarIsVisible): 25 (API::UIClient::isResizable): 26 (API::UIClient::setIsResizable): 27 (API::UIClient::setWindowFrame): 28 (API::UIClient::windowFrame): 29 (API::UIClient::headerHeight): 30 (API::UIClient::footerHeight): 31 (API::UIClient::drawHeader): 32 (API::UIClient::drawFooter): 33 (API::UIClient::printFrame): 34 * UIProcess/API/C/WKPage.cpp: 35 (WKPageSetPageUIClient): 36 * UIProcess/Automation/Automation.json: 37 * UIProcess/Automation/WebAutomationSession.cpp: 38 (WebKit::WebAutomationSession::buildBrowsingContextForPage): 39 (WebKit::WebAutomationSession::getNextContext): 40 (WebKit::WebAutomationSession::getBrowsingContexts): 41 (WebKit::WebAutomationSession::getBrowsingContext): 42 (WebKit::WebAutomationSession::resizeWindowOfBrowsingContext): 43 (WebKit::WebAutomationSession::moveWindowOfBrowsingContext): 44 (WebKit::WebAutomationSession::performMouseInteraction): 45 * UIProcess/Automation/WebAutomationSession.h: 46 * UIProcess/Cocoa/UIDelegate.h: 47 * UIProcess/Cocoa/UIDelegate.mm: 48 (WebKit::UIDelegate::UIClient::printFrame): 49 * UIProcess/Cocoa/WebViewImpl.mm: 50 (WebKit::WebViewImpl::printOperationWithPrintInfo): 51 * UIProcess/WebPageProxy.cpp: 52 (WebKit::WebPageProxy::runJavaScriptPrompt): 53 (WebKit::WebPageProxy::setToolbarsAreVisible): 54 (WebKit::WebPageProxy::setMenuBarIsVisible): 55 (WebKit::WebPageProxy::getMenuBarIsVisible): 56 (WebKit::WebPageProxy::setStatusBarIsVisible): 57 (WebKit::WebPageProxy::getStatusBarIsVisible): 58 (WebKit::WebPageProxy::setIsResizable): 59 (WebKit::WebPageProxy::getIsResizable): 60 (WebKit::WebPageProxy::setWindowFrame): 61 (WebKit::WebPageProxy::getWindowFrame): 62 (WebKit::WebPageProxy::getWindowFrameWithCompletionHandler): 63 (WebKit::WebPageProxy::screenToRootView): 64 (WebKit::WebPageProxy::rootViewToScreen): 65 (WebKit::WebPageProxy::printFrame): 66 (WebKit::WebPageProxy::headerHeight): 67 (WebKit::WebPageProxy::footerHeight): 68 (WebKit::WebPageProxy::drawHeader): 69 (WebKit::WebPageProxy::drawFooter): 70 * UIProcess/WebPageProxy.h: 71 * UIProcess/WebPageProxy.messages.in: 72 * UIProcess/mac/WKPrintingView.h: 73 * UIProcess/mac/WKPrintingView.mm: 74 (-[WKPrintingView initWithFrameProxy:view:]): 75 (-[WKPrintingView _adjustPrintingMarginsForHeaderAndFooter]): 76 (-[WKPrintingView drawPageBorderWithSize:]): 77 * UIProcess/mac/WebPageProxyMac.mm: 78 (WebKit::WebPageProxy::windowAndViewFramesChanged): 79 1 80 2017-09-11 Stephan Szabo <stephan.szabo@sony.com> 2 81 -
trunk/Source/WebKit/UIProcess/API/APIUIClient.h
r221873 r221887 100 100 101 101 virtual void toolbarsAreVisible(WebKit::WebPageProxy&, Function<void(bool)>&& completionHandler) { completionHandler(true); } 102 virtual void setToolbarsAreVisible(WebKit::WebPageProxy *, bool) { }103 virtual bool menuBarIsVisible(WebKit::WebPageProxy*) { return true; }104 virtual void setMenuBarIsVisible(WebKit::WebPageProxy *, bool) { }105 virtual bool statusBarIsVisible(WebKit::WebPageProxy*) { return true; }106 virtual void setStatusBarIsVisible(WebKit::WebPageProxy *, bool) { }107 virtual bool isResizable(WebKit::WebPageProxy*) { return true; }108 virtual void setIsResizable(WebKit::WebPageProxy *, bool) { }102 virtual void setToolbarsAreVisible(WebKit::WebPageProxy&, bool) { } 103 virtual void menuBarIsVisible(WebKit::WebPageProxy&, Function<void(bool)>&& completionHandler) { completionHandler(true); } 104 virtual void setMenuBarIsVisible(WebKit::WebPageProxy&, bool) { } 105 virtual void statusBarIsVisible(WebKit::WebPageProxy&, Function<void(bool)>&& completionHandler) { completionHandler(true); } 106 virtual void setStatusBarIsVisible(WebKit::WebPageProxy&, bool) { } 107 virtual void isResizable(WebKit::WebPageProxy&, Function<void(bool)>&& completionHandler) { completionHandler(true); } 108 virtual void setIsResizable(WebKit::WebPageProxy&, bool) { } 109 109 110 virtual void setWindowFrame(WebKit::WebPageProxy *, const WebCore::FloatRect&) { }111 virtual WebCore::FloatRect windowFrame(WebKit::WebPageProxy*) { return WebCore::FloatRect(); }110 virtual void setWindowFrame(WebKit::WebPageProxy&, const WebCore::FloatRect&) { } 111 virtual void windowFrame(WebKit::WebPageProxy&, Function<void(WebCore::FloatRect)>&& completionHandler) { completionHandler({ }); } 112 112 113 113 virtual bool canRunBeforeUnloadConfirmPanel() const { return false; } … … 133 133 134 134 // Printing. 135 virtual float headerHeight(WebKit::WebPageProxy *, WebKit::WebFrameProxy*) { return 0; }136 virtual float footerHeight(WebKit::WebPageProxy *, WebKit::WebFrameProxy*) { return 0; }137 virtual void drawHeader(WebKit::WebPageProxy *, WebKit::WebFrameProxy*, const WebCore::FloatRect&) { }138 virtual void drawFooter(WebKit::WebPageProxy *, WebKit::WebFrameProxy*, const WebCore::FloatRect&) { }139 virtual void printFrame(WebKit::WebPageProxy *, WebKit::WebFrameProxy*) { }135 virtual float headerHeight(WebKit::WebPageProxy&, WebKit::WebFrameProxy&) { return 0; } 136 virtual float footerHeight(WebKit::WebPageProxy&, WebKit::WebFrameProxy&) { return 0; } 137 virtual void drawHeader(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, WebCore::FloatRect&&) { } 138 virtual void drawFooter(WebKit::WebPageProxy&, WebKit::WebFrameProxy&, WebCore::FloatRect&&) { } 139 virtual void printFrame(WebKit::WebPageProxy&, WebKit::WebFrameProxy&) { } 140 140 141 141 virtual bool canRunModal() const { return false; } -
trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp
r221873 r221887 1840 1840 } 1841 1841 1842 void setToolbarsAreVisible(WebPageProxy *page, bool visible) final1842 void setToolbarsAreVisible(WebPageProxy& page, bool visible) final 1843 1843 { 1844 1844 if (!m_client.setToolbarsAreVisible) 1845 1845 return; 1846 m_client.setToolbarsAreVisible(toAPI( page), visible, m_client.base.clientInfo);1847 } 1848 1849 bool menuBarIsVisible(WebPageProxy* page) final1846 m_client.setToolbarsAreVisible(toAPI(&page), visible, m_client.base.clientInfo); 1847 } 1848 1849 void menuBarIsVisible(WebPageProxy& page, Function<void(bool)>&& completionHandler) final 1850 1850 { 1851 1851 if (!m_client.menuBarIsVisible) 1852 return true;1853 return m_client.menuBarIsVisible(toAPI(page), m_client.base.clientInfo);1854 } 1855 1856 void setMenuBarIsVisible(WebPageProxy *page, bool visible) final1852 return completionHandler(true); 1853 completionHandler(m_client.menuBarIsVisible(toAPI(&page), m_client.base.clientInfo)); 1854 } 1855 1856 void setMenuBarIsVisible(WebPageProxy& page, bool visible) final 1857 1857 { 1858 1858 if (!m_client.setMenuBarIsVisible) 1859 1859 return; 1860 m_client.setMenuBarIsVisible(toAPI( page), visible, m_client.base.clientInfo);1861 } 1862 1863 bool statusBarIsVisible(WebPageProxy* page) final1860 m_client.setMenuBarIsVisible(toAPI(&page), visible, m_client.base.clientInfo); 1861 } 1862 1863 void statusBarIsVisible(WebPageProxy& page, Function<void(bool)>&& completionHandler) final 1864 1864 { 1865 1865 if (!m_client.statusBarIsVisible) 1866 return true;1867 return m_client.statusBarIsVisible(toAPI(page), m_client.base.clientInfo);1868 } 1869 1870 void setStatusBarIsVisible(WebPageProxy *page, bool visible) final1866 return completionHandler(true); 1867 completionHandler(m_client.statusBarIsVisible(toAPI(&page), m_client.base.clientInfo)); 1868 } 1869 1870 void setStatusBarIsVisible(WebPageProxy& page, bool visible) final 1871 1871 { 1872 1872 if (!m_client.setStatusBarIsVisible) 1873 1873 return; 1874 m_client.setStatusBarIsVisible(toAPI( page), visible, m_client.base.clientInfo);1875 } 1876 1877 bool isResizable(WebPageProxy* page) final1874 m_client.setStatusBarIsVisible(toAPI(&page), visible, m_client.base.clientInfo); 1875 } 1876 1877 void isResizable(WebPageProxy& page, Function<void(bool)>&& completionHandler) final 1878 1878 { 1879 1879 if (!m_client.isResizable) 1880 return true;1881 return m_client.isResizable(toAPI(page), m_client.base.clientInfo);1882 } 1883 1884 void setIsResizable(WebPageProxy *page, bool resizable) final1880 return completionHandler(true); 1881 completionHandler(m_client.isResizable(toAPI(&page), m_client.base.clientInfo)); 1882 } 1883 1884 void setIsResizable(WebPageProxy& page, bool resizable) final 1885 1885 { 1886 1886 if (!m_client.setIsResizable) 1887 1887 return; 1888 m_client.setIsResizable(toAPI( page), resizable, m_client.base.clientInfo);1889 } 1890 1891 void setWindowFrame(WebPageProxy *page, const FloatRect& frame) final1888 m_client.setIsResizable(toAPI(&page), resizable, m_client.base.clientInfo); 1889 } 1890 1891 void setWindowFrame(WebPageProxy& page, const FloatRect& frame) final 1892 1892 { 1893 1893 if (!m_client.setWindowFrame) 1894 1894 return; 1895 1895 1896 m_client.setWindowFrame(toAPI( page), toAPI(frame), m_client.base.clientInfo);1897 } 1898 1899 FloatRect windowFrame(WebPageProxy* page) final1896 m_client.setWindowFrame(toAPI(&page), toAPI(frame), m_client.base.clientInfo); 1897 } 1898 1899 void windowFrame(WebPageProxy& page, Function<void(WebCore::FloatRect)>&& completionHandler) final 1900 1900 { 1901 1901 if (!m_client.getWindowFrame) 1902 return FloatRect();1903 1904 return toFloatRect(m_client.getWindowFrame(toAPI(page), m_client.base.clientInfo));1902 return completionHandler({ }); 1903 1904 completionHandler(toFloatRect(m_client.getWindowFrame(toAPI(&page), m_client.base.clientInfo))); 1905 1905 } 1906 1906 … … 1990 1990 1991 1991 // Printing. 1992 float headerHeight(WebPageProxy * page, WebFrameProxy*frame) final1992 float headerHeight(WebPageProxy& page, WebFrameProxy& frame) final 1993 1993 { 1994 1994 if (!m_client.headerHeight) 1995 1995 return 0; 1996 1996 1997 return m_client.headerHeight(toAPI( page), toAPI(frame), m_client.base.clientInfo);1998 } 1999 2000 float footerHeight(WebPageProxy * page, WebFrameProxy*frame) final1997 return m_client.headerHeight(toAPI(&page), toAPI(&frame), m_client.base.clientInfo); 1998 } 1999 2000 float footerHeight(WebPageProxy& page, WebFrameProxy& frame) final 2001 2001 { 2002 2002 if (!m_client.footerHeight) 2003 2003 return 0; 2004 2004 2005 return m_client.footerHeight(toAPI( page), toAPI(frame), m_client.base.clientInfo);2006 } 2007 2008 void drawHeader(WebPageProxy * page, WebFrameProxy* frame, const WebCore::FloatRect& rect) final2005 return m_client.footerHeight(toAPI(&page), toAPI(&frame), m_client.base.clientInfo); 2006 } 2007 2008 void drawHeader(WebPageProxy& page, WebFrameProxy& frame, WebCore::FloatRect&& rect) final 2009 2009 { 2010 2010 if (!m_client.drawHeader) 2011 2011 return; 2012 2012 2013 m_client.drawHeader(toAPI( page), toAPI(frame), toAPI(rect), m_client.base.clientInfo);2014 } 2015 2016 void drawFooter(WebPageProxy * page, WebFrameProxy* frame, const WebCore::FloatRect& rect) final2013 m_client.drawHeader(toAPI(&page), toAPI(&frame), toAPI(rect), m_client.base.clientInfo); 2014 } 2015 2016 void drawFooter(WebPageProxy& page, WebFrameProxy& frame, WebCore::FloatRect&& rect) final 2017 2017 { 2018 2018 if (!m_client.drawFooter) 2019 2019 return; 2020 2020 2021 m_client.drawFooter(toAPI( page), toAPI(frame), toAPI(rect), m_client.base.clientInfo);2022 } 2023 2024 void printFrame(WebPageProxy * page, WebFrameProxy*frame) final2021 m_client.drawFooter(toAPI(&page), toAPI(&frame), toAPI(rect), m_client.base.clientInfo); 2022 } 2023 2024 void printFrame(WebPageProxy& page, WebFrameProxy& frame) final 2025 2025 { 2026 2026 if (!m_client.printFrame) 2027 2027 return; 2028 2028 2029 m_client.printFrame(toAPI( page), toAPI(frame), m_client.base.clientInfo);2029 m_client.printFrame(toAPI(&page), toAPI(&frame), m_client.base.clientInfo); 2030 2030 } 2031 2031 -
trunk/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp
r221873 r221887 54 54 } 55 55 56 void showPage(WebPageProxy*) override56 void showPage(WebPageProxy*) final 57 57 { 58 58 webkitWebViewReadyToShowPage(m_webView); 59 59 } 60 60 61 void close(WebPageProxy*) override61 void close(WebPageProxy*) final 62 62 { 63 63 webkitWebViewClosePage(m_webView); 64 64 } 65 65 66 void runJavaScriptAlert(WebPageProxy*, const String& message, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void ()>&& completionHandler) override66 void runJavaScriptAlert(WebPageProxy*, const String& message, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void()>&& completionHandler) final 67 67 { 68 68 webkitWebViewRunJavaScriptAlert(m_webView, message.utf8()); … … 70 70 } 71 71 72 void runJavaScriptConfirm(WebPageProxy*, const String& message, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void (bool)>&& completionHandler) override72 void runJavaScriptConfirm(WebPageProxy*, const String& message, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void(bool)>&& completionHandler) final 73 73 { 74 74 completionHandler(webkitWebViewRunJavaScriptConfirm(m_webView, message.utf8())); 75 75 } 76 76 77 void runJavaScriptPrompt(WebPageProxy*, const String& message, const String& defaultValue, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void (const String&)>&& completionHandler) override77 void runJavaScriptPrompt(WebPageProxy*, const String& message, const String& defaultValue, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void(const String&)>&& completionHandler) final 78 78 { 79 79 CString result = webkitWebViewRunJavaScriptPrompt(m_webView, message.utf8(), defaultValue.utf8()); … … 86 86 } 87 87 88 bool canRunBeforeUnloadConfirmPanel() const override{ return true; }89 90 void runBeforeUnloadConfirmPanel(WebPageProxy*, const String& message, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void (bool)>&& completionHandler) override88 bool canRunBeforeUnloadConfirmPanel() const final { return true; } 89 90 void runBeforeUnloadConfirmPanel(WebPageProxy*, const String& message, WebFrameProxy*, const WebCore::SecurityOriginData&, Function<void(bool)>&& completionHandler) final 91 91 { 92 92 completionHandler(webkitWebViewRunJavaScriptBeforeUnloadConfirm(m_webView, message.utf8())); … … 98 98 } 99 99 100 void toolbarsAreVisible(WebPageProxy&, Function<void(bool)>&& completionHandler) override100 void toolbarsAreVisible(WebPageProxy&, Function<void(bool)>&& completionHandler) final 101 101 { 102 102 completionHandler(webkit_window_properties_get_toolbar_visible(webkit_web_view_get_window_properties(m_webView))); 103 103 } 104 104 105 void setToolbarsAreVisible(WebPageProxy *, bool visible) override105 void setToolbarsAreVisible(WebPageProxy&, bool visible) final 106 106 { 107 107 webkitWindowPropertiesSetToolbarVisible(webkit_web_view_get_window_properties(m_webView), visible); 108 108 } 109 109 110 bool menuBarIsVisible(WebPageProxy*) override111 { 112 return webkit_window_properties_get_menubar_visible(webkit_web_view_get_window_properties(m_webView));113 } 114 115 void setMenuBarIsVisible(WebPageProxy *, bool visible) override110 void menuBarIsVisible(WebPageProxy&, Function<void(bool)>&& completionHandler) final 111 { 112 completionHandler(webkit_window_properties_get_menubar_visible(webkit_web_view_get_window_properties(m_webView))); 113 } 114 115 void setMenuBarIsVisible(WebPageProxy&, bool visible) final 116 116 { 117 117 webkitWindowPropertiesSetToolbarVisible(webkit_web_view_get_window_properties(m_webView), visible); 118 118 } 119 119 120 bool statusBarIsVisible(WebPageProxy*) override121 { 122 return webkit_window_properties_get_statusbar_visible(webkit_web_view_get_window_properties(m_webView));123 } 124 125 void setStatusBarIsVisible(WebPageProxy *, bool visible) override120 void statusBarIsVisible(WebPageProxy&, Function<void(bool)>&& completionHandler) final 121 { 122 completionHandler(webkit_window_properties_get_statusbar_visible(webkit_web_view_get_window_properties(m_webView))); 123 } 124 125 void setStatusBarIsVisible(WebPageProxy&, bool visible) final 126 126 { 127 127 webkitWindowPropertiesSetStatusbarVisible(webkit_web_view_get_window_properties(m_webView), visible); 128 128 } 129 129 130 bool isResizable(WebPageProxy*) override131 { 132 return webkit_window_properties_get_resizable(webkit_web_view_get_window_properties(m_webView));133 } 134 135 void setIsResizable(WebPageProxy *, bool resizable) override130 void isResizable(WebPageProxy&, Function<void(bool)>&& completionHandler) final 131 { 132 completionHandler(webkit_window_properties_get_resizable(webkit_web_view_get_window_properties(m_webView))); 133 } 134 135 void setIsResizable(WebPageProxy&, bool resizable) final 136 136 { 137 137 webkitWindowPropertiesSetResizable(webkit_web_view_get_window_properties(m_webView), resizable); 138 138 } 139 139 140 void setWindowFrame(WebPageProxy *, const WebCore::FloatRect& frame) override140 void setWindowFrame(WebPageProxy&, const WebCore::FloatRect& frame) final 141 141 { 142 142 #if PLATFORM(GTK) … … 153 153 } 154 154 155 WebCore::FloatRect windowFrame(WebPageProxy*) override155 void windowFrame(WebPageProxy&, Function<void(WebCore::FloatRect)>&& completionHandler) final 156 156 { 157 157 #if PLATFORM(GTK) … … 162 162 gtk_window_get_size(GTK_WINDOW(window), &geometry.width, &geometry.height); 163 163 } 164 return WebCore::FloatRect(geometry);164 completionHandler(WebCore::FloatRect(geometry)); 165 165 #elif PLATFORM(WPE) 166 166 // FIXME: I guess this is actually the view size in WPE. We need more refactoring here. 167 return { };168 #endif 169 } 170 171 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) override167 completionHandler({ }); 168 #endif 169 } 170 171 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 172 172 { 173 173 static const unsigned long long defaultQuota = 5 * 1024 * 1204; // 5 MB … … 176 176 } 177 177 178 bool runOpenPanel(WebPageProxy*, WebFrameProxy*, const WebCore::SecurityOriginData&, API::OpenPanelParameters* parameters, WebOpenPanelResultListenerProxy* listener) override178 bool runOpenPanel(WebPageProxy*, WebFrameProxy*, const WebCore::SecurityOriginData&, API::OpenPanelParameters* parameters, WebOpenPanelResultListenerProxy* listener) final 179 179 { 180 180 GRefPtr<WebKitFileChooserRequest> request = adoptGRef(webkitFileChooserRequestCreate(parameters, listener)); … … 189 189 } 190 190 191 bool decidePolicyForUserMediaPermissionRequest(WebPageProxy&, WebFrameProxy&, API::SecurityOrigin& userMediaDocumentOrigin, API::SecurityOrigin& topLevelDocumentOrigin, UserMediaPermissionRequestProxy& permissionRequest) override191 bool decidePolicyForUserMediaPermissionRequest(WebPageProxy&, WebFrameProxy&, API::SecurityOrigin& userMediaDocumentOrigin, API::SecurityOrigin& topLevelDocumentOrigin, UserMediaPermissionRequestProxy& permissionRequest) final 192 192 { 193 193 GRefPtr<WebKitUserMediaPermissionRequest> userMediaPermissionRequest = adoptGRef(webkitUserMediaPermissionRequestCreate(permissionRequest, userMediaDocumentOrigin, topLevelDocumentOrigin)); … … 196 196 } 197 197 198 bool decidePolicyForNotificationPermissionRequest(WebPageProxy*, API::SecurityOrigin*, NotificationPermissionRequest* permissionRequest) override198 bool decidePolicyForNotificationPermissionRequest(WebPageProxy*, API::SecurityOrigin*, NotificationPermissionRequest* permissionRequest) final 199 199 { 200 200 GRefPtr<WebKitNotificationPermissionRequest> notificationPermissionRequest = adoptGRef(webkitNotificationPermissionRequestCreate(permissionRequest)); … … 204 204 205 205 #if PLATFORM(GTK) 206 void printFrame(WebPageProxy *, WebFrameProxy* frame) override207 { 208 webkitWebViewPrintFrame(m_webView, frame);209 } 210 #endif 211 212 bool canRunModal() const override{ return true; }213 214 void runModal(WebPageProxy*) override206 void printFrame(WebPageProxy&, WebFrameProxy& frame) final 207 { 208 webkitWebViewPrintFrame(m_webView, &frame); 209 } 210 #endif 211 212 bool canRunModal() const final { return true; } 213 214 void runModal(WebPageProxy*) final 215 215 { 216 216 webkitWebViewRunAsModal(m_webView); -
trunk/Source/WebKit/UIProcess/Automation/Automation.json
r221255 r221887 226 226 "returns": [ 227 227 { "name": "contexts", "type": "array", "items": { "$ref": "BrowsingContext" }, "description": "All known browsing contexts available to the session." } 228 ] 228 ], 229 "async": true 229 230 }, 230 231 { … … 236 237 "returns": [ 237 238 { "name": "context", "$ref": "BrowsingContext", "description": "The browsing context available to the session." } 238 ] 239 ], 240 "async": true 239 241 }, 240 242 { … … 266 268 { "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context to be resized." }, 267 269 { "name": "size", "$ref": "Size", "description": "The new size for the browsing context's window." } 268 ] 270 ], 271 "async": true 269 272 }, 270 273 { … … 274 277 { "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context to be moved." }, 275 278 { "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." } 276 ] 279 ], 280 "async": true 277 281 }, 278 282 { … … 366 370 "returns": [ 367 371 { "name": "position", "$ref": "Point", "description": "The updated position of the mouse cursor, specified in viewport coordinates." } 368 ] 372 ], 373 "async": true 369 374 }, 370 375 { -
trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp
r221255 r221887 208 208 } 209 209 210 RefPtr<Inspector::Protocol::Automation::BrowsingContext> WebAutomationSession::buildBrowsingContextForPage(WebPageProxy& page) 211 { 212 WebCore::FloatRect windowFrame; 213 page.getWindowFrame(windowFrame); 214 210 Ref<Inspector::Protocol::Automation::BrowsingContext> WebAutomationSession::buildBrowsingContextForPage(WebPageProxy& page, WebCore::FloatRect windowFrame) 211 { 215 212 auto originObject = Inspector::Protocol::Automation::Point::create() 216 213 .setX(windowFrame.x()) … … 236 233 // Platform-independent Commands. 237 234 238 void WebAutomationSession::getBrowsingContexts(Inspector::ErrorString& errorString, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Automation::BrowsingContext>>& contexts) 239 { 240 contexts = Inspector::Protocol::Array<Inspector::Protocol::Automation::BrowsingContext>::create(); 241 235 void WebAutomationSession::getNextContext(Ref<WebAutomationSession>&& protectedThis, Vector<Ref<WebPageProxy>>&& pages, Ref<Inspector::Protocol::Array<Inspector::Protocol::Automation::BrowsingContext>> contexts, Ref<WebAutomationSession::GetBrowsingContextsCallback>&& callback) 236 { 237 if (pages.isEmpty()) { 238 callback->sendSuccess(WTFMove(contexts)); 239 return; 240 } 241 auto page = pages.takeLast(); 242 auto& webPageProxy = page.get(); 243 webPageProxy.getWindowFrameWithCallback([this, protectedThis = WTFMove(protectedThis), callback = WTFMove(callback), pages = WTFMove(pages), contexts = WTFMove(contexts), page = WTFMove(page)](WebCore::FloatRect windowFrame) mutable { 244 contexts->addItem(protectedThis->buildBrowsingContextForPage(page.get(), windowFrame)); 245 getNextContext(WTFMove(protectedThis), WTFMove(pages), WTFMove(contexts), WTFMove(callback)); 246 }); 247 } 248 249 void WebAutomationSession::getBrowsingContexts(Inspector::ErrorString& errorString, Ref<GetBrowsingContextsCallback>&& callback) 250 { 251 Vector<Ref<WebPageProxy>> pages; 242 252 for (auto& process : m_processPool->processes()) { 243 253 for (auto* page : process->pages()) { … … 245 255 if (!page->isControlledByAutomation()) 246 256 continue; 247 248 contexts->addItem(buildBrowsingContextForPage(*page)); 257 pages.append(*page); 249 258 } 250 259 } 251 } 252 253 void WebAutomationSession::getBrowsingContext(Inspector::ErrorString& errorString, const String& handle, RefPtr<Inspector::Protocol::Automation::BrowsingContext>& context) 260 261 getNextContext(makeRef(*this), WTFMove(pages), Inspector::Protocol::Array<Inspector::Protocol::Automation::BrowsingContext>::create(), WTFMove(callback)); 262 } 263 264 void WebAutomationSession::getBrowsingContext(Inspector::ErrorString& errorString, const String& handle, Ref<GetBrowsingContextCallback>&& callback) 254 265 { 255 266 WebPageProxy* page = webPageProxyForHandle(handle); … … 257 268 FAIL_WITH_PREDEFINED_ERROR(WindowNotFound); 258 269 259 context = buildBrowsingContextForPage(*page); 270 page->getWindowFrameWithCallback([protectedThis = makeRef(*this), page = makeRef(*page), callback = WTFMove(callback)](WebCore::FloatRect windowFrame) mutable { 271 callback->sendSuccess(protectedThis->buildBrowsingContextForPage(page.get(), windowFrame)); 272 }); 260 273 } 261 274 … … 302 315 } 303 316 304 void WebAutomationSession::resizeWindowOfBrowsingContext(Inspector::ErrorString& errorString, const String& handle, const Inspector::InspectorObject& sizeObject )317 void WebAutomationSession::resizeWindowOfBrowsingContext(Inspector::ErrorString& errorString, const String& handle, const Inspector::InspectorObject& sizeObject, Ref<ResizeWindowOfBrowsingContextCallback>&& callback) 305 318 { 306 319 #if PLATFORM(IOS) … … 325 338 FAIL_WITH_PREDEFINED_ERROR(WindowNotFound); 326 339 327 WebCore::FloatRect originalFrame; 328 page->getWindowFrame(originalFrame); 329 330 WebCore::FloatRect newFrame = WebCore::FloatRect(originalFrame.location(), WebCore::FloatSize(width, height)); 331 if (newFrame == originalFrame) 332 return; 333 334 page->setWindowFrame(newFrame); 335 336 #if !PLATFORM(GTK) 337 // If nothing changed at all, it's probably fair to report that something went wrong. 338 // (We can't assume that the requested frame size will be honored exactly, however.) 339 WebCore::FloatRect updatedFrame; 340 page->getWindowFrame(updatedFrame); 341 if (originalFrame == updatedFrame) 342 FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InternalError, "The window size was expected to have changed, but did not."); 340 page->getWindowFrameWithCallback([callback = WTFMove(callback), page = makeRef(*page), width, height](WebCore::FloatRect originalFrame) mutable { 341 WebCore::FloatRect newFrame = WebCore::FloatRect(originalFrame.location(), WebCore::FloatSize(width, height)); 342 if (newFrame == originalFrame) 343 return callback->sendSuccess(); 344 345 page->setWindowFrame(newFrame); 346 347 #if PLATFORM(GTK) 348 callback->sendSuccess(); 349 #else 350 // If nothing changed at all, it's probably fair to report that something went wrong. 351 // (We can't assume that the requested frame size will be honored exactly, however.) 352 page->getWindowFrameWithCallback([callback = WTFMove(callback), originalFrame](WebCore::FloatRect updatedFrame) { 353 if (originalFrame == updatedFrame) 354 callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_NAME_AND_DETAILS(InternalError, "The window size was expected to have changed, but did not.")); 355 else 356 callback->sendSuccess(); 357 }); 343 358 #endif 359 }); 344 360 #endif 345 361 } 346 362 347 void WebAutomationSession::moveWindowOfBrowsingContext(Inspector::ErrorString& errorString, const String& handle, const Inspector::InspectorObject& positionObject )363 void WebAutomationSession::moveWindowOfBrowsingContext(Inspector::ErrorString& errorString, const String& handle, const Inspector::InspectorObject& positionObject, Ref<MoveWindowOfBrowsingContextCallback>&& callback) 348 364 { 349 365 #if PLATFORM(IOS) … … 369 385 370 386 WebCore::FloatRect originalFrame; 371 page->getWindowFrame(originalFrame); 372 373 WebCore::FloatRect newFrame = WebCore::FloatRect(WebCore::FloatPoint(x, y), originalFrame.size()); 374 if (newFrame == originalFrame) 375 return; 376 377 page->setWindowFrame(newFrame); 378 379 #if !PLATFORM(GTK) 380 // If nothing changed at all, it's probably fair to report that something went wrong. 381 // (We can't assume that the requested frame size will be honored exactly, however.) 382 WebCore::FloatRect updatedFrame; 383 page->getWindowFrame(updatedFrame); 384 if (originalFrame == updatedFrame) 385 FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InternalError, "The window position was expected to have changed, but did not."); 387 page->getWindowFrameWithCallback([callback = WTFMove(callback), page = makeRef(*page), x, y](WebCore::FloatRect originalFrame) mutable { 388 389 WebCore::FloatRect newFrame = WebCore::FloatRect(WebCore::FloatPoint(x, y), originalFrame.size()); 390 if (newFrame == originalFrame) 391 return callback->sendSuccess(); 392 393 page->setWindowFrame(newFrame); 394 395 #if PLATFORM(GTK) 396 callback->sendSuccess(); 397 #else 398 // If nothing changed at all, it's probably fair to report that something went wrong. 399 // (We can't assume that the requested frame size will be honored exactly, however.) 400 page->getWindowFrameWithCallback([callback = WTFMove(callback), originalFrame](WebCore::FloatRect updatedFrame) { 401 if (originalFrame == updatedFrame) 402 callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_NAME_AND_DETAILS(InternalError, "The window position was expected to have changed, but did not.")); 403 else 404 callback->sendSuccess(); 405 }); 386 406 #endif 407 }); 387 408 #endif 388 409 } … … 1222 1243 #endif // USE(APPKIT) 1223 1244 1224 void WebAutomationSession::performMouseInteraction(Inspector::ErrorString& errorString, const String& handle, const Inspector::InspectorObject& requestedPositionObject, const String& mouseButtonString, const String& mouseInteractionString, const Inspector::InspectorArray& keyModifierStrings, Ref Ptr<Inspector::Protocol::Automation::Point>& updatedPositionObject)1245 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) 1225 1246 { 1226 1247 #if !USE(APPKIT) && !PLATFORM(GTK) … … 1238 1259 if (!requestedPositionObject.getDouble(WTF::ASCIILiteral("y"), y)) 1239 1260 FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(MissingParameter, "The parameter 'y' was not found."); 1240 1241 WebCore::FloatRect windowFrame;1242 page->getWindowFrame(windowFrame);1243 1244 x = std::min(std::max(0.0f, x), windowFrame.size().width());1245 y = std::min(std::max(0.0f, y + page->topContentInset()), windowFrame.size().height());1246 1247 WebCore::IntPoint viewPosition = WebCore::IntPoint(static_cast<int>(x), static_cast<int>(y));1248 1249 auto parsedInteraction = Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::MouseInteraction>(mouseInteractionString);1250 if (!parsedInteraction)1251 FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "The parameter 'interaction' is invalid.");1252 1253 auto parsedButton = Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::MouseButton>(mouseButtonString);1254 if (!parsedButton)1255 FAIL_WITH_PREDEFINED_ERROR_AND_DETAILS(InvalidParameter, "The parameter 'button' is invalid.");1256 1261 1257 1262 WebEvent::Modifiers keyModifiers = (WebEvent::Modifiers)0; … … 1267 1272 keyModifiers = (WebEvent::Modifiers)(enumValue | keyModifiers); 1268 1273 } 1269 1270 platformSimulateMouseInteraction(*page, viewPosition, parsedInteraction.value(), parsedButton.value(), keyModifiers); 1271 1272 updatedPositionObject = Inspector::Protocol::Automation::Point::create() 1273 .setX(x) 1274 .setY(y - page->topContentInset()) 1275 .release(); 1274 1275 page->getWindowFrameWithCallback([this, protectedThis = makeRef(*this), callback = WTFMove(callback), page = makeRef(*page), x, y, mouseInteractionString, mouseButtonString, keyModifiers](WebCore::FloatRect windowFrame) mutable { 1276 1277 x = std::min(std::max(0.0f, x), windowFrame.size().width()); 1278 y = std::min(std::max(0.0f, y + page->topContentInset()), windowFrame.size().height()); 1279 1280 WebCore::IntPoint viewPosition = WebCore::IntPoint(static_cast<int>(x), static_cast<int>(y)); 1281 1282 auto parsedInteraction = Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::MouseInteraction>(mouseInteractionString); 1283 if (!parsedInteraction) 1284 return callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_NAME_AND_DETAILS(InvalidParameter, "The parameter 'interaction' is invalid.")); 1285 1286 auto parsedButton = Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::MouseButton>(mouseButtonString); 1287 if (!parsedButton) 1288 return callback->sendFailure(STRING_FOR_PREDEFINED_ERROR_NAME_AND_DETAILS(InvalidParameter, "The parameter 'button' is invalid.")); 1289 1290 platformSimulateMouseInteraction(page, viewPosition, parsedInteraction.value(), parsedButton.value(), keyModifiers); 1291 1292 callback->sendSuccess(Inspector::Protocol::Automation::Point::create() 1293 .setX(x) 1294 .setY(y - page->topContentInset()) 1295 .release()); 1296 }); 1276 1297 #endif // USE(APPKIT) 1277 1298 } -
trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.h
r221255 r221887 116 116 117 117 // Platform: Generic 118 void getBrowsingContexts(Inspector::ErrorString&, Ref Ptr<Inspector::Protocol::Array<Inspector::Protocol::Automation::BrowsingContext>>&) override;119 void getBrowsingContext(Inspector::ErrorString&, const String&, Ref Ptr<Inspector::Protocol::Automation::BrowsingContext>&) override;118 void getBrowsingContexts(Inspector::ErrorString&, Ref<GetBrowsingContextsCallback>&&) final; 119 void getBrowsingContext(Inspector::ErrorString&, const String&, Ref<GetBrowsingContextCallback>&&) final; 120 120 void createBrowsingContext(Inspector::ErrorString&, String*) override; 121 121 void closeBrowsingContext(Inspector::ErrorString&, const String&) override; 122 122 void switchToBrowsingContext(Inspector::ErrorString&, const String& browsingContextHandle, const String* optionalFrameHandle) override; 123 void resizeWindowOfBrowsingContext(Inspector::ErrorString&, const String& handle, const Inspector::InspectorObject& size ) override;124 void moveWindowOfBrowsingContext(Inspector::ErrorString&, const String& handle, const Inspector::InspectorObject& position ) override;123 void resizeWindowOfBrowsingContext(Inspector::ErrorString&, const String& handle, const Inspector::InspectorObject& size, Ref<ResizeWindowOfBrowsingContextCallback>&&) final; 124 void moveWindowOfBrowsingContext(Inspector::ErrorString&, const String& handle, const Inspector::InspectorObject& position, Ref<MoveWindowOfBrowsingContextCallback>&&) final; 125 125 void navigateBrowsingContext(Inspector::ErrorString&, const String& handle, const String& url, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<NavigateBrowsingContextCallback>&&) override; 126 126 void goBackInBrowsingContext(Inspector::ErrorString&, const String&, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<GoBackInBrowsingContextCallback>&&) override; … … 129 129 void waitForNavigationToComplete(Inspector::ErrorString&, const String& browsingContextHandle, const String* optionalFrameHandle, const String* optionalPageLoadStrategyString, const int* optionalPageLoadTimeout, Ref<WaitForNavigationToCompleteCallback>&&) override; 130 130 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; 131 void performMouseInteraction(Inspector::ErrorString&, const String& handle, const Inspector::InspectorObject& requestedPosition, const String& mouseButton, const String& mouseInteraction, const Inspector::InspectorArray& keyModifiers, Ref Ptr<Inspector::Protocol::Automation::Point>& updatedPosition) override;131 void performMouseInteraction(Inspector::ErrorString&, const String& handle, const Inspector::InspectorObject& requestedPosition, const String& mouseButton, const String& mouseInteraction, const Inspector::InspectorArray& keyModifiers, Ref<PerformMouseInteractionCallback>&&) final; 132 132 void performKeyboardInteractions(Inspector::ErrorString&, const String& handle, const Inspector::InspectorArray& interactions, Ref<PerformKeyboardInteractionsCallback>&&) override; 133 133 void takeScreenshot(Inspector::ErrorString&, const String& handle, const String* optionalFrameHandle, const String* optionalNodeHandle, const bool* optionalScrollIntoViewIfNeeded, Ref<TakeScreenshotCallback>&&) override; … … 161 161 WebPageProxy* webPageProxyForHandle(const String&); 162 162 String handleForWebPageProxy(const WebPageProxy&); 163 RefPtr<Inspector::Protocol::Automation::BrowsingContext> buildBrowsingContextForPage(WebPageProxy&); 163 Ref<Inspector::Protocol::Automation::BrowsingContext> buildBrowsingContextForPage(WebPageProxy&, WebCore::FloatRect windowFrame); 164 void getNextContext(Ref<WebAutomationSession>&&, Vector<Ref<WebPageProxy>>&&, Ref<Inspector::Protocol::Array<Inspector::Protocol::Automation::BrowsingContext>>, Ref<WebAutomationSession::GetBrowsingContextsCallback>&&); 164 165 165 166 std::optional<uint64_t> webFrameIDForHandle(const String&); -
trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h
r221873 r221887 116 116 bool checkUserMediaPermissionForOrigin(WebPageProxy&, WebFrameProxy&, API::SecurityOrigin&, API::SecurityOrigin&, UserMediaPermissionCheckProxy&) final; 117 117 void mediaCaptureStateDidChange(WebCore::MediaProducer::MediaStateFlags) final; 118 void printFrame(WebPageProxy *, WebFrameProxy*) final;118 void printFrame(WebPageProxy&, WebFrameProxy&) final; 119 119 #if PLATFORM(IOS) 120 120 #if HAVE(APP_LINKS) -
trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm
r221873 r221887 852 852 } 853 853 854 void UIDelegate::UIClient::printFrame(WebPageProxy*, WebFrameProxy* webFrameProxy) 855 { 856 ASSERT_ARG(webFrameProxy, webFrameProxy); 857 854 void UIDelegate::UIClient::printFrame(WebPageProxy&, WebFrameProxy& webFrameProxy) 855 { 858 856 if (!m_uiDelegate.m_delegateMethods.webViewPrintFrame) 859 857 return; … … 863 861 return; 864 862 865 [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView printFrame:wrapper(API::FrameHandle::create(webFrameProxy ->frameID()))];863 [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView printFrame:wrapper(API::FrameHandle::create(webFrameProxy.frameID()))]; 866 864 } 867 865 -
trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
r221707 r221887 1629 1629 // FIXME: If the frame cannot be printed (e.g. if it contains an encrypted PDF that disallows 1630 1630 // printing), this function should return nil. 1631 RetainPtr<WKPrintingView> printingView = adoptNS([[WKPrintingView alloc] initWithFrameProxy: &frame view:m_view.getAutoreleased()]);1631 RetainPtr<WKPrintingView> printingView = adoptNS([[WKPrintingView alloc] initWithFrameProxy:frame view:m_view.getAutoreleased()]); 1632 1632 // NSPrintOperation takes ownership of the view. 1633 1633 NSPrintOperation *printOperation = [NSPrintOperation printOperationWithView:printingView.get() printInfo:printInfo]; -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r221873 r221887 3960 3960 } 3961 3961 3962 void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const SecurityOriginData& securityOrigin, const String& message, const String& defaultValue, Ref Ptr<Messages::WebPageProxy::RunJavaScriptPrompt::DelayedReply>reply)3962 void WebPageProxy::runJavaScriptPrompt(uint64_t frameID, const SecurityOriginData& securityOrigin, const String& message, const String& defaultValue, Ref<Messages::WebPageProxy::RunJavaScriptPrompt::DelayedReply>&& reply) 3963 3963 { 3964 3964 WebFrameProxy* frame = m_process->webFrame(frameID); … … 3973 3973 } 3974 3974 3975 m_uiClient->runJavaScriptPrompt(this, message, defaultValue, frame, securityOrigin, [reply](const String& result) { reply->send(result); }); 3975 m_uiClient->runJavaScriptPrompt(this, message, defaultValue, frame, securityOrigin, [reply = WTFMove(reply)](const String& result) { 3976 reply->send(result); 3977 }); 3976 3978 } 3977 3979 … … 4063 4065 void WebPageProxy::setToolbarsAreVisible(bool toolbarsAreVisible) 4064 4066 { 4065 m_uiClient->setToolbarsAreVisible( this, toolbarsAreVisible);4067 m_uiClient->setToolbarsAreVisible(*this, toolbarsAreVisible); 4066 4068 } 4067 4069 … … 4075 4077 void WebPageProxy::setMenuBarIsVisible(bool menuBarIsVisible) 4076 4078 { 4077 m_uiClient->setMenuBarIsVisible(this, menuBarIsVisible); 4078 } 4079 4080 void WebPageProxy::getMenuBarIsVisible(bool& menuBarIsVisible) 4081 { 4082 menuBarIsVisible = m_uiClient->menuBarIsVisible(this); 4079 m_uiClient->setMenuBarIsVisible(*this, menuBarIsVisible); 4080 } 4081 4082 void WebPageProxy::getMenuBarIsVisible(Ref<Messages::WebPageProxy::GetMenuBarIsVisible::DelayedReply>&& reply) 4083 { 4084 m_uiClient->menuBarIsVisible(*this, [reply = WTFMove(reply)] (bool visible) { 4085 reply->send(visible); 4086 }); 4083 4087 } 4084 4088 4085 4089 void WebPageProxy::setStatusBarIsVisible(bool statusBarIsVisible) 4086 4090 { 4087 m_uiClient->setStatusBarIsVisible(this, statusBarIsVisible); 4088 } 4089 4090 void WebPageProxy::getStatusBarIsVisible(bool& statusBarIsVisible) 4091 { 4092 statusBarIsVisible = m_uiClient->statusBarIsVisible(this); 4091 m_uiClient->setStatusBarIsVisible(*this, statusBarIsVisible); 4092 } 4093 4094 void WebPageProxy::getStatusBarIsVisible(Ref<Messages::WebPageProxy::GetStatusBarIsVisible::DelayedReply>&& reply) 4095 { 4096 m_uiClient->statusBarIsVisible(*this, [reply = WTFMove(reply)] (bool visible) { 4097 reply->send(visible); 4098 }); 4093 4099 } 4094 4100 4095 4101 void WebPageProxy::setIsResizable(bool isResizable) 4096 4102 { 4097 m_uiClient->setIsResizable(this, isResizable); 4098 } 4099 4100 void WebPageProxy::getIsResizable(bool& isResizable) 4101 { 4102 isResizable = m_uiClient->isResizable(this); 4103 m_uiClient->setIsResizable(*this, isResizable); 4104 } 4105 4106 void WebPageProxy::getIsResizable(Ref<Messages::WebPageProxy::GetIsResizable::DelayedReply>&& reply) 4107 { 4108 m_uiClient->isResizable(*this, [reply = WTFMove(reply)] (bool resizable) { 4109 reply->send(resizable); 4110 }); 4103 4111 } 4104 4112 4105 4113 void WebPageProxy::setWindowFrame(const FloatRect& newWindowFrame) 4106 4114 { 4107 m_uiClient->setWindowFrame(this, m_pageClient.convertToDeviceSpace(newWindowFrame)); 4108 } 4109 4110 void WebPageProxy::getWindowFrame(FloatRect& newWindowFrame) 4111 { 4112 newWindowFrame = m_pageClient.convertToUserSpace(m_uiClient->windowFrame(this)); 4115 m_uiClient->setWindowFrame(*this, m_pageClient.convertToDeviceSpace(newWindowFrame)); 4116 } 4117 4118 void WebPageProxy::getWindowFrame(Ref<Messages::WebPageProxy::GetWindowFrame::DelayedReply>&& reply) 4119 { 4120 m_uiClient->windowFrame(*this, [this, protectedThis = makeRef(*this), reply = WTFMove(reply)] (FloatRect frame) { 4121 reply->send(m_pageClient.convertToUserSpace(frame)); 4122 }); 4123 } 4124 4125 void WebPageProxy::getWindowFrameWithCallback(Function<void(FloatRect)>&& completionHandler) 4126 { 4127 m_uiClient->windowFrame(*this, WTFMove(completionHandler)); 4128 } 4129 4130 void WebPageProxy::screenToRootView(const IntPoint& screenPoint, Ref<Messages::WebPageProxy::ScreenToRootView::DelayedReply>&& reply) 4131 { 4132 reply->send(m_pageClient.screenToRootView(screenPoint)); 4113 4133 } 4114 4134 4115 void WebPageProxy::screenToRootView(const IntPoint& screenPoint, IntPoint& windowPoint) 4116 { 4117 windowPoint = m_pageClient.screenToRootView(screenPoint); 4118 } 4119 4120 void WebPageProxy::rootViewToScreen(const IntRect& viewRect, IntRect& result) 4121 { 4122 result = m_pageClient.rootViewToScreen(viewRect); 4135 void WebPageProxy::rootViewToScreen(const IntRect& viewRect, Ref<Messages::WebPageProxy::RootViewToScreen::DelayedReply>&& reply) 4136 { 4137 reply->send(m_pageClient.rootViewToScreen(viewRect)); 4123 4138 } 4124 4139 … … 4206 4221 MESSAGE_CHECK(frame); 4207 4222 4208 m_uiClient->printFrame( this,frame);4223 m_uiClient->printFrame(*this, *frame); 4209 4224 4210 4225 endPrinting(); // Send a message synchronously while m_isPerformingDOMPrintOperation is still true. … … 5913 5928 } 5914 5929 5915 float WebPageProxy::headerHeight(WebFrameProxy *frame)5916 { 5917 if (frame ->isDisplayingPDFDocument())5930 float WebPageProxy::headerHeight(WebFrameProxy& frame) 5931 { 5932 if (frame.isDisplayingPDFDocument()) 5918 5933 return 0; 5919 return m_uiClient->headerHeight( this, frame);5920 } 5921 5922 float WebPageProxy::footerHeight(WebFrameProxy *frame)5923 { 5924 if (frame ->isDisplayingPDFDocument())5934 return m_uiClient->headerHeight(*this, frame); 5935 } 5936 5937 float WebPageProxy::footerHeight(WebFrameProxy& frame) 5938 { 5939 if (frame.isDisplayingPDFDocument()) 5925 5940 return 0; 5926 return m_uiClient->footerHeight( this, frame);5927 } 5928 5929 void WebPageProxy::drawHeader(WebFrameProxy * frame, const FloatRect& rect)5930 { 5931 if (frame ->isDisplayingPDFDocument())5932 return; 5933 m_uiClient->drawHeader( this, frame, rect);5934 } 5935 5936 void WebPageProxy::drawFooter(WebFrameProxy * frame, const FloatRect& rect)5937 { 5938 if (frame ->isDisplayingPDFDocument())5939 return; 5940 m_uiClient->drawFooter( this, frame, rect);5941 return m_uiClient->footerHeight(*this, frame); 5942 } 5943 5944 void WebPageProxy::drawHeader(WebFrameProxy& frame, FloatRect&& rect) 5945 { 5946 if (frame.isDisplayingPDFDocument()) 5947 return; 5948 m_uiClient->drawHeader(*this, frame, WTFMove(rect)); 5949 } 5950 5951 void WebPageProxy::drawFooter(WebFrameProxy& frame, FloatRect&& rect) 5952 { 5953 if (frame.isDisplayingPDFDocument()) 5954 return; 5955 m_uiClient->drawFooter(*this, frame, WTFMove(rect)); 5941 5956 } 5942 5957 -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r221866 r221887 809 809 void forceRepaint(RefPtr<VoidCallback>&&); 810 810 811 float headerHeight(WebFrameProxy *);812 float footerHeight(WebFrameProxy *);813 void drawHeader(WebFrameProxy *, const WebCore::FloatRect&);814 void drawFooter(WebFrameProxy *, const WebCore::FloatRect&);811 float headerHeight(WebFrameProxy&); 812 float footerHeight(WebFrameProxy&); 813 void drawHeader(WebFrameProxy&, WebCore::FloatRect&&); 814 void drawFooter(WebFrameProxy&, WebCore::FloatRect&&); 815 815 816 816 #if PLATFORM(COCOA) … … 1169 1169 void setFocus(bool focused); 1170 1170 void setWindowFrame(const WebCore::FloatRect&); 1171 void getWindowFrame(WebCore::FloatRect&); 1171 void getWindowFrame(Ref<Messages::WebPageProxy::GetWindowFrame::DelayedReply>&&); 1172 void getWindowFrameWithCallback(Function<void(WebCore::FloatRect)>&&); 1172 1173 1173 1174 bool isResourceCachingDisabled() const { return m_isResourceCachingDisabled; } … … 1297 1298 void runJavaScriptAlert(uint64_t frameID, const WebCore::SecurityOriginData&, const String&, Ref<Messages::WebPageProxy::RunJavaScriptAlert::DelayedReply>&&); 1298 1299 void runJavaScriptConfirm(uint64_t frameID, const WebCore::SecurityOriginData&, const String&, Ref<Messages::WebPageProxy::RunJavaScriptConfirm::DelayedReply>&&); 1299 void runJavaScriptPrompt(uint64_t frameID, const WebCore::SecurityOriginData&, const String&, const String&, Ref Ptr<Messages::WebPageProxy::RunJavaScriptPrompt::DelayedReply>);1300 void runJavaScriptPrompt(uint64_t frameID, const WebCore::SecurityOriginData&, const String&, const String&, Ref<Messages::WebPageProxy::RunJavaScriptPrompt::DelayedReply>&&); 1300 1301 void setStatusText(const String&); 1301 1302 void mouseDidMoveOverElement(WebHitTestResultData&&, uint32_t modifiers, UserData&&); … … 1311 1312 void getToolbarsAreVisible(Ref<Messages::WebPageProxy::GetToolbarsAreVisible::DelayedReply>&&); 1312 1313 void setMenuBarIsVisible(bool menuBarIsVisible); 1313 void getMenuBarIsVisible( bool& menuBarIsVisible);1314 void getMenuBarIsVisible(Ref<Messages::WebPageProxy::GetMenuBarIsVisible::DelayedReply>&&); 1314 1315 void setStatusBarIsVisible(bool statusBarIsVisible); 1315 void getStatusBarIsVisible( bool& statusBarIsVisible);1316 void getStatusBarIsVisible(Ref<Messages::WebPageProxy::GetStatusBarIsVisible::DelayedReply>&&); 1316 1317 void setIsResizable(bool isResizable); 1317 void getIsResizable( bool& isResizable);1318 void screenToRootView(const WebCore::IntPoint& screenPoint, WebCore::IntPoint& windowPoint);1319 void rootViewToScreen(const WebCore::IntRect& viewRect, WebCore::IntRect& result);1318 void getIsResizable(Ref<Messages::WebPageProxy::GetIsResizable::DelayedReply>&&); 1319 void screenToRootView(const WebCore::IntPoint& screenPoint, Ref<Messages::WebPageProxy::ScreenToRootView::DelayedReply>&&); 1320 void rootViewToScreen(const WebCore::IntRect& viewRect, Ref<Messages::WebPageProxy::RootViewToScreen::DelayedReply>&&); 1320 1321 #if PLATFORM(IOS) 1321 1322 void accessibilityScreenToRootView(const WebCore::IntPoint& screenPoint, WebCore::IntPoint& windowPoint); -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r221866 r221887 53 53 SetToolbarsAreVisible(bool toolbarsAreVisible) 54 54 GetToolbarsAreVisible() -> (bool toolbarsAreVisible) Delayed 55 SetMenuBarIsVisible(bool menuBarIsVisible) ;56 GetMenuBarIsVisible() -> (bool menuBarIsVisible) ;55 SetMenuBarIsVisible(bool menuBarIsVisible) 56 GetMenuBarIsVisible() -> (bool menuBarIsVisible) Delayed 57 57 SetStatusBarIsVisible(bool statusBarIsVisible) 58 GetStatusBarIsVisible() -> (bool statusBarIsVisible) 58 GetStatusBarIsVisible() -> (bool statusBarIsVisible) Delayed 59 59 SetIsResizable(bool isResizable) 60 GetIsResizable() -> (bool isResizable) 60 GetIsResizable() -> (bool isResizable) Delayed 61 61 SetWindowFrame(WebCore::FloatRect windowFrame) 62 GetWindowFrame() -> (WebCore::FloatRect windowFrame) 63 ScreenToRootView(WebCore::IntPoint screenPoint) -> (WebCore::IntPoint windowPoint) 64 RootViewToScreen(WebCore::IntRect rect) -> (WebCore::IntRect screenFrame) 62 GetWindowFrame() -> (WebCore::FloatRect windowFrame) Delayed 63 ScreenToRootView(WebCore::IntPoint screenPoint) -> (WebCore::IntPoint windowPoint) Delayed 64 RootViewToScreen(WebCore::IntRect rect) -> (WebCore::IntRect screenFrame) Delayed 65 65 66 66 #if PLATFORM(COCOA) -
trunk/Source/WebKit/UIProcess/mac/WKPrintingView.h
r218799 r221887 69 69 } 70 70 71 - (id)initWithFrameProxy:(WebKit::WebFrameProxy *)frame view:(NSView *)wkView;71 - (id)initWithFrameProxy:(WebKit::WebFrameProxy&)frame view:(NSView *)wkView; 72 72 73 73 @end -
trunk/Source/WebKit/UIProcess/mac/WKPrintingView.mm
r218985 r221887 52 52 @implementation WKPrintingView 53 53 54 - (id)initWithFrameProxy:(WebKit::WebFrameProxy *)frame view:(NSView *)wkView54 - (id)initWithFrameProxy:(WebKit::WebFrameProxy&)frame view:(NSView *)wkView 55 55 { 56 56 self = [super init]; // No frame rect to pass to NSView. … … 58 58 return nil; 59 59 60 _webFrame = frame;60 _webFrame = &frame; 61 61 _wkView = wkView; 62 62 … … 152 152 153 153 CGFloat scale = [info scalingFactor]; 154 [info setTopMargin:originalTopMargin + _webFrame->page()->headerHeight( _webFrame.get()) * scale];155 [info setBottomMargin:originalBottomMargin + _webFrame->page()->footerHeight( _webFrame.get()) * scale];154 [info setTopMargin:originalTopMargin + _webFrame->page()->headerHeight(*_webFrame) * scale]; 155 [info setBottomMargin:originalBottomMargin + _webFrame->page()->footerHeight(*_webFrame) * scale]; 156 156 } 157 157 … … 638 638 CGFloat headerFooterLeft = [printInfo leftMargin] / scale; 639 639 CGFloat headerFooterWidth = (paperSize.width - ([printInfo leftMargin] + [printInfo rightMargin])) / scale; 640 NSRect footerRect = NSMakeRect(headerFooterLeft, [printInfo bottomMargin] / scale - _webFrame->page()->footerHeight( _webFrame.get()), headerFooterWidth, _webFrame->page()->footerHeight(_webFrame.get()));641 NSRect headerRect = NSMakeRect(headerFooterLeft, (paperSize.height - [printInfo topMargin]) / scale, headerFooterWidth, _webFrame->page()->headerHeight( _webFrame.get()));640 NSRect footerRect = NSMakeRect(headerFooterLeft, [printInfo bottomMargin] / scale - _webFrame->page()->footerHeight(*_webFrame), headerFooterWidth, _webFrame->page()->footerHeight(*_webFrame)); 641 NSRect headerRect = NSMakeRect(headerFooterLeft, (paperSize.height - [printInfo topMargin]) / scale, headerFooterWidth, _webFrame->page()->headerHeight(*_webFrame)); 642 642 643 643 NSGraphicsContext *currentContext = [NSGraphicsContext currentContext]; 644 644 [currentContext saveGraphicsState]; 645 645 NSRectClip(headerRect); 646 _webFrame->page()->drawHeader( _webFrame.get(), headerRect);646 _webFrame->page()->drawHeader(*_webFrame, headerRect); 647 647 [currentContext restoreGraphicsState]; 648 648 649 649 [currentContext saveGraphicsState]; 650 650 NSRectClip(footerRect); 651 _webFrame->page()->drawFooter( _webFrame.get(), footerRect);651 _webFrame->page()->drawFooter(*_webFrame, footerRect); 652 652 [currentContext restoreGraphicsState]; 653 653 } -
trunk/Source/WebKit/UIProcess/mac/WebPageProxyMac.mm
r221502 r221887 137 137 138 138 // In case the UI client overrides getWindowFrame(), we call it here to make sure we send the appropriate window frame. 139 FloatRect windowFrameInScreenCoordinates = m_uiClient->windowFrame(this);140 FloatRect windowFrameInUnflippedScreenCoordinates = m_pageClient.convertToUserSpace(windowFrameInScreenCoordinates);141 142 process().send(Messages::WebPage::WindowAndViewFramesChanged(windowFrameInScreenCoordinates, windowFrameInUnflippedScreenCoordinates, viewFrameInWindowCoordinates, accessibilityViewCoordinates), m_pageID);139 m_uiClient->windowFrame(*this, [this, protectedThis = makeRef(*this), viewFrameInWindowCoordinates, accessibilityViewCoordinates] (FloatRect windowFrameInScreenCoordinates) { 140 FloatRect windowFrameInUnflippedScreenCoordinates = m_pageClient.convertToUserSpace(windowFrameInScreenCoordinates); 141 process().send(Messages::WebPage::WindowAndViewFramesChanged(windowFrameInScreenCoordinates, windowFrameInUnflippedScreenCoordinates, viewFrameInWindowCoordinates, accessibilityViewCoordinates), m_pageID); 142 }); 143 143 } 144 144
Note: See TracChangeset
for help on using the changeset viewer.