Changeset 188255 in webkit
- Timestamp:
- Aug 11, 2015 9:14:15 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r188236 r188255 1 2015-08-11 Dan Bernstein <mitz@apple.com> 2 3 [Cocoa] The UI delegate can't tell if printing was user-initiated 4 https://bugs.webkit.org/show_bug.cgi?id=147869 5 6 Reviewed by Sam Weinig. 7 8 * UIProcess/API/APIUIClient.h: 9 (API::UIClient::printFrame): Added processingUserGesture argument. 10 11 * UIProcess/API/C/WKPage.cpp: 12 (WKPageSetPageUIClient): Updated for new client function signature. 13 14 * UIProcess/API/Cocoa/WKUIDelegatePrivate.h: Added userInitiated boolean argument to 15 -_webView:printFrame:. 16 17 * UIProcess/Cocoa/UIDelegate.h: Added bool to m_delegateMethods for the new method. 18 * UIProcess/Cocoa/UIDelegate.mm: 19 (WebKit::UIDelegate::UIDelegate): 20 (WebKit::UIDelegate::setDelegate): Initialized new bool. 21 (WebKit::UIDelegate::UIClient::printFrame): Pass processingUserGesture as the delegate’s 22 userInitiated argument. 23 24 * UIProcess/WebPageProxy.cpp: 25 (WebKit::WebPageProxy::printFrame): Added processingUserGesture argument, passing it along 26 to the client. 27 * UIProcess/WebPageProxy.h: 28 29 * UIProcess/WebPageProxy.messages.in: Added processingUserGesture argument to printFrame. 30 31 * WebProcess/WebCoreSupport/WebChromeClient.cpp: 32 (WebKit::WebChromeClient::print): Pass new argument. 33 1 34 2015-08-10 Matthew Daiter <mdaiter@apple.com> 2 35 -
trunk/Source/WebKit2/UIProcess/API/APIUIClient.h
r187272 r188255 140 140 virtual void drawHeader(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, const WebCore::FloatRect&) { } 141 141 virtual void drawFooter(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, const WebCore::FloatRect&) { } 142 virtual void printFrame(WebKit::WebPageProxy*, WebKit::WebFrameProxy* ) { }142 virtual void printFrame(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, bool processingUserGesture) { } 143 143 144 144 virtual bool canRunModal() const { return false; } -
trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp
r188228 r188255 1731 1731 } 1732 1732 1733 virtual void printFrame(WebPageProxy* page, WebFrameProxy* frame ) override1733 virtual void printFrame(WebPageProxy* page, WebFrameProxy* frame, bool) override 1734 1734 { 1735 1735 if (!m_client.printFrame) -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKUIDelegatePrivate.h
r187272 r188255 49 49 - (void)_webView:(WKWebView *)webView decideWebApplicationCacheQuotaForSecurityOrigin:(WKSecurityOrigin *)securityOrigin currentQuota:(unsigned long long)currentQuota totalBytesNeeded:(unsigned long long)totalBytesNeeded decisionHandler:(void (^)(unsigned long long newQuota))decisionHandler; 50 50 51 - (void)_webView:(WKWebView *)webView printFrame:(_WKFrameHandle *)frame ;51 - (void)_webView:(WKWebView *)webView printFrame:(_WKFrameHandle *)frame userInitiated:(BOOL)userInitiated WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA); 52 52 53 53 - (void)_webViewClose:(WKWebView *)webView; -
trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.h
r187272 r188255 69 69 virtual void exceededDatabaseQuota(WebPageProxy*, WebFrameProxy*, API::SecurityOrigin*, const WTF::String& databaseName, const WTF::String& displayName, unsigned long long currentQuota, unsigned long long currentOriginUsage, unsigned long long currentUsage, unsigned long long expectedUsage, std::function<void (unsigned long long)>) override; 70 70 virtual void reachedApplicationCacheOriginQuota(WebPageProxy*, const WebCore::SecurityOrigin&, uint64_t currentQuota, uint64_t totalBytesNeeded, std::function<void (unsigned long long)> completionHandler) override; 71 virtual void printFrame(WebKit::WebPageProxy*, WebKit::WebFrameProxy* ) override;71 virtual void printFrame(WebKit::WebPageProxy*, WebKit::WebFrameProxy*, bool processingUserGesture) override; 72 72 #if PLATFORM(IOS) 73 73 #if HAVE(APP_LINKS) … … 95 95 bool webViewDecideWebApplicationCacheQuotaForSecurityOriginCurrentQuotaTotalBytesNeeded : 1; 96 96 bool webViewPrintFrame : 1; 97 bool webViewPrintFrameUserInitiated : 1; 97 98 bool webViewDidClose : 1; 98 99 bool webViewClose : 1; -
trunk/Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm
r187272 r188255 42 42 #import <WebCore/URL.h> 43 43 44 @protocol WKUIDelegatePrivateDeprecated <WKUIDelegatePrivate> 45 @optional 46 - (void)_webView:(WKWebView *)webView printFrame:(_WKFrameHandle *)frame; 47 @end 48 44 49 namespace WebKit { 45 50 … … 74 79 m_delegateMethods.webViewDecideWebApplicationCacheQuotaForSecurityOriginCurrentQuotaTotalBytesNeeded = [delegate respondsToSelector:@selector(_webView:decideWebApplicationCacheQuotaForSecurityOrigin:currentQuota:totalBytesNeeded:decisionHandler:)]; 75 80 m_delegateMethods.webViewPrintFrame = [delegate respondsToSelector:@selector(_webView:printFrame:)]; 81 m_delegateMethods.webViewPrintFrameUserInitiated = [delegate respondsToSelector:@selector(_webView:printFrame:userInitiated:)]; 76 82 m_delegateMethods.webViewDidClose = [delegate respondsToSelector:@selector(webViewDidClose:)]; 77 83 m_delegateMethods.webViewClose = [delegate respondsToSelector:@selector(_webViewClose:)]; … … 231 237 } 232 238 233 void UIDelegate::UIClient::printFrame(WebKit::WebPageProxy*, WebKit::WebFrameProxy* webFrameProxy )239 void UIDelegate::UIClient::printFrame(WebKit::WebPageProxy*, WebKit::WebFrameProxy* webFrameProxy, bool processingUserGesture) 234 240 { 235 241 ASSERT_ARG(webFrameProxy, webFrameProxy); 236 242 237 if (!m_uiDelegate.m_delegateMethods.webViewPrintFrame) 238 return; 239 240 auto delegate = m_uiDelegate.m_delegate.get(); 241 if (!delegate) 242 return; 243 244 [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView printFrame:wrapper(API::FrameHandle::create(webFrameProxy->frameID()))]; 243 if (!m_uiDelegate.m_delegateMethods.webViewPrintFrame && !m_uiDelegate.m_delegateMethods.webViewPrintFrameUserInitiated) 244 return; 245 246 auto delegate = m_uiDelegate.m_delegate.get(); 247 if (!delegate) 248 return; 249 250 if (m_uiDelegate.m_delegateMethods.webViewPrintFrameUserInitiated) 251 [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView printFrame:wrapper(API::FrameHandle::create(webFrameProxy->frameID())) userInitiated:processingUserGesture]; 252 else 253 [(id <WKUIDelegatePrivateDeprecated>)delegate _webView:m_uiDelegate.m_webView printFrame:wrapper(API::FrameHandle::create(webFrameProxy->frameID()))]; 245 254 } 246 255 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp
r188228 r188255 3837 3837 } 3838 3838 3839 void WebPageProxy::printFrame(uint64_t frameID )3839 void WebPageProxy::printFrame(uint64_t frameID, bool processingUserGesture) 3840 3840 { 3841 3841 ASSERT(!m_isPerformingDOMPrintOperation); … … 3845 3845 MESSAGE_CHECK(frame); 3846 3846 3847 m_uiClient->printFrame(this, frame );3847 m_uiClient->printFrame(this, frame, processingUserGesture); 3848 3848 3849 3849 endPrinting(); // Send a message synchronously while m_isPerformingDOMPrintOperation is still true. 3850 3850 m_isPerformingDOMPrintOperation = false; 3851 }3852 3853 void WebPageProxy::printMainFrame()3854 {3855 printFrame(m_mainFrame->frameID());3856 3851 } 3857 3852 -
trunk/Source/WebKit2/UIProcess/WebPageProxy.h
r188228 r188255 914 914 void setShouldSendEventsSynchronously(bool sync) { m_shouldSendEventsSynchronously = sync; }; 915 915 916 void printMainFrame();917 918 916 void setMediaVolume(float); 919 917 void setMuted(bool); … … 1181 1179 void pageDidScroll(); 1182 1180 void runOpenPanel(uint64_t frameID, const WebCore::FileChooserSettings&); 1183 void printFrame(uint64_t frameID );1181 void printFrame(uint64_t frameID, bool processingUserGesture); 1184 1182 void exceededDatabaseQuota(uint64_t frameID, const String& originIdentifier, const String& databaseName, const String& displayName, uint64_t currentQuota, uint64_t currentOriginUsage, uint64_t currentDatabaseUsage, uint64_t expectedUsage, PassRefPtr<Messages::WebPageProxy::ExceededDatabaseQuota::DelayedReply>); 1185 1183 void reachedApplicationCacheOriginQuota(const String& originIdentifier, uint64_t currentQuota, uint64_t totalBytesNeeded, PassRefPtr<Messages::WebPageProxy::ReachedApplicationCacheOriginQuota::DelayedReply>); -
trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in
r188121 r188255 77 77 PageDidScroll() 78 78 RunOpenPanel(uint64_t frameID, struct WebCore::FileChooserSettings parameters) 79 PrintFrame(uint64_t frameID ) -> ()79 PrintFrame(uint64_t frameID, bool processingUserGesture) -> () 80 80 RunModal() 81 81 NotifyScrollerThumbIsVisibleInRect(WebCore::IntRect scrollerThumb) -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
r188121 r188255 681 681 syncSendFlags |= IPC::SpinRunLoopWhileWaitingForReply; 682 682 683 m_page->sendSync(Messages::WebPageProxy::PrintFrame(webFrame->frameID() ), Messages::WebPageProxy::PrintFrame::Reply(), std::chrono::milliseconds::max(), syncSendFlags);683 m_page->sendSync(Messages::WebPageProxy::PrintFrame(webFrame->frameID(), ScriptController::processingUserGesture()), Messages::WebPageProxy::PrintFrame::Reply(), std::chrono::milliseconds::max(), syncSendFlags); 684 684 } 685 685 -
trunk/Tools/ChangeLog
r188251 r188255 1 2015-08-11 Dan Bernstein <mitz@apple.com> 2 3 [Cocoa] The UI delegate can't tell if printing was user-initiated 4 https://bugs.webkit.org/show_bug.cgi?id=147869 5 6 Reviewed by Sam Weinig. 7 8 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 9 * TestWebKitAPI/Tests/WebKit2Cocoa/PrintFrame.mm: Added. 10 (-[PrintFrameController webView:didFinishNavigation:]): 11 (-[PrintFrameController _webView:printFrame:userInitiated:]): 12 (TEST): 13 1 14 2015-08-10 Alex Christensen <achristensen@webkit.org> 2 15 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r188169 r188255 40 40 33DC89141419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33DC89131419579F00747EF7 /* LoadCanceledNoServerRedirectCallback_Bundle.cpp */; }; 41 41 33E79E06137B5FD900E32D99 /* mouse-move-listener.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 33E79E05137B5FCE00E32D99 /* mouse-move-listener.html */; }; 42 376481801B79CD8D00D24B97 /* PrintFrame.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3764817D1B79CD7D00D24B97 /* PrintFrame.mm */; settings = {ASSET_TAGS = (); }; }; 42 43 378E64771632655E00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 378E64751632655D00B6C676 /* InjectedBundleFrameHitTest_Bundle.cpp */; }; 43 44 378E64791632707400B6C676 /* link-with-title.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 378E647816326FDF00B6C676 /* link-with-title.html */; }; … … 497 498 3722C8681461E03E00C45D00 /* RenderedImageFromDOMRange.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RenderedImageFromDOMRange.mm; sourceTree = "<group>"; }; 498 499 3751AF7A169518F800764319 /* DOMNodeFromJSObject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMNodeFromJSObject.mm; sourceTree = "<group>"; }; 500 3764817D1B79CD7D00D24B97 /* PrintFrame.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PrintFrame.mm; sourceTree = "<group>"; }; 499 501 3776BC62150946BC0043A66D /* DeviceScaleFactorInDashboardRegions.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DeviceScaleFactorInDashboardRegions.mm; sourceTree = "<group>"; }; 500 502 378E64711632646D00B6C676 /* InjectedBundleFrameHitTest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InjectedBundleFrameHitTest.cpp; sourceTree = "<group>"; }; … … 867 869 CEA6CF2219CCF5BD0064F5A7 /* OpenAndCloseWindow.mm */, 868 870 C95501BE19AD2FAF0049BE3E /* Preferences.mm */, 871 3764817D1B79CD7D00D24B97 /* PrintFrame.mm */, 869 872 37D36F311B004DD400BAF5D9 /* ProvisionalURLChange.mm */, 870 873 37BCA61B1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm */, … … 1562 1565 7CCE7F2C1A411B1000447C4C /* PreventImageLoadWithAutoResizing.mm in Sources */, 1563 1566 7CCE7F0C1A411AE600447C4C /* PrivateBrowsingPushStateNoHistoryCallback.cpp in Sources */, 1567 376481801B79CD8D00D24B97 /* PrintFrame.mm in Sources */, 1564 1568 7CCE7EC81A411A7E00447C4C /* PublicSuffix.mm in Sources */, 1565 1569 7CCE7F3E1A411B8E00447C4C /* RedBlackTree.cpp in Sources */,
Note: See TracChangeset
for help on using the changeset viewer.