Expose _printOperationWithPrintInfo: SPI as API
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Oct 2019 21:42:43 +0000 (21:42 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Oct 2019 21:42:43 +0000 (21:42 +0000)
<rdar://problem/36557179> and https://bugs.webkit.org/show_bug.cgi?id=203496

Reviewed by Andy Estes.

Source/WebKit:

* UIProcess/API/Cocoa/WKWebView.h:
* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView printOperationWithPrintInfo:]):
(-[WKWebView _printOperationWithPrintInfo:]):

Tools:

* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController printWebView:]):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@251673 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/WKWebView.h
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Tools/ChangeLog
Tools/MiniBrowser/mac/WK2BrowserWindowController.m

index 6bedd88..85bdf6a 100644 (file)
@@ -1,3 +1,15 @@
+2019-10-28  Brady Eidson  <beidson@apple.com>
+
+        Expose _printOperationWithPrintInfo: SPI as API
+        <rdar://problem/36557179> and https://bugs.webkit.org/show_bug.cgi?id=203496
+
+        Reviewed by Andy Estes.
+
+        * UIProcess/API/Cocoa/WKWebView.h:
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView printOperationWithPrintInfo:]):
+        (-[WKWebView _printOperationWithPrintInfo:]):
+
 2019-10-28  Kate Cheney  <katherine_cheney@apple.com>
 
         Layout Test http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html is a flaky failure
 2019-10-28  Kate Cheney  <katherine_cheney@apple.com>
 
         Layout Test http/tests/resourceLoadStatistics/website-data-removal-for-site-navigated-to-with-link-decoration.html is a flaky failure
index f62cad9..31dc951 100644 (file)
@@ -300,6 +300,12 @@ If the data is written to a file the resulting file is a valid PDF document.
  */
 + (BOOL)handlesURLScheme:(NSString *)urlScheme WK_API_AVAILABLE(macos(10.13), ios(11.0));
 
  */
 + (BOOL)handlesURLScheme:(NSString *)urlScheme WK_API_AVAILABLE(macos(10.13), ios(11.0));
 
+#if !TARGET_OS_IPHONE
+/* @abstract Returns an NSPrintOperation object configured to print the contents of this WKWebView
+@param printInfo The print info object used to configure the resulting print operation.
+*/
+- (NSPrintOperation *)printOperationWithPrintInfo:(NSPrintInfo *)printInfo WK_API_AVAILABLE(macos(WK_MAC_TBA));
+#endif
 @end
 
 #if !TARGET_OS_IPHONE
 @end
 
 #if !TARGET_OS_IPHONE
index b3b9960..cc6ba14 100644 (file)
@@ -4633,6 +4633,13 @@ ALLOW_DEPRECATED_IMPLEMENTATIONS_END
 
 #endif // ENABLE(DRAG_SUPPORT)
 
 
 #endif // ENABLE(DRAG_SUPPORT)
 
+- (NSPrintOperation *)printOperationWithPrintInfo:(NSPrintInfo *)printInfo
+{
+    if (auto webFrameProxy = _page->mainFrame())
+        return _impl->printOperationWithPrintInfo(printInfo, *webFrameProxy);
+    return nil;
+}
+
 #endif // PLATFORM(MAC)
 
 #if HAVE(TOUCH_BAR)
 #endif // PLATFORM(MAC)
 
 #if HAVE(TOUCH_BAR)
@@ -6745,9 +6752,7 @@ static WebCore::UserInterfaceLayoutDirection toUserInterfaceLayoutDirection(UISe
 
 - (NSPrintOperation *)_printOperationWithPrintInfo:(NSPrintInfo *)printInfo
 {
 
 - (NSPrintOperation *)_printOperationWithPrintInfo:(NSPrintInfo *)printInfo
 {
-    if (auto webFrameProxy = _page->mainFrame())
-        return _impl->printOperationWithPrintInfo(printInfo, *webFrameProxy);
-    return nil;
+    return [self printOperationWithPrintInfo:printInfo];
 }
 
 - (NSPrintOperation *)_printOperationWithPrintInfo:(NSPrintInfo *)printInfo forFrame:(_WKFrameHandle *)frameHandle
 }
 
 - (NSPrintOperation *)_printOperationWithPrintInfo:(NSPrintInfo *)printInfo forFrame:(_WKFrameHandle *)frameHandle
index 726a7d8..d2e5a58 100644 (file)
@@ -1,3 +1,13 @@
+2019-10-28  Brady Eidson  <beidson@apple.com>
+
+        Expose _printOperationWithPrintInfo: SPI as API
+        <rdar://problem/36557179> and https://bugs.webkit.org/show_bug.cgi?id=203496
+
+        Reviewed by Andy Estes.
+
+        * MiniBrowser/mac/WK2BrowserWindowController.m:
+        (-[WK2BrowserWindowController printWebView:]):
+
 2019-10-28  Jonathan Bedard  <jbedard@apple.com>
 
         results.webkit.org: Show results which are missing expectations
 2019-10-28  Jonathan Bedard  <jbedard@apple.com>
 
         results.webkit.org: Show results which are missing expectations
index 66482f9..5f50e8d 100644 (file)
@@ -644,7 +644,7 @@ static NSSet *dataTypes()
 
 - (IBAction)printWebView:(id)sender
 {
 
 - (IBAction)printWebView:(id)sender
 {
-    [[_webView _printOperationWithPrintInfo:[NSPrintInfo sharedPrintInfo]] runOperationModalForWindow:self.window delegate:nil didRunSelector:nil contextInfo:nil];
+    [[_webView printOperationWithPrintInfo:[NSPrintInfo sharedPrintInfo]] runOperationModalForWindow:self.window delegate:nil didRunSelector:nil contextInfo:nil];
 }
 
 #pragma mark WKNavigationDelegate
 }
 
 #pragma mark WKNavigationDelegate