Title: [222033] trunk
Revision
222033
Author
achristen...@apple.com
Date
2017-09-14 10:55:17 -0700 (Thu, 14 Sep 2017)

Log Message

Add WKUIDelegatePrivate equivalent of WKPageUIClient's drawHeader, drawFooter, headerHeight, and footerHeight
https://bugs.webkit.org/show_bug.cgi?id=176889
<rdar://problem/29270035>

Reviewed by Andy Estes.

Source/WebKit:

* UIProcess/API/C/WKPage.cpp:
(WKPageLoadAlternateHTMLString):
(WKPageLoadAlternateHTMLStringWithUserData):
* UIProcess/API/Cocoa/WKBrowsingContextController.mm:
(-[WKBrowsingContextController loadAlternateHTMLString:baseURL:forUnreachableURL:]):
* UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _loadAlternateHTMLString:baseURL:forUnreachableURL:]):
* UIProcess/Cocoa/UIDelegate.h:
* UIProcess/Cocoa/UIDelegate.mm:
(WebKit::UIDelegate::setDelegate):
(WebKit::UIDelegate::UIClient::headerHeight):
(WebKit::UIDelegate::UIClient::footerHeight):
(WebKit::UIDelegate::UIClient::drawHeader):
(WebKit::UIDelegate::UIClient::drawFooter):
* UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm:
(-[WKReloadFrameErrorRecoveryAttempter attemptRecovery]):
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::printOperationWithPrintInfo):
* UIProcess/FrameLoadState.cpp:
(WebKit::FrameLoadState::didStartProvisionalLoad):
(WebKit::FrameLoadState::didReceiveServerRedirectForProvisionalLoad):
(WebKit::FrameLoadState::didFailProvisionalLoad):
(WebKit::FrameLoadState::didCommitLoad):
(WebKit::FrameLoadState::didSameDocumentNotification):
(WebKit::FrameLoadState::setUnreachableURL):
(WebKit::FrameLoadState::FrameLoadState): Deleted.
* UIProcess/FrameLoadState.h:
(WebKit::FrameLoadState::url const):
(WebKit::FrameLoadState::provisionalURL const):
(WebKit::FrameLoadState::unreachableURL const):
* UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::loadURL):
(WebKit::WebFrameProxy::didStartProvisionalLoad):
(WebKit::WebFrameProxy::didReceiveServerRedirectForProvisionalLoad):
(WebKit::WebFrameProxy::didSameDocumentNavigation):
(WebKit::WebFrameProxy::setUnreachableURL):
* UIProcess/WebFrameProxy.h:
(WebKit::WebFrameProxy::url const):
(WebKit::WebFrameProxy::provisionalURL const):
(WebKit::WebFrameProxy::unreachableURL const):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::loadAlternateHTMLString):
(WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
(WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
(WebKit::WebPageProxy::didChangeProvisionalURLForFrame):
(WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad):
(WebKit::WebFrameLoaderClient::dispatchDidChangeProvisionalURL):
(WebKit::WebFrameLoaderClient::dispatchDidChangeLocationWithinPage):
(WebKit::WebFrameLoaderClient::dispatchDidPushStateWithinPage):
(WebKit::WebFrameLoaderClient::dispatchDidReplaceStateWithinPage):
(WebKit::WebFrameLoaderClient::dispatchDidPopStateWithinPage):
(WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::loadURLInFrame):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

Tools:

* TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:
(-[PrintDelegate _webView:printFrame:]):
(-[PrintDelegate _webViewHeaderHeight:]):
(-[PrintDelegate _webViewFooterHeight:]):
(-[PrintDelegate _webView:drawHeaderInRect:forPageWithTitle:URL:]):
(-[PrintDelegate _webView:drawFooterInRect:forPageWithTitle:URL:]):
(callbacksEqual):
(TEST):
* TestWebKitAPI/cocoa/TestWKWebView.h:
* TestWebKitAPI/cocoa/TestWKWebView.mm:
(-[TestWKWebView hostWindow]):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (222032 => 222033)


--- trunk/Source/WebKit/ChangeLog	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Source/WebKit/ChangeLog	2017-09-14 17:55:17 UTC (rev 222033)
@@ -1,3 +1,73 @@
+2017-09-14  Alex Christensen  <achristen...@webkit.org>
+
+        Add WKUIDelegatePrivate equivalent of WKPageUIClient's drawHeader, drawFooter, headerHeight, and footerHeight
+        https://bugs.webkit.org/show_bug.cgi?id=176889
+        <rdar://problem/29270035>
+
+        Reviewed by Andy Estes.
+
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageLoadAlternateHTMLString):
+        (WKPageLoadAlternateHTMLStringWithUserData):
+        * UIProcess/API/Cocoa/WKBrowsingContextController.mm:
+        (-[WKBrowsingContextController loadAlternateHTMLString:baseURL:forUnreachableURL:]):
+        * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _loadAlternateHTMLString:baseURL:forUnreachableURL:]):
+        * UIProcess/Cocoa/UIDelegate.h:
+        * UIProcess/Cocoa/UIDelegate.mm:
+        (WebKit::UIDelegate::setDelegate):
+        (WebKit::UIDelegate::UIClient::headerHeight):
+        (WebKit::UIDelegate::UIClient::footerHeight):
+        (WebKit::UIDelegate::UIClient::drawHeader):
+        (WebKit::UIDelegate::UIClient::drawFooter):
+        * UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm:
+        (-[WKReloadFrameErrorRecoveryAttempter attemptRecovery]):
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::printOperationWithPrintInfo):
+        * UIProcess/FrameLoadState.cpp:
+        (WebKit::FrameLoadState::didStartProvisionalLoad):
+        (WebKit::FrameLoadState::didReceiveServerRedirectForProvisionalLoad):
+        (WebKit::FrameLoadState::didFailProvisionalLoad):
+        (WebKit::FrameLoadState::didCommitLoad):
+        (WebKit::FrameLoadState::didSameDocumentNotification):
+        (WebKit::FrameLoadState::setUnreachableURL):
+        (WebKit::FrameLoadState::FrameLoadState): Deleted.
+        * UIProcess/FrameLoadState.h:
+        (WebKit::FrameLoadState::url const):
+        (WebKit::FrameLoadState::provisionalURL const):
+        (WebKit::FrameLoadState::unreachableURL const):
+        * UIProcess/WebFrameProxy.cpp:
+        (WebKit::WebFrameProxy::loadURL):
+        (WebKit::WebFrameProxy::didStartProvisionalLoad):
+        (WebKit::WebFrameProxy::didReceiveServerRedirectForProvisionalLoad):
+        (WebKit::WebFrameProxy::didSameDocumentNavigation):
+        (WebKit::WebFrameProxy::setUnreachableURL):
+        * UIProcess/WebFrameProxy.h:
+        (WebKit::WebFrameProxy::url const):
+        (WebKit::WebFrameProxy::provisionalURL const):
+        (WebKit::WebFrameProxy::unreachableURL const):
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::loadAlternateHTMLString):
+        (WebKit::WebPageProxy::didStartProvisionalLoadForFrame):
+        (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame):
+        (WebKit::WebPageProxy::didChangeProvisionalURLForFrame):
+        (WebKit::WebPageProxy::didSameDocumentNavigationForFrame):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad):
+        (WebKit::WebFrameLoaderClient::dispatchDidChangeProvisionalURL):
+        (WebKit::WebFrameLoaderClient::dispatchDidChangeLocationWithinPage):
+        (WebKit::WebFrameLoaderClient::dispatchDidPushStateWithinPage):
+        (WebKit::WebFrameLoaderClient::dispatchDidReplaceStateWithinPage):
+        (WebKit::WebFrameLoaderClient::dispatchDidPopStateWithinPage):
+        (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::loadURLInFrame):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+
 2017-09-14  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK][Wayland] Flickering when resizing the window

Modified: trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp (222032 => 222033)


--- trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp	2017-09-14 17:55:17 UTC (rev 222033)
@@ -209,12 +209,12 @@
 
 void WKPageLoadAlternateHTMLString(WKPageRef pageRef, WKStringRef htmlStringRef, WKURLRef baseURLRef, WKURLRef unreachableURLRef)
 {
-    toImpl(pageRef)->loadAlternateHTMLString(toWTFString(htmlStringRef), toWTFString(baseURLRef), toWTFString(unreachableURLRef));
+    toImpl(pageRef)->loadAlternateHTMLString(toWTFString(htmlStringRef), URL(URL(), toWTFString(baseURLRef)), URL(URL(), toWTFString(unreachableURLRef)));
 }
 
 void WKPageLoadAlternateHTMLStringWithUserData(WKPageRef pageRef, WKStringRef htmlStringRef, WKURLRef baseURLRef, WKURLRef unreachableURLRef, WKTypeRef userDataRef)
 {
-    toImpl(pageRef)->loadAlternateHTMLString(toWTFString(htmlStringRef), toWTFString(baseURLRef), toWTFString(unreachableURLRef), toImpl(userDataRef));
+    toImpl(pageRef)->loadAlternateHTMLString(toWTFString(htmlStringRef), URL(URL(), toWTFString(baseURLRef)), URL(URL(), toWTFString(unreachableURLRef)), toImpl(userDataRef));
 }
 
 void WKPageLoadPlainTextString(WKPageRef pageRef, WKStringRef plainTextStringRef)

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKBrowsingContextController.mm (222032 => 222033)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKBrowsingContextController.mm	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKBrowsingContextController.mm	2017-09-14 17:55:17 UTC (rev 222033)
@@ -157,7 +157,7 @@
 
 - (void)loadAlternateHTMLString:(NSString *)string baseURL:(NSURL *)baseURL forUnreachableURL:(NSURL *)unreachableURL
 {
-    _page->loadAlternateHTMLString(string, [baseURL _web_originalDataAsWTFString], [unreachableURL _web_originalDataAsWTFString]);
+    _page->loadAlternateHTMLString(string, baseURL, unreachableURL);
 }
 
 - (void)loadData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)encodingName baseURL:(NSURL *)baseURL

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (222032 => 222033)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h	2017-09-14 17:55:17 UTC (rev 222033)
@@ -161,6 +161,10 @@
 - (void)_webView:(WKWebView *)webView didClickAutoFillButtonWithUserInfo:(id <NSSecureCoding>)userInfo WK_API_AVAILABLE(macosx(WK_MAC_TBA));
 - (void)_webView:(WKWebView *)webView getToolbarsAreVisibleWithCompletionHandler:(void(^)(BOOL))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA));
 - (void)_webView:(WKWebView *)webView saveDataToFile:(NSData *)data suggestedFilename:(NSString *)suggestedFilename mimeType:(NSString *)mimeType originatingURL:(NSURL *)url WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (CGFloat)_webViewHeaderHeight:(WKWebView *)webView WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (CGFloat)_webViewFooterHeight:(WKWebView *)webView WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (void)_webView:(WKWebView *)webView drawHeaderInRect:(CGRect)rect forPageWithTitle:(NSString *)title URL:(NSURL *)url WK_API_AVAILABLE(macosx(WK_MAC_TBA));
+- (void)_webView:(WKWebView *)webView drawFooterInRect:(CGRect)rect forPageWithTitle:(NSString *)title URL:(NSURL *)url WK_API_AVAILABLE(macosx(WK_MAC_TBA));
 - (void)_webView:(WKWebView *)webView requestNotificationPermissionForSecurityOrigin:(WKSecurityOrigin *)securityOrigin decisionHandler:(void (^)(BOOL))decisionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA));
 - (void)_webView:(WKWebView *)webview mouseDidMoveOverElement:(_WKHitTestResult *)hitTestResult withFlags:(NSEventModifierFlags)flags userInfo:(id <NSSecureCoding>)userInfo;
 - (void)_webView:(WKWebView *)webView didExceedBackgroundResourceLimitWhileInForeground:(_WKResourceLimit)limit WK_API_AVAILABLE(macosx(WK_MAC_TBA));

Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (222032 => 222033)


--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm	2017-09-14 17:55:17 UTC (rev 222033)
@@ -3839,7 +3839,7 @@
 
 - (void)_loadAlternateHTMLString:(NSString *)string baseURL:(NSURL *)baseURL forUnreachableURL:(NSURL *)unreachableURL
 {
-    _page->loadAlternateHTMLString(string, [baseURL _web_originalDataAsWTFString], [unreachableURL _web_originalDataAsWTFString]);
+    _page->loadAlternateHTMLString(string, baseURL, unreachableURL);
 }
 
 - (WKNavigation *)_loadData:(NSData *)data MIMEType:(NSString *)MIMEType characterEncodingName:(NSString *)characterEncodingName baseURL:(NSURL *)baseURL userData:(id)userData

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp (222032 => 222033)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp	2017-09-14 17:55:17 UTC (rev 222033)
@@ -65,6 +65,7 @@
 #include <WebCore/GUniquePtrSoup.h>
 #include <WebCore/JSDOMExceptionHandling.h>
 #include <WebCore/RefPtrCairo.h>
+#include <WebCore/URL.h>
 #include <glib/gi18n-lib.h>
 #include <wtf/SetForScope.h>
 #include <wtf/glib/GRefPtr.h>
@@ -2491,7 +2492,7 @@
     g_return_if_fail(content);
     g_return_if_fail(contentURI);
 
-    getPage(webView).loadAlternateHTMLString(String::fromUTF8(content), String::fromUTF8(baseURI), String::fromUTF8(contentURI));
+    getPage(webView).loadAlternateHTMLString(String::fromUTF8(content), URL(URL(), String::fromUTF8(baseURI)), URL(URL(), String::fromUTF8(contentURI)));
 }
 
 /**
@@ -2627,7 +2628,7 @@
 {
     g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView));
 
-    getPage(webView).reload(WebCore::ReloadOption::FromOrigin);
+    getPage(webView).reload(ReloadOption::FromOrigin);
 }
 
 /**
@@ -3155,7 +3156,7 @@
     return webView->priv->_javascript_GlobalContext.get();
 }
 
-static void webkitWebViewRunJavaScriptCallback(API::SerializedScriptValue* wkSerializedScriptValue, const WebCore::ExceptionDetails& exceptionDetails, GTask* task)
+static void webkitWebViewRunJavaScriptCallback(API::SerializedScriptValue* wkSerializedScriptValue, const ExceptionDetails& exceptionDetails, GTask* task)
 {
     if (g_task_return_error_if_cancelled(task))
         return;
@@ -3206,7 +3207,7 @@
     g_return_if_fail(script);
 
     GTask* task = g_task_new(webView, cancellable, callback, userData);
-    getPage(webView).runJavaScriptInMainFrame(String::fromUTF8(script), true, [task](API::SerializedScriptValue* serializedScriptValue, bool, const WebCore::ExceptionDetails& exceptionDetails, WebKit::CallbackBase::Error) {
+    getPage(webView).runJavaScriptInMainFrame(String::fromUTF8(script), true, [task](API::SerializedScriptValue* serializedScriptValue, bool, const ExceptionDetails& exceptionDetails, WebKit::CallbackBase::Error) {
         webkitWebViewRunJavaScriptCallback(serializedScriptValue, exceptionDetails, adoptGRef(task).get());
     });
 }
@@ -3297,7 +3298,7 @@
     WebKitWebView* webView = WEBKIT_WEB_VIEW(g_task_get_source_object(task.get()));
     gpointer outputStreamData = g_memory_output_stream_get_data(G_MEMORY_OUTPUT_STREAM(object));
     getPage(webView).runJavaScriptInMainFrame(String::fromUTF8(reinterpret_cast<const gchar*>(outputStreamData)), true,
-        [task](API::SerializedScriptValue* serializedScriptValue, bool, const WebCore::ExceptionDetails& exceptionDetails, WebKit::CallbackBase::Error) {
+        [task](API::SerializedScriptValue* serializedScriptValue, bool, const ExceptionDetails& exceptionDetails, WebKit::CallbackBase::Error) {
             webkitWebViewRunJavaScriptCallback(serializedScriptValue, exceptionDetails, task.get());
         });
 }

Modified: trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h (222032 => 222033)


--- trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h	2017-09-14 17:55:17 UTC (rev 222033)
@@ -105,6 +105,10 @@
         void setWindowFrame(WebPageProxy&, const WebCore::FloatRect&) final;
         void windowFrame(WebPageProxy&, Function<void(WebCore::FloatRect)>&&) final;
         void didNotHandleWheelEvent(WebPageProxy*, const NativeWebWheelEvent&) final;
+        float headerHeight(WebPageProxy&, WebFrameProxy&) final;
+        float footerHeight(WebPageProxy&, WebFrameProxy&) final;
+        void drawHeader(WebPageProxy&, WebFrameProxy&, WebCore::FloatRect&&) final;
+        void drawFooter(WebPageProxy&, WebFrameProxy&, WebCore::FloatRect&&) final;
         void decidePolicyForNotificationPermissionRequest(WebPageProxy&, API::SecurityOrigin&, Function<void(bool)>&&) final;
         void handleAutoplayEvent(WebPageProxy&, WebCore::AutoplayEvent, OptionSet<WebCore::AutoplayEventFlags>) final;
         void unavailablePluginButtonClicked(WebPageProxy&, WKPluginUnavailabilityReason, API::Dictionary&) final;
@@ -160,6 +164,8 @@
         bool webViewRunModal : 1;
         bool webViewTakeFocus : 1;
         bool webViewDidScroll : 1;
+        bool webViewHeaderHeight : 1;
+        bool webViewFooterHeight : 1;
         bool webViewSetResizable : 1;
         bool webViewSetWindowFrame : 1;
         bool webViewDidNotHandleWheelEvent : 1;
@@ -166,6 +172,8 @@
         bool webViewHandleAutoplayEventWithFlags : 1;
         bool webViewUnavailablePlugInButtonClicked : 1;
         bool webViewDidClickAutoFillButtonWithUserInfo : 1;
+        bool webViewDrawHeaderInRectForPageWithTitleURL : 1;
+        bool webViewDrawFooterInRectForPageWithTitleURL : 1;
         bool webViewGetWindowFrameWithCompletionHandler : 1;
         bool webViewMouseDidMoveOverElementWithFlagsUserInfo : 1;
         bool webViewGetToolbarsAreVisibleWithCompletionHandler : 1;

Modified: trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm (222032 => 222033)


--- trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm	2017-09-14 17:55:17 UTC (rev 222033)
@@ -120,6 +120,10 @@
     m_delegateMethods.webViewUnavailablePlugInButtonClicked = [delegate respondsToSelector:@selector(_webView:unavailablePlugInButtonClickedWithReason:plugInInfo:)];
     m_delegateMethods.webViewHandleAutoplayEventWithFlags = [delegate respondsToSelector:@selector(_webView:handleAutoplayEvent:withFlags:)];
     m_delegateMethods.webViewDidClickAutoFillButtonWithUserInfo = [delegate respondsToSelector:@selector(_webView:didClickAutoFillButtonWithUserInfo:)];
+    m_delegateMethods.webViewDrawHeaderInRectForPageWithTitleURL = [delegate respondsToSelector:@selector(_webView:drawHeaderInRect:forPageWithTitle:URL:)];
+    m_delegateMethods.webViewDrawFooterInRectForPageWithTitleURL = [delegate respondsToSelector:@selector(_webView:drawFooterInRect:forPageWithTitle:URL:)];
+    m_delegateMethods.webViewHeaderHeight = [delegate respondsToSelector:@selector(_webViewHeaderHeight:)];
+    m_delegateMethods.webViewFooterHeight = [delegate respondsToSelector:@selector(_webViewFooterHeight:)];
     m_delegateMethods.webViewMouseDidMoveOverElementWithFlagsUserInfo = [delegate respondsToSelector:@selector(_webView:mouseDidMoveOverElement:withFlags:userInfo:)];
     m_delegateMethods.webViewDidExceedBackgroundResourceLimitWhileInForeground = [delegate respondsToSelector:@selector(_webView:didExceedBackgroundResourceLimitWhileInForeground:)];
     m_delegateMethods.webViewSaveDataToFileSuggestedFilenameMimeTypeOriginatingURL = [delegate respondsToSelector:@selector(_webView:saveDataToFile:suggestedFilename:mimeType:originatingURL:)];
@@ -423,6 +427,54 @@
     [(id <WKUIDelegatePrivate>)delegate _webViewRunModal:m_uiDelegate.m_webView];
 }
 
+float UIDelegate::UIClient::headerHeight(WebPageProxy&, WebFrameProxy& webFrameProxy)
+{
+    if (!m_uiDelegate.m_delegateMethods.webViewHeaderHeight)
+        return 0;
+    
+    auto delegate = m_uiDelegate.m_delegate.get();
+    if (!delegate)
+        return 0;
+    
+    return [(id <WKUIDelegatePrivate>)delegate _webViewHeaderHeight:m_uiDelegate.m_webView];
+}
+
+float UIDelegate::UIClient::footerHeight(WebPageProxy&, WebFrameProxy&)
+{
+    if (!m_uiDelegate.m_delegateMethods.webViewFooterHeight)
+        return 0;
+    
+    auto delegate = m_uiDelegate.m_delegate.get();
+    if (!delegate)
+        return 0;
+    
+    return [(id <WKUIDelegatePrivate>)delegate _webViewFooterHeight:m_uiDelegate.m_webView];
+}
+
+void UIDelegate::UIClient::drawHeader(WebPageProxy&, WebFrameProxy& frame, WebCore::FloatRect&& rect)
+{
+    if (!m_uiDelegate.m_delegateMethods.webViewDrawHeaderInRectForPageWithTitleURL)
+        return;
+    
+    auto delegate = m_uiDelegate.m_delegate.get();
+    if (!delegate)
+        return;
+    
+    [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView drawHeaderInRect:rect forPageWithTitle:frame.title() URL:frame.url()];
+}
+
+void UIDelegate::UIClient::drawFooter(WebPageProxy&, WebFrameProxy& frame, WebCore::FloatRect&& rect)
+{
+    if (!m_uiDelegate.m_delegateMethods.webViewDrawFooterInRectForPageWithTitleURL)
+        return;
+    
+    auto delegate = m_uiDelegate.m_delegate.get();
+    if (!delegate)
+        return;
+    
+    [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView drawFooterInRect:rect forPageWithTitle:frame.title() URL:frame.url()];
+}
+
 void UIDelegate::UIClient::pageDidScroll(WebPageProxy*)
 {
     if (!m_uiDelegate.m_delegateMethods.webViewDidScroll)

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm (222032 => 222033)


--- trunk/Source/WebKit/UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm	2017-09-14 17:55:17 UTC (rev 222033)
@@ -69,7 +69,7 @@
     if (!webFrameProxy)
         return NO;
 
-    webFrameProxy->loadURL(_urlString);
+    webFrameProxy->loadURL(WebCore::URL(WebCore::URL(), _urlString));
     return YES;
 }
 

Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm (222032 => 222033)


--- trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm	2017-09-14 17:55:17 UTC (rev 222033)
@@ -1624,7 +1624,7 @@
 
 NSPrintOperation *WebViewImpl::printOperationWithPrintInfo(NSPrintInfo *printInfo, WebFrameProxy& frame)
 {
-    LOG(Printing, "Creating an NSPrintOperation for frame '%s'", frame.url().utf8().data());
+    LOG(Printing, "Creating an NSPrintOperation for frame '%s'", frame.url().string().utf8().data());
 
     // FIXME: If the frame cannot be printed (e.g. if it contains an encrypted PDF that disallows
     // printing), this function should return nil.

Modified: trunk/Source/WebKit/UIProcess/FrameLoadState.cpp (222032 => 222033)


--- trunk/Source/WebKit/UIProcess/FrameLoadState.cpp	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Source/WebKit/UIProcess/FrameLoadState.cpp	2017-09-14 17:55:17 UTC (rev 222033)
@@ -28,16 +28,11 @@
 
 namespace WebKit {
 
-FrameLoadState::FrameLoadState()
-    : m_state(State::Finished)
-{
-}
-
 FrameLoadState::~FrameLoadState()
 {
 }
 
-void FrameLoadState::didStartProvisionalLoad(const String& url)
+void FrameLoadState::didStartProvisionalLoad(const WebCore::URL& url)
 {
     ASSERT(m_provisionalURL.isEmpty());
 
@@ -45,7 +40,7 @@
     m_provisionalURL = url;
 }
 
-void FrameLoadState::didReceiveServerRedirectForProvisionalLoad(const String& url)
+void FrameLoadState::didReceiveServerRedirectForProvisionalLoad(const WebCore::URL& url)
 {
     ASSERT(m_state == State::Provisional);
 
@@ -57,7 +52,7 @@
     ASSERT(m_state == State::Provisional);
 
     m_state = State::Finished;
-    m_provisionalURL = String();
+    m_provisionalURL = { };
     m_unreachableURL = m_lastUnreachableURL;
 }
 
@@ -67,7 +62,7 @@
 
     m_state = State::Committed;
     m_url = m_provisionalURL;
-    m_provisionalURL = String();
+    m_provisionalURL = { };
 }
 
 void FrameLoadState::didFinishLoad()
@@ -86,12 +81,12 @@
     m_state = State::Finished;
 }
 
-void FrameLoadState::didSameDocumentNotification(const String& url)
+void FrameLoadState::didSameDocumentNotification(const WebCore::URL& url)
 {
     m_url = url;
 }
 
-void FrameLoadState::setUnreachableURL(const String& unreachableURL)
+void FrameLoadState::setUnreachableURL(const WebCore::URL& unreachableURL)
 {
     m_lastUnreachableURL = m_unreachableURL;
     m_unreachableURL = unreachableURL;

Modified: trunk/Source/WebKit/UIProcess/FrameLoadState.h (222032 => 222033)


--- trunk/Source/WebKit/UIProcess/FrameLoadState.h	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Source/WebKit/UIProcess/FrameLoadState.h	2017-09-14 17:55:17 UTC (rev 222033)
@@ -23,16 +23,14 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef FrameLoadState_h
-#define FrameLoadState_h
+#pragma once
 
-#include <wtf/text/WTFString.h>
+#include <WebCore/URL.h>
 
 namespace WebKit {
 
 class FrameLoadState {
 public:
-    FrameLoadState();
     ~FrameLoadState();
 
     enum class State {
@@ -41,8 +39,8 @@
         Finished
     };
 
-    void didStartProvisionalLoad(const String& url);
-    void didReceiveServerRedirectForProvisionalLoad(const String& url);
+    void didStartProvisionalLoad(const WebCore::URL&);
+    void didReceiveServerRedirectForProvisionalLoad(const WebCore::URL&);
     void didFailProvisionalLoad();
 
     void didCommitLoad();
@@ -49,23 +47,21 @@
     void didFinishLoad();
     void didFailLoad();
 
-    void didSameDocumentNotification(const String&);
+    void didSameDocumentNotification(const WebCore::URL&);
 
     State state() const { return m_state; }
-    const String& url() const { return m_url; }
-    const String& provisionalURL() const { return m_provisionalURL; }
+    const WebCore::URL& url() const { return m_url; }
+    const WebCore::URL& provisionalURL() const { return m_provisionalURL; }
 
-    void setUnreachableURL(const String&);
-    const String& unreachableURL() const { return m_unreachableURL; }
+    void setUnreachableURL(const WebCore::URL&);
+    const WebCore::URL& unreachableURL() const { return m_unreachableURL; }
 
 private:
-    State m_state;
-    String m_url;
-    String m_provisionalURL;
-    String m_unreachableURL;
-    String m_lastUnreachableURL;
+    State m_state { State::Finished };
+    WebCore::URL m_url;
+    WebCore::URL m_provisionalURL;
+    WebCore::URL m_unreachableURL;
+    WebCore::URL m_lastUnreachableURL;
 };
 
 } // namespace WebKit
-
-#endif // FrameLoadState_h

Modified: trunk/Source/WebKit/UIProcess/WebFrameProxy.cpp (222032 => 222033)


--- trunk/Source/WebKit/UIProcess/WebFrameProxy.cpp	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Source/WebKit/UIProcess/WebFrameProxy.cpp	2017-09-14 17:55:17 UTC (rev 222033)
@@ -76,7 +76,7 @@
     return this == m_page->mainFrame();
 }
 
-void WebFrameProxy::loadURL(const String& url)
+void WebFrameProxy::loadURL(const URL& url)
 {
     if (!m_page)
         return;
@@ -130,12 +130,12 @@
     return MIMETypeRegistry::isPDFOrPostScriptMIMEType(m_MIMEType);
 }
 
-void WebFrameProxy::didStartProvisionalLoad(const String& url)
+void WebFrameProxy::didStartProvisionalLoad(const URL& url)
 {
     m_frameLoadState.didStartProvisionalLoad(url);
 }
 
-void WebFrameProxy::didReceiveServerRedirectForProvisionalLoad(const String& url)
+void WebFrameProxy::didReceiveServerRedirectForProvisionalLoad(const URL& url)
 {
     m_frameLoadState.didReceiveServerRedirectForProvisionalLoad(url);
 }
@@ -166,7 +166,7 @@
     m_frameLoadState.didFailLoad();
 }
 
-void WebFrameProxy::didSameDocumentNavigation(const String& url)
+void WebFrameProxy::didSameDocumentNavigation(const URL& url)
 {
     m_frameLoadState.didSameDocumentNotification(url);
 }
@@ -176,7 +176,7 @@
     m_title = title;
 }
 
-void WebFrameProxy::receivedPolicyDecision(WebCore::PolicyAction action, uint64_t listenerID, API::Navigation* navigation, const WebsitePolicies& websitePolicies)
+void WebFrameProxy::receivedPolicyDecision(PolicyAction action, uint64_t listenerID, API::Navigation* navigation, const WebsitePolicies& websitePolicies)
 {
     if (!m_page)
         return;
@@ -232,13 +232,13 @@
     m_page->getResourceDataFromFrame(this, resourceURL, WTFMove(callbackFunction));
 }
 
-void WebFrameProxy::setUnreachableURL(const String& unreachableURL)
+void WebFrameProxy::setUnreachableURL(const URL& unreachableURL)
 {
     m_frameLoadState.setUnreachableURL(unreachableURL);
 }
 
 #if ENABLE(CONTENT_FILTERING)
-bool WebFrameProxy::didHandleContentFilterUnblockNavigation(const WebCore::ResourceRequest& request)
+bool WebFrameProxy::didHandleContentFilterUnblockNavigation(const ResourceRequest& request)
 {
     if (!m_contentFilterUnblockHandler.canHandleRequest(request)) {
         m_contentFilterUnblockHandler = { };

Modified: trunk/Source/WebKit/UIProcess/WebFrameProxy.h (222032 => 222033)


--- trunk/Source/WebKit/UIProcess/WebFrameProxy.h	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Source/WebKit/UIProcess/WebFrameProxy.h	2017-09-14 17:55:17 UTC (rev 222033)
@@ -77,14 +77,14 @@
 
     FrameLoadState& frameLoadState() { return m_frameLoadState; }
 
-    void loadURL(const String&);
+    void loadURL(const WebCore::URL&);
     void stopLoading() const;
 
-    const String& url() const { return m_frameLoadState.url(); }
-    const String& provisionalURL() const { return m_frameLoadState.provisionalURL(); }
+    const WebCore::URL& url() const { return m_frameLoadState.url(); }
+    const WebCore::URL& provisionalURL() const { return m_frameLoadState.provisionalURL(); }
 
-    void setUnreachableURL(const String&);
-    const String& unreachableURL() const { return m_frameLoadState.unreachableURL(); }
+    void setUnreachableURL(const WebCore::URL&);
+    const WebCore::URL& unreachableURL() const { return m_frameLoadState.unreachableURL(); }
 
     const String& mimeType() const { return m_MIMEType; }
     bool containsPluginDocument() const { return m_containsPluginDocument; }
@@ -105,13 +105,13 @@
     void getMainResourceData(Function<void (API::Data*, CallbackBase::Error)>&&);
     void getResourceData(API::URL*, Function<void (API::Data*, CallbackBase::Error)>&&);
 
-    void didStartProvisionalLoad(const String& url);
-    void didReceiveServerRedirectForProvisionalLoad(const String& url);
+    void didStartProvisionalLoad(const WebCore::URL&);
+    void didReceiveServerRedirectForProvisionalLoad(const WebCore::URL&);
     void didFailProvisionalLoad();
     void didCommitLoad(const String& contentType, WebCertificateInfo&, bool containsPluginDocument);
     void didFinishLoad();
     void didFailLoad();
-    void didSameDocumentNavigation(const String&); // eg. anchor navigation, session state change.
+    void didSameDocumentNavigation(const WebCore::URL&); // eg. anchor navigation, session state change.
     void didChangeTitle(const String&);
 
     // Policy operations.

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (222032 => 222033)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2017-09-14 17:55:17 UTC (rev 222033)
@@ -961,7 +961,7 @@
     return WTFMove(navigation);
 }
 
-void WebPageProxy::loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL, API::Object* userData)
+void WebPageProxy::loadAlternateHTMLString(const String& htmlString, const WebCore::URL& baseURL, const WebCore::URL& unreachableURL, API::Object* userData)
 {
     // When the UIProcess is in the process of handling a failing provisional load, do not attempt to
     // start a second alternative HTML load as this will prevent the page load state from being
@@ -3146,7 +3146,7 @@
     m_navigationState->didDestroyNavigation(navigationID);
 }
 
-void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& url, const String& unreachableURL, const UserData& userData)
+void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::URL&& url, WebCore::URL&& unreachableURL, const UserData& userData)
 {
     PageClientProtector protector(m_pageClient);
 
@@ -3180,7 +3180,7 @@
         m_loaderClient->didStartProvisionalLoadForFrame(*this, *frame, navigation.get(), m_process->transformHandlesToObjects(userData.object()).get());
 }
 
-void WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& url, const UserData& userData)
+void WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::URL&& url, const UserData& userData)
 {
     PageClientProtector protector(m_pageClient);
 
@@ -3234,7 +3234,7 @@
     }
 }
 
-void WebPageProxy::didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t, const String& url)
+void WebPageProxy::didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t, WebCore::URL&& url)
 {
     PageClientProtector protector(m_pageClient);
 
@@ -3482,7 +3482,7 @@
         m_pageClient.didFailLoadForMainFrame();
 }
 
-void WebPageProxy::didSameDocumentNavigationForFrame(uint64_t frameID, uint64_t navigationID, uint32_t opaqueSameDocumentNavigationType, const String& url, const UserData& userData)
+void WebPageProxy::didSameDocumentNavigationForFrame(uint64_t frameID, uint64_t navigationID, uint32_t opaqueSameDocumentNavigationType, WebCore::URL&& url, const UserData& userData)
 {
     PageClientProtector protector(m_pageClient);
 

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (222032 => 222033)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2017-09-14 17:55:17 UTC (rev 222033)
@@ -395,7 +395,7 @@
     RefPtr<API::Navigation> loadFile(const String& fileURL, const String& resourceDirectoryURL, API::Object* userData = nullptr);
     RefPtr<API::Navigation> loadData(API::Data*, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData = nullptr);
     RefPtr<API::Navigation> loadHTMLString(const String& htmlString, const String& baseURL, API::Object* userData = nullptr);
-    void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL, API::Object* userData = nullptr);
+    void loadAlternateHTMLString(const String& htmlString, const WebCore::URL& baseURL, const WebCore::URL& unreachableURL, API::Object* userData = nullptr);
     void loadPlainTextString(const String&, API::Object* userData = nullptr);
     void loadWebArchiveData(API::Data*, API::Object* userData = nullptr);
     void navigateToPDFLinkWithSimulatedClick(const String& url, WebCore::IntPoint documentPoint, WebCore::IntPoint screenPoint);
@@ -1248,17 +1248,17 @@
     void didCreateMainFrame(uint64_t frameID);
     void didCreateSubframe(uint64_t frameID);
 
-    void didStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& url, const String& unreachableURL, const UserData&);
-    void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String&, const UserData&);
+    void didStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::URL&&, WebCore::URL&& unreachableURL, const UserData&);
+    void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::URL&&, const UserData&);
     void willPerformClientRedirectForFrame(uint64_t frameID, const String& url, double delay);
     void didCancelClientRedirectForFrame(uint64_t frameID);
-    void didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, const String& url);
+    void didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, WebCore::URL&&);
     void didFailProvisionalLoadForFrame(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError&, const UserData&);
     void didCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& mimeType, bool frameHasCustomContentProvider, uint32_t frameLoadType, const WebCore::CertificateInfo&, bool containsPluginDocument, std::optional<WebCore::HasInsecureContent> forcedHasInsecureContent, const UserData&);
     void didFinishDocumentLoadForFrame(uint64_t frameID, uint64_t navigationID, const UserData&);
     void didFinishLoadForFrame(uint64_t frameID, uint64_t navigationID, const UserData&);
     void didFailLoadForFrame(uint64_t frameID, uint64_t navigationID, const WebCore::ResourceError&, const UserData&);
-    void didSameDocumentNavigationForFrame(uint64_t frameID, uint64_t navigationID, uint32_t sameDocumentNavigationType, const String&, const UserData&);
+    void didSameDocumentNavigationForFrame(uint64_t frameID, uint64_t navigationID, uint32_t sameDocumentNavigationType, WebCore::URL&&, const UserData&);
     void didChangeMainDocument(uint64_t frameID);
 
     void didReceiveTitleForFrame(uint64_t frameID, const String&, const UserData&);

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in (222032 => 222033)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in	2017-09-14 17:55:17 UTC (rev 222033)
@@ -115,11 +115,11 @@
     DidCreateSubframe(uint64_t frameID)
 
     # Frame load messages
-    DidStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, String url, String unreachableURL, WebKit::UserData userData)
-    DidReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, String url, WebKit::UserData userData)
+    DidStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::URL url, WebCore::URL unreachableURL, WebKit::UserData userData)
+    DidReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::URL url, WebKit::UserData userData)
     WillPerformClientRedirectForFrame(uint64_t frameID, String url, double delay)
     DidCancelClientRedirectForFrame(uint64_t frameID)
-    DidChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, String url)
+    DidChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, WebCore::URL url)
     DidFailProvisionalLoadForFrame(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, uint64_t navigationID, String provisionalURL, WebCore::ResourceError error, WebKit::UserData userData)
     DidCommitLoadForFrame(uint64_t frameID, uint64_t navigationID, String mimeType, bool hasCustomContentProvider, uint32_t loadType, WebCore::CertificateInfo certificateInfo, bool containsPluginDocument, std::optional<WebCore::HasInsecureContent> forcedHasInsecureContent, WebKit::UserData userData)
     DidFailLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::ResourceError error, WebKit::UserData userData)
@@ -132,7 +132,7 @@
     DidDisplayInsecureContentForFrame(uint64_t frameID, WebKit::UserData userData)
     DidRunInsecureContentForFrame(uint64_t frameID, WebKit::UserData userData)
     DidDetectXSSForFrame(uint64_t frameID, WebKit::UserData userData)
-    DidSameDocumentNavigationForFrame(uint64_t frameID, uint64_t navigationID, uint32_t type, String url, WebKit::UserData userData)
+    DidSameDocumentNavigationForFrame(uint64_t frameID, uint64_t navigationID, uint32_t type, WebCore::URL url, WebKit::UserData userData)
     DidChangeMainDocument(uint64_t frameID);
     DidDestroyNavigation(uint64_t navigationID)
 

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (222032 => 222033)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2017-09-14 17:55:17 UTC (rev 222033)
@@ -279,7 +279,6 @@
         return;
 
     WebDocumentLoader& documentLoader = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().provisionalDocumentLoader());
-    const String& url = ""
     RefPtr<API::Object> userData;
 
     // Notify the bundle client.
@@ -286,7 +285,7 @@
     webPage->injectedBundleLoaderClient().didReceiveServerRedirectForProvisionalLoadForFrame(*webPage, *m_frame, userData);
 
     // Notify the UIProcess.
-    webPage->send(Messages::WebPageProxy::DidReceiveServerRedirectForProvisionalLoadForFrame(m_frame->frameID(), documentLoader.navigationID(), url, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
+    webPage->send(Messages::WebPageProxy::DidReceiveServerRedirectForProvisionalLoadForFrame(m_frame->frameID(), documentLoader.navigationID(), documentLoader.url(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
 }
 
 void WebFrameLoaderClient::dispatchDidChangeProvisionalURL()
@@ -296,7 +295,7 @@
         return;
 
     WebDocumentLoader& documentLoader = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().provisionalDocumentLoader());
-    webPage->send(Messages::WebPageProxy::DidChangeProvisionalURLForFrame(m_frame->frameID(), documentLoader.navigationID(), documentLoader.url().string()));
+    webPage->send(Messages::WebPageProxy::DidChangeProvisionalURLForFrame(m_frame->frameID(), documentLoader.navigationID(), documentLoader.url()));
 }
 
 void WebFrameLoaderClient::dispatchDidCancelClientRedirect()
@@ -339,7 +338,7 @@
     webPage->injectedBundleLoaderClient().didSameDocumentNavigationForFrame(*webPage, *m_frame, SameDocumentNavigationAnchorNavigation, userData);
 
     // Notify the UIProcess.
-    webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), navigationID, SameDocumentNavigationAnchorNavigation, m_frame->coreFrame()->document()->url().string(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
+    webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), navigationID, SameDocumentNavigationAnchorNavigation, m_frame->coreFrame()->document()->url(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
 }
 
 void WebFrameLoaderClient::dispatchDidChangeMainDocument()
@@ -365,7 +364,7 @@
     webPage->injectedBundleLoaderClient().didSameDocumentNavigationForFrame(*webPage, *m_frame, SameDocumentNavigationSessionStatePush, userData);
 
     // Notify the UIProcess.
-    webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), navigationID, SameDocumentNavigationSessionStatePush, m_frame->coreFrame()->document()->url().string(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
+    webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), navigationID, SameDocumentNavigationSessionStatePush, m_frame->coreFrame()->document()->url(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
 }
 
 void WebFrameLoaderClient::dispatchDidReplaceStateWithinPage()
@@ -382,7 +381,7 @@
     webPage->injectedBundleLoaderClient().didSameDocumentNavigationForFrame(*webPage, *m_frame, SameDocumentNavigationSessionStateReplace, userData);
 
     // Notify the UIProcess.
-    webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), navigationID, SameDocumentNavigationSessionStateReplace, m_frame->coreFrame()->document()->url().string(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
+    webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), navigationID, SameDocumentNavigationSessionStateReplace, m_frame->coreFrame()->document()->url(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
 }
 
 void WebFrameLoaderClient::dispatchDidPopStateWithinPage()
@@ -399,7 +398,7 @@
     webPage->injectedBundleLoaderClient().didSameDocumentNavigationForFrame(*webPage, *m_frame, SameDocumentNavigationSessionStatePop, userData);
 
     // Notify the UIProcess.
-    webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), navigationID, SameDocumentNavigationSessionStatePop, m_frame->coreFrame()->document()->url().string(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
+    webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), navigationID, SameDocumentNavigationSessionStatePop, m_frame->coreFrame()->document()->url(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
 }
 
 void WebFrameLoaderClient::dispatchWillClose()
@@ -423,13 +422,13 @@
     webPage->sandboxExtensionTracker().didStartProvisionalLoad(m_frame);
 
     WebDocumentLoader& provisionalLoader = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().provisionalDocumentLoader());
-    const String& url = ""
+    auto& url = ""
     RefPtr<API::Object> userData;
 
     // Notify the bundle client.
     webPage->injectedBundleLoaderClient().didStartProvisionalLoadForFrame(*webPage, *m_frame, userData);
 
-    String unreachableURL = provisionalLoader.unreachableURL().string();
+    auto& unreachableURL = provisionalLoader.unreachableURL();
 
     // Notify the UIProcess.
     webPage->send(Messages::WebPageProxy::DidStartProvisionalLoadForFrame(m_frame->frameID(), provisionalLoader.navigationID(), url, unreachableURL, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (222032 => 222033)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2017-09-14 17:55:17 UTC (rev 222033)
@@ -1176,13 +1176,13 @@
     send(Messages::WebPageProxy::ClosePage(false));
 }
 
-void WebPage::loadURLInFrame(const String& url, uint64_t frameID)
+void WebPage::loadURLInFrame(WebCore::URL&& url, uint64_t frameID)
 {
     WebFrame* frame = WebProcess::singleton().webFrame(frameID);
     if (!frame)
         return;
 
-    frame->coreFrame()->loader().load(FrameLoadRequest(*frame->coreFrame(), ResourceRequest(URL(URL(), url)), ShouldOpenExternalURLsPolicy::ShouldNotAllow));
+    frame->coreFrame()->loader().load(FrameLoadRequest(*frame->coreFrame(), ResourceRequest(url), ShouldOpenExternalURLsPolicy::ShouldNotAllow));
 }
 
 #if !PLATFORM(COCOA)

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (222032 => 222033)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2017-09-14 17:55:17 UTC (rev 222033)
@@ -1095,7 +1095,7 @@
     static bool scroll(WebCore::Page*, WebCore::ScrollDirection, WebCore::ScrollGranularity);
     static bool logicalScroll(WebCore::Page*, WebCore::ScrollLogicalDirection, WebCore::ScrollGranularity);
 
-    void loadURLInFrame(const String&, uint64_t frameID);
+    void loadURLInFrame(WebCore::URL&&, uint64_t frameID);
 
     enum class WasRestoredByAPIRequest { No, Yes };
     void restoreSessionInternal(const Vector<BackForwardListItemState>&, WasRestoredByAPIRequest);

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (222032 => 222033)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2017-09-14 17:55:17 UTC (rev 222033)
@@ -132,7 +132,7 @@
     GoToBackForwardItem(uint64_t navigationID, uint64_t backForwardItemID)
     TryRestoreScrollPosition()
 
-    LoadURLInFrame(String url, uint64_t frameID)
+    LoadURLInFrame(WebCore::URL url, uint64_t frameID)
     LoadRequest(struct WebKit::LoadParameters loadParameters)
     LoadData(struct WebKit::LoadParameters loadParameters)
     LoadString(struct WebKit::LoadParameters loadParameters)

Modified: trunk/Tools/ChangeLog (222032 => 222033)


--- trunk/Tools/ChangeLog	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Tools/ChangeLog	2017-09-14 17:55:17 UTC (rev 222033)
@@ -1,3 +1,23 @@
+2017-09-14  Alex Christensen  <achristen...@webkit.org>
+
+        Add WKUIDelegatePrivate equivalent of WKPageUIClient's drawHeader, drawFooter, headerHeight, and footerHeight
+        https://bugs.webkit.org/show_bug.cgi?id=176889
+        <rdar://problem/29270035>
+
+        Reviewed by Andy Estes.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:
+        (-[PrintDelegate _webView:printFrame:]):
+        (-[PrintDelegate _webViewHeaderHeight:]):
+        (-[PrintDelegate _webViewFooterHeight:]):
+        (-[PrintDelegate _webView:drawHeaderInRect:forPageWithTitle:URL:]):
+        (-[PrintDelegate _webView:drawFooterInRect:forPageWithTitle:URL:]):
+        (callbacksEqual):
+        (TEST):
+        * TestWebKitAPI/cocoa/TestWKWebView.h:
+        * TestWebKitAPI/cocoa/TestWKWebView.mm:
+        (-[TestWKWebView hostWindow]):
+
 2017-09-14  Carlos Alberto Lopez Perez  <clo...@igalia.com>
 
         [GTK] Add a switch to start the mini-browser in full-screen mode

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm (222032 => 222033)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm	2017-09-14 17:55:17 UTC (rev 222033)
@@ -41,6 +41,7 @@
 #import <WebKit/WKWebViewPrivate.h>
 #import <WebKit/_WKHitTestResult.h>
 #import <wtf/RetainPtr.h>
+#import <wtf/Vector.h>
 
 #if PLATFORM(MAC)
 #import <Carbon/Carbon.h>
@@ -282,6 +283,93 @@
     TestWebKitAPI::Util::run(&done);
 }
 
+enum class Callback {
+    HeaderHeight,
+    FooterHeight,
+    DrawHeader,
+    DrawFooter,
+};
+
+static Vector<Callback> callbacks;
+
+@interface PrintDelegate : NSObject <WKUIDelegatePrivate>
+@end
+
+@implementation PrintDelegate
+
+- (void)_webView:(WKWebView *)webView printFrame:(_WKFrameHandle *)frame
+{
+    done = true;
+}
+
+- (CGFloat)_webViewHeaderHeight:(WKWebView *)webView
+{
+    callbacks.append(Callback::HeaderHeight);
+    return 3.14159;
+}
+
+- (CGFloat)_webViewFooterHeight:(WKWebView *)webView
+{
+    callbacks.append(Callback::FooterHeight);
+    return 2.71828;
+}
+
+- (void)_webView:(WKWebView *)webView drawHeaderInRect:(CGRect)rect forPageWithTitle:(NSString *)title URL:(NSURL *)url
+{
+    EXPECT_EQ(rect.origin.x, 72);
+    EXPECT_TRUE(fabs(rect.origin.y - 698.858398) < .00001);
+    EXPECT_TRUE(fabs(rect.size.height - 3.141590) < .00001);
+    EXPECT_EQ(rect.size.width, 468.000000);
+    EXPECT_STREQ(title.UTF8String, "test_title");
+    EXPECT_STREQ(url.absoluteString.UTF8String, "http://example.com/");
+    callbacks.append(Callback::DrawHeader);
+}
+
+- (void)_webView:(WKWebView *)webView drawFooterInRect:(CGRect)rect forPageWithTitle:(NSString *)title URL:(NSURL *)url
+{
+    EXPECT_EQ(rect.origin.x, 72);
+    EXPECT_EQ(rect.origin.y, 90);
+    EXPECT_TRUE(fabs(rect.size.height - 2.718280) < .00001);
+    EXPECT_EQ(rect.size.width, 468.000000);
+    EXPECT_STREQ(url.absoluteString.UTF8String, "http://example.com/");
+    callbacks.append(Callback::DrawFooter);
+    const size_t expectedFinalCallbackSize = 39;
+    if (callbacks.size() == expectedFinalCallbackSize)
+        done = true;
+}
+
+@end
+
+bool callbacksEqual(const Vector<Callback> a, const Vector<Callback> b)
+{
+    if (a.size() != b.size())
+        return false;
+    for (size_t i = 0; i < a.size(); ++i) {
+        if (a[i] != b[i])
+            return false;
+    }
+    return true;
+}
+
+TEST(WebKit, PrintFrame)
+{
+    auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
+    auto delegate = adoptNS([[PrintDelegate alloc] init]);
+    [webView setUIDelegate:delegate.get()];
+    [webView loadHTMLString:@"<head><title>test_title</title></head><body _onload_='print()'>hello world!</body>" baseURL:[NSURL URLWithString:@"http://example.com/"]];
+    TestWebKitAPI::Util::run(&done);
+
+    done = false;
+    NSPrintOperation *operation = [webView _printOperationWithPrintInfo:[NSPrintInfo sharedPrintInfo]];
+    EXPECT_TRUE(operation.canSpawnSeparateThread);
+    EXPECT_STREQ(operation.jobTitle.UTF8String, "test_title");
+
+    [operation runOperationModalForWindow:[webView hostWindow] delegate:nil didRunSelector:nil contextInfo:nil];
+    TestWebKitAPI::Util::run(&done);
+
+    EXPECT_TRUE(callbacksEqual(callbacks, { Callback::HeaderHeight, Callback::FooterHeight, Callback::HeaderHeight, Callback::FooterHeight, Callback::HeaderHeight, Callback::FooterHeight, Callback::HeaderHeight, Callback::FooterHeight, Callback::HeaderHeight, Callback::FooterHeight, Callback::HeaderHeight, Callback::FooterHeight, Callback::HeaderHeight, Callback::FooterHeight, Callback::HeaderHeight, Callback::FooterHeight, Callback::HeaderHeight, Callback::FooterHeight, Callback::HeaderHeight, Callback::FooterHeight, Callback::FooterHeight, Callback::FooterHeight, Callback::HeaderHeight, Callback::DrawHeader, Callback::DrawFooter, Callback::HeaderHeight, Callback::FooterHeight, Callback::FooterHeight, Callback::FooterHeight, Callback::HeaderHeight, Callback::DrawHeader, Callback::DrawFooter, Callback::HeaderHeight, Callback::FooterHeight, Callback::FooterHeight, Callback::FooterHeight, Callback::HeaderHeight, Callback::DrawHeader, Callback::DrawFooter }));
+}
+
 @interface NotificationDelegate : NSObject <WKUIDelegatePrivate> {
     bool _allowNotifications;
 }

Modified: trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h (222032 => 222033)


--- trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h	2017-09-14 17:55:17 UTC (rev 222033)
@@ -66,6 +66,7 @@
 - (void)mouseMoveToPoint:(NSPoint)point withFlags:(NSEventModifierFlags)flags;
 - (void)sendClicksAtPoint:(NSPoint)point numberOfClicks:(NSUInteger)numberOfClicks;
 - (void)typeCharacter:(char)character;
+- (NSWindow *)hostWindow;
 @end
 #endif
 

Modified: trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm (222032 => 222033)


--- trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm	2017-09-14 17:53:18 UTC (rev 222032)
+++ trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm	2017-09-14 17:55:17 UTC (rev 222033)
@@ -349,6 +349,11 @@
     }
 }
 
+- (NSWindow *)hostWindow
+{
+    return _hostWindow.get();
+}
+
 - (void)typeCharacter:(char)character {
     NSString *characterAsString = [NSString stringWithFormat:@"%c" , character];
     NSEventType keyDownEventType = NSEventTypeKeyDown;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to