Changeset 222033 in webkit
- Timestamp:
- Sep 14, 2017, 10:55:17 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r222027 r222033 1 2017-09-14 Alex Christensen <achristensen@webkit.org> 2 3 Add WKUIDelegatePrivate equivalent of WKPageUIClient's drawHeader, drawFooter, headerHeight, and footerHeight 4 https://bugs.webkit.org/show_bug.cgi?id=176889 5 <rdar://problem/29270035> 6 7 Reviewed by Andy Estes. 8 9 * UIProcess/API/C/WKPage.cpp: 10 (WKPageLoadAlternateHTMLString): 11 (WKPageLoadAlternateHTMLStringWithUserData): 12 * UIProcess/API/Cocoa/WKBrowsingContextController.mm: 13 (-[WKBrowsingContextController loadAlternateHTMLString:baseURL:forUnreachableURL:]): 14 * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: 15 * UIProcess/API/Cocoa/WKWebView.mm: 16 (-[WKWebView _loadAlternateHTMLString:baseURL:forUnreachableURL:]): 17 * UIProcess/Cocoa/UIDelegate.h: 18 * UIProcess/Cocoa/UIDelegate.mm: 19 (WebKit::UIDelegate::setDelegate): 20 (WebKit::UIDelegate::UIClient::headerHeight): 21 (WebKit::UIDelegate::UIClient::footerHeight): 22 (WebKit::UIDelegate::UIClient::drawHeader): 23 (WebKit::UIDelegate::UIClient::drawFooter): 24 * UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm: 25 (-[WKReloadFrameErrorRecoveryAttempter attemptRecovery]): 26 * UIProcess/Cocoa/WebViewImpl.mm: 27 (WebKit::WebViewImpl::printOperationWithPrintInfo): 28 * UIProcess/FrameLoadState.cpp: 29 (WebKit::FrameLoadState::didStartProvisionalLoad): 30 (WebKit::FrameLoadState::didReceiveServerRedirectForProvisionalLoad): 31 (WebKit::FrameLoadState::didFailProvisionalLoad): 32 (WebKit::FrameLoadState::didCommitLoad): 33 (WebKit::FrameLoadState::didSameDocumentNotification): 34 (WebKit::FrameLoadState::setUnreachableURL): 35 (WebKit::FrameLoadState::FrameLoadState): Deleted. 36 * UIProcess/FrameLoadState.h: 37 (WebKit::FrameLoadState::url const): 38 (WebKit::FrameLoadState::provisionalURL const): 39 (WebKit::FrameLoadState::unreachableURL const): 40 * UIProcess/WebFrameProxy.cpp: 41 (WebKit::WebFrameProxy::loadURL): 42 (WebKit::WebFrameProxy::didStartProvisionalLoad): 43 (WebKit::WebFrameProxy::didReceiveServerRedirectForProvisionalLoad): 44 (WebKit::WebFrameProxy::didSameDocumentNavigation): 45 (WebKit::WebFrameProxy::setUnreachableURL): 46 * UIProcess/WebFrameProxy.h: 47 (WebKit::WebFrameProxy::url const): 48 (WebKit::WebFrameProxy::provisionalURL const): 49 (WebKit::WebFrameProxy::unreachableURL const): 50 * UIProcess/WebPageProxy.cpp: 51 (WebKit::WebPageProxy::loadAlternateHTMLString): 52 (WebKit::WebPageProxy::didStartProvisionalLoadForFrame): 53 (WebKit::WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame): 54 (WebKit::WebPageProxy::didChangeProvisionalURLForFrame): 55 (WebKit::WebPageProxy::didSameDocumentNavigationForFrame): 56 * UIProcess/WebPageProxy.h: 57 * UIProcess/WebPageProxy.messages.in: 58 * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: 59 (WebKit::WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad): 60 (WebKit::WebFrameLoaderClient::dispatchDidChangeProvisionalURL): 61 (WebKit::WebFrameLoaderClient::dispatchDidChangeLocationWithinPage): 62 (WebKit::WebFrameLoaderClient::dispatchDidPushStateWithinPage): 63 (WebKit::WebFrameLoaderClient::dispatchDidReplaceStateWithinPage): 64 (WebKit::WebFrameLoaderClient::dispatchDidPopStateWithinPage): 65 (WebKit::WebFrameLoaderClient::dispatchDidStartProvisionalLoad): 66 * WebProcess/WebPage/WebPage.cpp: 67 (WebKit::WebPage::loadURLInFrame): 68 * WebProcess/WebPage/WebPage.h: 69 * WebProcess/WebPage/WebPage.messages.in: 70 1 71 2017-09-14 Carlos Garcia Campos <cgarcia@igalia.com> 2 72 -
trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp
r221982 r222033 210 210 void WKPageLoadAlternateHTMLString(WKPageRef pageRef, WKStringRef htmlStringRef, WKURLRef baseURLRef, WKURLRef unreachableURLRef) 211 211 { 212 toImpl(pageRef)->loadAlternateHTMLString(toWTFString(htmlStringRef), toWTFString(baseURLRef), toWTFString(unreachableURLRef));212 toImpl(pageRef)->loadAlternateHTMLString(toWTFString(htmlStringRef), URL(URL(), toWTFString(baseURLRef)), URL(URL(), toWTFString(unreachableURLRef))); 213 213 } 214 214 215 215 void WKPageLoadAlternateHTMLStringWithUserData(WKPageRef pageRef, WKStringRef htmlStringRef, WKURLRef baseURLRef, WKURLRef unreachableURLRef, WKTypeRef userDataRef) 216 216 { 217 toImpl(pageRef)->loadAlternateHTMLString(toWTFString(htmlStringRef), toWTFString(baseURLRef), toWTFString(unreachableURLRef), toImpl(userDataRef));217 toImpl(pageRef)->loadAlternateHTMLString(toWTFString(htmlStringRef), URL(URL(), toWTFString(baseURLRef)), URL(URL(), toWTFString(unreachableURLRef)), toImpl(userDataRef)); 218 218 } 219 219 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKBrowsingContextController.mm
r214113 r222033 158 158 - (void)loadAlternateHTMLString:(NSString *)string baseURL:(NSURL *)baseURL forUnreachableURL:(NSURL *)unreachableURL 159 159 { 160 _page->loadAlternateHTMLString(string, [baseURL _web_originalDataAsWTFString], [unreachableURL _web_originalDataAsWTFString]);160 _page->loadAlternateHTMLString(string, baseURL, unreachableURL); 161 161 } 162 162 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h
r221982 r222033 162 162 - (void)_webView:(WKWebView *)webView getToolbarsAreVisibleWithCompletionHandler:(void(^)(BOOL))completionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 163 163 - (void)_webView:(WKWebView *)webView saveDataToFile:(NSData *)data suggestedFilename:(NSString *)suggestedFilename mimeType:(NSString *)mimeType originatingURL:(NSURL *)url WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 164 - (CGFloat)_webViewHeaderHeight:(WKWebView *)webView WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 165 - (CGFloat)_webViewFooterHeight:(WKWebView *)webView WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 166 - (void)_webView:(WKWebView *)webView drawHeaderInRect:(CGRect)rect forPageWithTitle:(NSString *)title URL:(NSURL *)url WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 167 - (void)_webView:(WKWebView *)webView drawFooterInRect:(CGRect)rect forPageWithTitle:(NSString *)title URL:(NSURL *)url WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 164 168 - (void)_webView:(WKWebView *)webView requestNotificationPermissionForSecurityOrigin:(WKSecurityOrigin *)securityOrigin decisionHandler:(void (^)(BOOL))decisionHandler WK_API_AVAILABLE(macosx(WK_MAC_TBA)); 165 169 - (void)_webView:(WKWebView *)webview mouseDidMoveOverElement:(_WKHitTestResult *)hitTestResult withFlags:(NSEventModifierFlags)flags userInfo:(id <NSSecureCoding>)userInfo; -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
r221934 r222033 3840 3840 - (void)_loadAlternateHTMLString:(NSString *)string baseURL:(NSURL *)baseURL forUnreachableURL:(NSURL *)unreachableURL 3841 3841 { 3842 _page->loadAlternateHTMLString(string, [baseURL _web_originalDataAsWTFString], [unreachableURL _web_originalDataAsWTFString]);3842 _page->loadAlternateHTMLString(string, baseURL, unreachableURL); 3843 3843 } 3844 3844 -
trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp
r221847 r222033 66 66 #include <WebCore/JSDOMExceptionHandling.h> 67 67 #include <WebCore/RefPtrCairo.h> 68 #include <WebCore/URL.h> 68 69 #include <glib/gi18n-lib.h> 69 70 #include <wtf/SetForScope.h> … … 2492 2493 g_return_if_fail(contentURI); 2493 2494 2494 getPage(webView).loadAlternateHTMLString(String::fromUTF8(content), String::fromUTF8(baseURI), String::fromUTF8(contentURI));2495 getPage(webView).loadAlternateHTMLString(String::fromUTF8(content), URL(URL(), String::fromUTF8(baseURI)), URL(URL(), String::fromUTF8(contentURI))); 2495 2496 } 2496 2497 … … 2628 2629 g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); 2629 2630 2630 getPage(webView).reload( WebCore::ReloadOption::FromOrigin);2631 getPage(webView).reload(ReloadOption::FromOrigin); 2631 2632 } 2632 2633 … … 3156 3157 } 3157 3158 3158 static void webkitWebViewRunJavaScriptCallback(API::SerializedScriptValue* wkSerializedScriptValue, const WebCore::ExceptionDetails& exceptionDetails, GTask* task)3159 static void webkitWebViewRunJavaScriptCallback(API::SerializedScriptValue* wkSerializedScriptValue, const ExceptionDetails& exceptionDetails, GTask* task) 3159 3160 { 3160 3161 if (g_task_return_error_if_cancelled(task)) … … 3207 3208 3208 3209 GTask* task = g_task_new(webView, cancellable, callback, userData); 3209 getPage(webView).runJavaScriptInMainFrame(String::fromUTF8(script), true, [task](API::SerializedScriptValue* serializedScriptValue, bool, const WebCore::ExceptionDetails& exceptionDetails, WebKit::CallbackBase::Error) {3210 getPage(webView).runJavaScriptInMainFrame(String::fromUTF8(script), true, [task](API::SerializedScriptValue* serializedScriptValue, bool, const ExceptionDetails& exceptionDetails, WebKit::CallbackBase::Error) { 3210 3211 webkitWebViewRunJavaScriptCallback(serializedScriptValue, exceptionDetails, adoptGRef(task).get()); 3211 3212 }); … … 3298 3299 gpointer outputStreamData = g_memory_output_stream_get_data(G_MEMORY_OUTPUT_STREAM(object)); 3299 3300 getPage(webView).runJavaScriptInMainFrame(String::fromUTF8(reinterpret_cast<const gchar*>(outputStreamData)), true, 3300 [task](API::SerializedScriptValue* serializedScriptValue, bool, const WebCore::ExceptionDetails& exceptionDetails, WebKit::CallbackBase::Error) {3301 [task](API::SerializedScriptValue* serializedScriptValue, bool, const ExceptionDetails& exceptionDetails, WebKit::CallbackBase::Error) { 3301 3302 webkitWebViewRunJavaScriptCallback(serializedScriptValue, exceptionDetails, task.get()); 3302 3303 }); -
trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h
r221982 r222033 106 106 void windowFrame(WebPageProxy&, Function<void(WebCore::FloatRect)>&&) final; 107 107 void didNotHandleWheelEvent(WebPageProxy*, const NativeWebWheelEvent&) final; 108 float headerHeight(WebPageProxy&, WebFrameProxy&) final; 109 float footerHeight(WebPageProxy&, WebFrameProxy&) final; 110 void drawHeader(WebPageProxy&, WebFrameProxy&, WebCore::FloatRect&&) final; 111 void drawFooter(WebPageProxy&, WebFrameProxy&, WebCore::FloatRect&&) final; 108 112 void decidePolicyForNotificationPermissionRequest(WebPageProxy&, API::SecurityOrigin&, Function<void(bool)>&&) final; 109 113 void handleAutoplayEvent(WebPageProxy&, WebCore::AutoplayEvent, OptionSet<WebCore::AutoplayEventFlags>) final; … … 161 165 bool webViewTakeFocus : 1; 162 166 bool webViewDidScroll : 1; 167 bool webViewHeaderHeight : 1; 168 bool webViewFooterHeight : 1; 163 169 bool webViewSetResizable : 1; 164 170 bool webViewSetWindowFrame : 1; … … 167 173 bool webViewUnavailablePlugInButtonClicked : 1; 168 174 bool webViewDidClickAutoFillButtonWithUserInfo : 1; 175 bool webViewDrawHeaderInRectForPageWithTitleURL : 1; 176 bool webViewDrawFooterInRectForPageWithTitleURL : 1; 169 177 bool webViewGetWindowFrameWithCompletionHandler : 1; 170 178 bool webViewMouseDidMoveOverElementWithFlagsUserInfo : 1; -
trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm
r221982 r222033 121 121 m_delegateMethods.webViewHandleAutoplayEventWithFlags = [delegate respondsToSelector:@selector(_webView:handleAutoplayEvent:withFlags:)]; 122 122 m_delegateMethods.webViewDidClickAutoFillButtonWithUserInfo = [delegate respondsToSelector:@selector(_webView:didClickAutoFillButtonWithUserInfo:)]; 123 m_delegateMethods.webViewDrawHeaderInRectForPageWithTitleURL = [delegate respondsToSelector:@selector(_webView:drawHeaderInRect:forPageWithTitle:URL:)]; 124 m_delegateMethods.webViewDrawFooterInRectForPageWithTitleURL = [delegate respondsToSelector:@selector(_webView:drawFooterInRect:forPageWithTitle:URL:)]; 125 m_delegateMethods.webViewHeaderHeight = [delegate respondsToSelector:@selector(_webViewHeaderHeight:)]; 126 m_delegateMethods.webViewFooterHeight = [delegate respondsToSelector:@selector(_webViewFooterHeight:)]; 123 127 m_delegateMethods.webViewMouseDidMoveOverElementWithFlagsUserInfo = [delegate respondsToSelector:@selector(_webView:mouseDidMoveOverElement:withFlags:userInfo:)]; 124 128 m_delegateMethods.webViewDidExceedBackgroundResourceLimitWhileInForeground = [delegate respondsToSelector:@selector(_webView:didExceedBackgroundResourceLimitWhileInForeground:)]; … … 422 426 423 427 [(id <WKUIDelegatePrivate>)delegate _webViewRunModal:m_uiDelegate.m_webView]; 428 } 429 430 float UIDelegate::UIClient::headerHeight(WebPageProxy&, WebFrameProxy& webFrameProxy) 431 { 432 if (!m_uiDelegate.m_delegateMethods.webViewHeaderHeight) 433 return 0; 434 435 auto delegate = m_uiDelegate.m_delegate.get(); 436 if (!delegate) 437 return 0; 438 439 return [(id <WKUIDelegatePrivate>)delegate _webViewHeaderHeight:m_uiDelegate.m_webView]; 440 } 441 442 float UIDelegate::UIClient::footerHeight(WebPageProxy&, WebFrameProxy&) 443 { 444 if (!m_uiDelegate.m_delegateMethods.webViewFooterHeight) 445 return 0; 446 447 auto delegate = m_uiDelegate.m_delegate.get(); 448 if (!delegate) 449 return 0; 450 451 return [(id <WKUIDelegatePrivate>)delegate _webViewFooterHeight:m_uiDelegate.m_webView]; 452 } 453 454 void UIDelegate::UIClient::drawHeader(WebPageProxy&, WebFrameProxy& frame, WebCore::FloatRect&& rect) 455 { 456 if (!m_uiDelegate.m_delegateMethods.webViewDrawHeaderInRectForPageWithTitleURL) 457 return; 458 459 auto delegate = m_uiDelegate.m_delegate.get(); 460 if (!delegate) 461 return; 462 463 [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView drawHeaderInRect:rect forPageWithTitle:frame.title() URL:frame.url()]; 464 } 465 466 void UIDelegate::UIClient::drawFooter(WebPageProxy&, WebFrameProxy& frame, WebCore::FloatRect&& rect) 467 { 468 if (!m_uiDelegate.m_delegateMethods.webViewDrawFooterInRectForPageWithTitleURL) 469 return; 470 471 auto delegate = m_uiDelegate.m_delegate.get(); 472 if (!delegate) 473 return; 474 475 [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView drawFooterInRect:rect forPageWithTitle:frame.title() URL:frame.url()]; 424 476 } 425 477 -
trunk/Source/WebKit/UIProcess/Cocoa/WKReloadFrameErrorRecoveryAttempter.mm
r167633 r222033 70 70 return NO; 71 71 72 webFrameProxy->loadURL( _urlString);72 webFrameProxy->loadURL(WebCore::URL(WebCore::URL(), _urlString)); 73 73 return YES; 74 74 } -
trunk/Source/WebKit/UIProcess/Cocoa/WebViewImpl.mm
r221887 r222033 1625 1625 NSPrintOperation *WebViewImpl::printOperationWithPrintInfo(NSPrintInfo *printInfo, WebFrameProxy& frame) 1626 1626 { 1627 LOG(Printing, "Creating an NSPrintOperation for frame '%s'", frame.url(). utf8().data());1627 LOG(Printing, "Creating an NSPrintOperation for frame '%s'", frame.url().string().utf8().data()); 1628 1628 1629 1629 // FIXME: If the frame cannot be printed (e.g. if it contains an encrypted PDF that disallows -
trunk/Source/WebKit/UIProcess/FrameLoadState.cpp
r159439 r222033 29 29 namespace WebKit { 30 30 31 FrameLoadState::FrameLoadState()32 : m_state(State::Finished)33 {34 }35 36 31 FrameLoadState::~FrameLoadState() 37 32 { 38 33 } 39 34 40 void FrameLoadState::didStartProvisionalLoad(const String& url)35 void FrameLoadState::didStartProvisionalLoad(const WebCore::URL& url) 41 36 { 42 37 ASSERT(m_provisionalURL.isEmpty()); … … 46 41 } 47 42 48 void FrameLoadState::didReceiveServerRedirectForProvisionalLoad(const String& url)43 void FrameLoadState::didReceiveServerRedirectForProvisionalLoad(const WebCore::URL& url) 49 44 { 50 45 ASSERT(m_state == State::Provisional); … … 58 53 59 54 m_state = State::Finished; 60 m_provisionalURL = String();55 m_provisionalURL = { }; 61 56 m_unreachableURL = m_lastUnreachableURL; 62 57 } … … 68 63 m_state = State::Committed; 69 64 m_url = m_provisionalURL; 70 m_provisionalURL = String();65 m_provisionalURL = { }; 71 66 } 72 67 … … 87 82 } 88 83 89 void FrameLoadState::didSameDocumentNotification(const String& url)84 void FrameLoadState::didSameDocumentNotification(const WebCore::URL& url) 90 85 { 91 86 m_url = url; 92 87 } 93 88 94 void FrameLoadState::setUnreachableURL(const String& unreachableURL)89 void FrameLoadState::setUnreachableURL(const WebCore::URL& unreachableURL) 95 90 { 96 91 m_lastUnreachableURL = m_unreachableURL; -
trunk/Source/WebKit/UIProcess/FrameLoadState.h
r183813 r222033 24 24 */ 25 25 26 #ifndef FrameLoadState_h 27 #define FrameLoadState_h 26 #pragma once 28 27 29 #include < wtf/text/WTFString.h>28 #include <WebCore/URL.h> 30 29 31 30 namespace WebKit { … … 33 32 class FrameLoadState { 34 33 public: 35 FrameLoadState();36 34 ~FrameLoadState(); 37 35 … … 42 40 }; 43 41 44 void didStartProvisionalLoad(const String& url);45 void didReceiveServerRedirectForProvisionalLoad(const String& url);42 void didStartProvisionalLoad(const WebCore::URL&); 43 void didReceiveServerRedirectForProvisionalLoad(const WebCore::URL&); 46 44 void didFailProvisionalLoad(); 47 45 … … 50 48 void didFailLoad(); 51 49 52 void didSameDocumentNotification(const String&);50 void didSameDocumentNotification(const WebCore::URL&); 53 51 54 52 State state() const { return m_state; } 55 const String& url() const { return m_url; }56 const String& provisionalURL() const { return m_provisionalURL; }53 const WebCore::URL& url() const { return m_url; } 54 const WebCore::URL& provisionalURL() const { return m_provisionalURL; } 57 55 58 void setUnreachableURL(const String&);59 const String& unreachableURL() const { return m_unreachableURL; }56 void setUnreachableURL(const WebCore::URL&); 57 const WebCore::URL& unreachableURL() const { return m_unreachableURL; } 60 58 61 59 private: 62 State m_state ;63 Stringm_url;64 Stringm_provisionalURL;65 Stringm_unreachableURL;66 Stringm_lastUnreachableURL;60 State m_state { State::Finished }; 61 WebCore::URL m_url; 62 WebCore::URL m_provisionalURL; 63 WebCore::URL m_unreachableURL; 64 WebCore::URL m_lastUnreachableURL; 67 65 }; 68 66 69 67 } // namespace WebKit 70 71 #endif // FrameLoadState_h -
trunk/Source/WebKit/UIProcess/WebFrameProxy.cpp
r214113 r222033 77 77 } 78 78 79 void WebFrameProxy::loadURL(const String& url)79 void WebFrameProxy::loadURL(const URL& url) 80 80 { 81 81 if (!m_page) … … 131 131 } 132 132 133 void WebFrameProxy::didStartProvisionalLoad(const String& url)133 void WebFrameProxy::didStartProvisionalLoad(const URL& url) 134 134 { 135 135 m_frameLoadState.didStartProvisionalLoad(url); 136 136 } 137 137 138 void WebFrameProxy::didReceiveServerRedirectForProvisionalLoad(const String& url)138 void WebFrameProxy::didReceiveServerRedirectForProvisionalLoad(const URL& url) 139 139 { 140 140 m_frameLoadState.didReceiveServerRedirectForProvisionalLoad(url); … … 167 167 } 168 168 169 void WebFrameProxy::didSameDocumentNavigation(const String& url)169 void WebFrameProxy::didSameDocumentNavigation(const URL& url) 170 170 { 171 171 m_frameLoadState.didSameDocumentNotification(url); … … 177 177 } 178 178 179 void WebFrameProxy::receivedPolicyDecision( WebCore::PolicyAction action, uint64_t listenerID, API::Navigation* navigation, const WebsitePolicies& websitePolicies)179 void WebFrameProxy::receivedPolicyDecision(PolicyAction action, uint64_t listenerID, API::Navigation* navigation, const WebsitePolicies& websitePolicies) 180 180 { 181 181 if (!m_page) … … 233 233 } 234 234 235 void WebFrameProxy::setUnreachableURL(const String& unreachableURL)235 void WebFrameProxy::setUnreachableURL(const URL& unreachableURL) 236 236 { 237 237 m_frameLoadState.setUnreachableURL(unreachableURL); … … 239 239 240 240 #if ENABLE(CONTENT_FILTERING) 241 bool WebFrameProxy::didHandleContentFilterUnblockNavigation(const WebCore::ResourceRequest& request)241 bool WebFrameProxy::didHandleContentFilterUnblockNavigation(const ResourceRequest& request) 242 242 { 243 243 if (!m_contentFilterUnblockHandler.canHandleRequest(request)) { -
trunk/Source/WebKit/UIProcess/WebFrameProxy.h
r216473 r222033 78 78 FrameLoadState& frameLoadState() { return m_frameLoadState; } 79 79 80 void loadURL(const String&);80 void loadURL(const WebCore::URL&); 81 81 void stopLoading() const; 82 82 83 const String& url() const { return m_frameLoadState.url(); }84 const String& provisionalURL() const { return m_frameLoadState.provisionalURL(); }83 const WebCore::URL& url() const { return m_frameLoadState.url(); } 84 const WebCore::URL& provisionalURL() const { return m_frameLoadState.provisionalURL(); } 85 85 86 void setUnreachableURL(const String&);87 const String& unreachableURL() const { return m_frameLoadState.unreachableURL(); }86 void setUnreachableURL(const WebCore::URL&); 87 const WebCore::URL& unreachableURL() const { return m_frameLoadState.unreachableURL(); } 88 88 89 89 const String& mimeType() const { return m_MIMEType; } … … 106 106 void getResourceData(API::URL*, Function<void (API::Data*, CallbackBase::Error)>&&); 107 107 108 void didStartProvisionalLoad(const String& url);109 void didReceiveServerRedirectForProvisionalLoad(const String& url);108 void didStartProvisionalLoad(const WebCore::URL&); 109 void didReceiveServerRedirectForProvisionalLoad(const WebCore::URL&); 110 110 void didFailProvisionalLoad(); 111 111 void didCommitLoad(const String& contentType, WebCertificateInfo&, bool containsPluginDocument); 112 112 void didFinishLoad(); 113 113 void didFailLoad(); 114 void didSameDocumentNavigation(const String&); // eg. anchor navigation, session state change.114 void didSameDocumentNavigation(const WebCore::URL&); // eg. anchor navigation, session state change. 115 115 void didChangeTitle(const String&); 116 116 -
trunk/Source/WebKit/UIProcess/WebPageProxy.cpp
r221982 r222033 962 962 } 963 963 964 void WebPageProxy::loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL, API::Object* userData)964 void WebPageProxy::loadAlternateHTMLString(const String& htmlString, const WebCore::URL& baseURL, const WebCore::URL& unreachableURL, API::Object* userData) 965 965 { 966 966 // When the UIProcess is in the process of handling a failing provisional load, do not attempt to … … 3147 3147 } 3148 3148 3149 void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& url, const String& unreachableURL, const UserData& userData)3149 void WebPageProxy::didStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::URL&& url, WebCore::URL&& unreachableURL, const UserData& userData) 3150 3150 { 3151 3151 PageClientProtector protector(m_pageClient); … … 3181 3181 } 3182 3182 3183 void WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& url, const UserData& userData)3183 void WebPageProxy::didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::URL&& url, const UserData& userData) 3184 3184 { 3185 3185 PageClientProtector protector(m_pageClient); … … 3235 3235 } 3236 3236 3237 void WebPageProxy::didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t, const String& url)3237 void WebPageProxy::didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t, WebCore::URL&& url) 3238 3238 { 3239 3239 PageClientProtector protector(m_pageClient); … … 3483 3483 } 3484 3484 3485 void WebPageProxy::didSameDocumentNavigationForFrame(uint64_t frameID, uint64_t navigationID, uint32_t opaqueSameDocumentNavigationType, const String& url, const UserData& userData)3485 void WebPageProxy::didSameDocumentNavigationForFrame(uint64_t frameID, uint64_t navigationID, uint32_t opaqueSameDocumentNavigationType, WebCore::URL&& url, const UserData& userData) 3486 3486 { 3487 3487 PageClientProtector protector(m_pageClient); -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r221982 r222033 396 396 RefPtr<API::Navigation> loadData(API::Data*, const String& MIMEType, const String& encoding, const String& baseURL, API::Object* userData = nullptr); 397 397 RefPtr<API::Navigation> loadHTMLString(const String& htmlString, const String& baseURL, API::Object* userData = nullptr); 398 void loadAlternateHTMLString(const String& htmlString, const String& baseURL, const String& unreachableURL, API::Object* userData = nullptr);398 void loadAlternateHTMLString(const String& htmlString, const WebCore::URL& baseURL, const WebCore::URL& unreachableURL, API::Object* userData = nullptr); 399 399 void loadPlainTextString(const String&, API::Object* userData = nullptr); 400 400 void loadWebArchiveData(API::Data*, API::Object* userData = nullptr); … … 1249 1249 void didCreateSubframe(uint64_t frameID); 1250 1250 1251 void didStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String& url, const String& unreachableURL, const UserData&);1252 void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, const String&, const UserData&);1251 void didStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::URL&&, WebCore::URL&& unreachableURL, const UserData&); 1252 void didReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::URL&&, const UserData&); 1253 1253 void willPerformClientRedirectForFrame(uint64_t frameID, const String& url, double delay); 1254 1254 void didCancelClientRedirectForFrame(uint64_t frameID); 1255 void didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, const String& url);1255 void didChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, WebCore::URL&&); 1256 1256 void didFailProvisionalLoadForFrame(uint64_t frameID, const WebCore::SecurityOriginData& frameSecurityOrigin, uint64_t navigationID, const String& provisionalURL, const WebCore::ResourceError&, const UserData&); 1257 1257 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&); … … 1259 1259 void didFinishLoadForFrame(uint64_t frameID, uint64_t navigationID, const UserData&); 1260 1260 void didFailLoadForFrame(uint64_t frameID, uint64_t navigationID, const WebCore::ResourceError&, const UserData&); 1261 void didSameDocumentNavigationForFrame(uint64_t frameID, uint64_t navigationID, uint32_t sameDocumentNavigationType, const String&, const UserData&);1261 void didSameDocumentNavigationForFrame(uint64_t frameID, uint64_t navigationID, uint32_t sameDocumentNavigationType, WebCore::URL&&, const UserData&); 1262 1262 void didChangeMainDocument(uint64_t frameID); 1263 1263 -
trunk/Source/WebKit/UIProcess/WebPageProxy.messages.in
r221982 r222033 116 116 117 117 # Frame load messages 118 DidStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, String url, StringunreachableURL, WebKit::UserData userData)119 DidReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, Stringurl, WebKit::UserData userData)118 DidStartProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::URL url, WebCore::URL unreachableURL, WebKit::UserData userData) 119 DidReceiveServerRedirectForProvisionalLoadForFrame(uint64_t frameID, uint64_t navigationID, WebCore::URL url, WebKit::UserData userData) 120 120 WillPerformClientRedirectForFrame(uint64_t frameID, String url, double delay) 121 121 DidCancelClientRedirectForFrame(uint64_t frameID) 122 DidChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, Stringurl)122 DidChangeProvisionalURLForFrame(uint64_t frameID, uint64_t navigationID, WebCore::URL url) 123 123 DidFailProvisionalLoadForFrame(uint64_t frameID, struct WebCore::SecurityOriginData frameSecurityOrigin, uint64_t navigationID, String provisionalURL, WebCore::ResourceError error, WebKit::UserData userData) 124 124 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) … … 133 133 DidRunInsecureContentForFrame(uint64_t frameID, WebKit::UserData userData) 134 134 DidDetectXSSForFrame(uint64_t frameID, WebKit::UserData userData) 135 DidSameDocumentNavigationForFrame(uint64_t frameID, uint64_t navigationID, uint32_t type, Stringurl, WebKit::UserData userData)135 DidSameDocumentNavigationForFrame(uint64_t frameID, uint64_t navigationID, uint32_t type, WebCore::URL url, WebKit::UserData userData) 136 136 DidChangeMainDocument(uint64_t frameID); 137 137 DidDestroyNavigation(uint64_t navigationID) -
trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
r221465 r222033 280 280 281 281 WebDocumentLoader& documentLoader = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().provisionalDocumentLoader()); 282 const String& url = documentLoader.url().string();283 282 RefPtr<API::Object> userData; 284 283 … … 287 286 288 287 // Notify the UIProcess. 289 webPage->send(Messages::WebPageProxy::DidReceiveServerRedirectForProvisionalLoadForFrame(m_frame->frameID(), documentLoader.navigationID(), url, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));288 webPage->send(Messages::WebPageProxy::DidReceiveServerRedirectForProvisionalLoadForFrame(m_frame->frameID(), documentLoader.navigationID(), documentLoader.url(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get()))); 290 289 } 291 290 … … 297 296 298 297 WebDocumentLoader& documentLoader = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().provisionalDocumentLoader()); 299 webPage->send(Messages::WebPageProxy::DidChangeProvisionalURLForFrame(m_frame->frameID(), documentLoader.navigationID(), documentLoader.url() .string()));298 webPage->send(Messages::WebPageProxy::DidChangeProvisionalURLForFrame(m_frame->frameID(), documentLoader.navigationID(), documentLoader.url())); 300 299 } 301 300 … … 340 339 341 340 // Notify the UIProcess. 342 webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), navigationID, SameDocumentNavigationAnchorNavigation, m_frame->coreFrame()->document()->url() .string(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));341 webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), navigationID, SameDocumentNavigationAnchorNavigation, m_frame->coreFrame()->document()->url(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get()))); 343 342 } 344 343 … … 366 365 367 366 // Notify the UIProcess. 368 webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), navigationID, SameDocumentNavigationSessionStatePush, m_frame->coreFrame()->document()->url() .string(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));367 webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), navigationID, SameDocumentNavigationSessionStatePush, m_frame->coreFrame()->document()->url(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get()))); 369 368 } 370 369 … … 383 382 384 383 // Notify the UIProcess. 385 webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), navigationID, SameDocumentNavigationSessionStateReplace, m_frame->coreFrame()->document()->url() .string(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));384 webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), navigationID, SameDocumentNavigationSessionStateReplace, m_frame->coreFrame()->document()->url(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get()))); 386 385 } 387 386 … … 400 399 401 400 // Notify the UIProcess. 402 webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), navigationID, SameDocumentNavigationSessionStatePop, m_frame->coreFrame()->document()->url() .string(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));401 webPage->send(Messages::WebPageProxy::DidSameDocumentNavigationForFrame(m_frame->frameID(), navigationID, SameDocumentNavigationSessionStatePop, m_frame->coreFrame()->document()->url(), UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get()))); 403 402 } 404 403 … … 424 423 425 424 WebDocumentLoader& provisionalLoader = static_cast<WebDocumentLoader&>(*m_frame->coreFrame()->loader().provisionalDocumentLoader()); 426 const String& url = provisionalLoader.url().string();425 auto& url = provisionalLoader.url(); 427 426 RefPtr<API::Object> userData; 428 427 … … 430 429 webPage->injectedBundleLoaderClient().didStartProvisionalLoadForFrame(*webPage, *m_frame, userData); 431 430 432 String unreachableURL = provisionalLoader.unreachableURL().string();431 auto& unreachableURL = provisionalLoader.unreachableURL(); 433 432 434 433 // Notify the UIProcess. -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp
r222006 r222033 1177 1177 } 1178 1178 1179 void WebPage::loadURLInFrame( const String& url, uint64_t frameID)1179 void WebPage::loadURLInFrame(WebCore::URL&& url, uint64_t frameID) 1180 1180 { 1181 1181 WebFrame* frame = WebProcess::singleton().webFrame(frameID); … … 1183 1183 return; 1184 1184 1185 frame->coreFrame()->loader().load(FrameLoadRequest(*frame->coreFrame(), ResourceRequest( URL(URL(), url)), ShouldOpenExternalURLsPolicy::ShouldNotAllow));1185 frame->coreFrame()->loader().load(FrameLoadRequest(*frame->coreFrame(), ResourceRequest(url), ShouldOpenExternalURLsPolicy::ShouldNotAllow)); 1186 1186 } 1187 1187 -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.h
r221770 r222033 1096 1096 static bool logicalScroll(WebCore::Page*, WebCore::ScrollLogicalDirection, WebCore::ScrollGranularity); 1097 1097 1098 void loadURLInFrame( const String&, uint64_t frameID);1098 void loadURLInFrame(WebCore::URL&&, uint64_t frameID); 1099 1099 1100 1100 enum class WasRestoredByAPIRequest { No, Yes }; -
trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in
r221866 r222033 133 133 TryRestoreScrollPosition() 134 134 135 LoadURLInFrame( Stringurl, uint64_t frameID)135 LoadURLInFrame(WebCore::URL url, uint64_t frameID) 136 136 LoadRequest(struct WebKit::LoadParameters loadParameters) 137 137 LoadData(struct WebKit::LoadParameters loadParameters) -
trunk/Tools/ChangeLog
r222032 r222033 1 2017-09-14 Alex Christensen <achristensen@webkit.org> 2 3 Add WKUIDelegatePrivate equivalent of WKPageUIClient's drawHeader, drawFooter, headerHeight, and footerHeight 4 https://bugs.webkit.org/show_bug.cgi?id=176889 5 <rdar://problem/29270035> 6 7 Reviewed by Andy Estes. 8 9 * TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm: 10 (-[PrintDelegate _webView:printFrame:]): 11 (-[PrintDelegate _webViewHeaderHeight:]): 12 (-[PrintDelegate _webViewFooterHeight:]): 13 (-[PrintDelegate _webView:drawHeaderInRect:forPageWithTitle:URL:]): 14 (-[PrintDelegate _webView:drawFooterInRect:forPageWithTitle:URL:]): 15 (callbacksEqual): 16 (TEST): 17 * TestWebKitAPI/cocoa/TestWKWebView.h: 18 * TestWebKitAPI/cocoa/TestWKWebView.mm: 19 (-[TestWKWebView hostWindow]): 20 1 21 2017-09-14 Carlos Alberto Lopez Perez <clopez@igalia.com> 2 22 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm
r222013 r222033 42 42 #import <WebKit/_WKHitTestResult.h> 43 43 #import <wtf/RetainPtr.h> 44 #import <wtf/Vector.h> 44 45 45 46 #if PLATFORM(MAC) … … 283 284 } 284 285 286 enum class Callback { 287 HeaderHeight, 288 FooterHeight, 289 DrawHeader, 290 DrawFooter, 291 }; 292 293 static Vector<Callback> callbacks; 294 295 @interface PrintDelegate : NSObject <WKUIDelegatePrivate> 296 @end 297 298 @implementation PrintDelegate 299 300 - (void)_webView:(WKWebView *)webView printFrame:(_WKFrameHandle *)frame 301 { 302 done = true; 303 } 304 305 - (CGFloat)_webViewHeaderHeight:(WKWebView *)webView 306 { 307 callbacks.append(Callback::HeaderHeight); 308 return 3.14159; 309 } 310 311 - (CGFloat)_webViewFooterHeight:(WKWebView *)webView 312 { 313 callbacks.append(Callback::FooterHeight); 314 return 2.71828; 315 } 316 317 - (void)_webView:(WKWebView *)webView drawHeaderInRect:(CGRect)rect forPageWithTitle:(NSString *)title URL:(NSURL *)url 318 { 319 EXPECT_EQ(rect.origin.x, 72); 320 EXPECT_TRUE(fabs(rect.origin.y - 698.858398) < .00001); 321 EXPECT_TRUE(fabs(rect.size.height - 3.141590) < .00001); 322 EXPECT_EQ(rect.size.width, 468.000000); 323 EXPECT_STREQ(title.UTF8String, "test_title"); 324 EXPECT_STREQ(url.absoluteString.UTF8String, "http://example.com/"); 325 callbacks.append(Callback::DrawHeader); 326 } 327 328 - (void)_webView:(WKWebView *)webView drawFooterInRect:(CGRect)rect forPageWithTitle:(NSString *)title URL:(NSURL *)url 329 { 330 EXPECT_EQ(rect.origin.x, 72); 331 EXPECT_EQ(rect.origin.y, 90); 332 EXPECT_TRUE(fabs(rect.size.height - 2.718280) < .00001); 333 EXPECT_EQ(rect.size.width, 468.000000); 334 EXPECT_STREQ(url.absoluteString.UTF8String, "http://example.com/"); 335 callbacks.append(Callback::DrawFooter); 336 const size_t expectedFinalCallbackSize = 39; 337 if (callbacks.size() == expectedFinalCallbackSize) 338 done = true; 339 } 340 341 @end 342 343 bool callbacksEqual(const Vector<Callback> a, const Vector<Callback> b) 344 { 345 if (a.size() != b.size()) 346 return false; 347 for (size_t i = 0; i < a.size(); ++i) { 348 if (a[i] != b[i]) 349 return false; 350 } 351 return true; 352 } 353 354 TEST(WebKit, PrintFrame) 355 { 356 auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]); 357 auto delegate = adoptNS([[PrintDelegate alloc] init]); 358 [webView setUIDelegate:delegate.get()]; 359 [webView loadHTMLString:@"<head><title>test_title</title></head><body onload='print()'>hello world!</body>" baseURL:[NSURL URLWithString:@"http://example.com/"]]; 360 TestWebKitAPI::Util::run(&done); 361 362 done = false; 363 NSPrintOperation *operation = [webView _printOperationWithPrintInfo:[NSPrintInfo sharedPrintInfo]]; 364 EXPECT_TRUE(operation.canSpawnSeparateThread); 365 EXPECT_STREQ(operation.jobTitle.UTF8String, "test_title"); 366 367 [operation runOperationModalForWindow:[webView hostWindow] delegate:nil didRunSelector:nil contextInfo:nil]; 368 TestWebKitAPI::Util::run(&done); 369 370 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 })); 371 } 372 285 373 @interface NotificationDelegate : NSObject <WKUIDelegatePrivate> { 286 374 bool _allowNotifications; -
trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.h
r221658 r222033 67 67 - (void)sendClicksAtPoint:(NSPoint)point numberOfClicks:(NSUInteger)numberOfClicks; 68 68 - (void)typeCharacter:(char)character; 69 - (NSWindow *)hostWindow; 69 70 @end 70 71 #endif -
trunk/Tools/TestWebKitAPI/cocoa/TestWKWebView.mm
r221658 r222033 350 350 } 351 351 352 - (NSWindow *)hostWindow 353 { 354 return _hostWindow.get(); 355 } 356 352 357 - (void)typeCharacter:(char)character { 353 358 NSString *characterAsString = [NSString stringWithFormat:@"%c" , character];
Note:
See TracChangeset
for help on using the changeset viewer.