[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

ap at apple.com ap at apple.com
Fri Jan 21 15:00:20 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit b9997acd574a4cdca7316df883e62be6a9ed717a
Author: ap at apple.com <ap at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jan 6 05:16:00 2011 +0000

    2011-01-05  Alexey Proskuryakov  <ap at apple.com>
    
            Reviewed by Anders Carlsson.
    
            https://bugs.webkit.org/show_bug.cgi?id=51973
            Make main frame PDF printing work
    
            * UIProcess/API/mac/PDFViewController.h:
            * UIProcess/API/mac/PDFViewController.mm: (WebKit::PDFViewController::makePrintOperation):
            Ask PDFDocument to create an NSPrintOperation.
    
            * UIProcess/API/mac/WKView.h:
            * UIProcess/API/mac/WKView.mm:
            (-[WKView printOperationWithPrintInfo:forFrame:]): Create a new NSPrintOperation, either
            from scratch or from a PDF view.
            (-[WKView canPrintHeadersAndFooters]): Report if the view can be re-paginated to add headers
            and footers.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75135 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 2dcd2c4..a70c60c 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,21 @@
+2011-01-05  Alexey Proskuryakov  <ap at apple.com>
+
+        Reviewed by Anders Carlsson.
+
+        https://bugs.webkit.org/show_bug.cgi?id=51973
+        Make main frame PDF printing work
+
+        * UIProcess/API/mac/PDFViewController.h:
+        * UIProcess/API/mac/PDFViewController.mm: (WebKit::PDFViewController::makePrintOperation):
+        Ask PDFDocument to create an NSPrintOperation.
+
+        * UIProcess/API/mac/WKView.h:
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView printOperationWithPrintInfo:forFrame:]): Create a new NSPrintOperation, either
+        from scratch or from a PDF view.
+        (-[WKView canPrintHeadersAndFooters]): Report if the view can be re-paginated to add headers
+        and footers.
+
 2011-01-05  Anders Carlsson  <andersca at apple.com>
 
         Reviewed by Sam Weinig.
diff --git a/WebKit2/UIProcess/API/mac/PDFViewController.h b/WebKit2/UIProcess/API/mac/PDFViewController.h
index 51f581a..15043bd 100644
--- a/WebKit2/UIProcess/API/mac/PDFViewController.h
+++ b/WebKit2/UIProcess/API/mac/PDFViewController.h
@@ -53,6 +53,8 @@ public:
 
     static Class pdfDocumentClass();
     static Class pdfPreviewViewClass();
+
+    NSPrintOperation *makePrintOperation(NSPrintInfo *);
     
 private:
     explicit PDFViewController(WKView *wkView);
diff --git a/WebKit2/UIProcess/API/mac/PDFViewController.mm b/WebKit2/UIProcess/API/mac/PDFViewController.mm
index 476dc7b..e01d0b3 100644
--- a/WebKit2/UIProcess/API/mac/PDFViewController.mm
+++ b/WebKit2/UIProcess/API/mac/PDFViewController.mm
@@ -32,6 +32,10 @@
 @class PDFDocument;
 @class PDFView;
 
+ at interface PDFDocument (PDFDocumentDetails)
+- (NSPrintOperation *)getPrintOperationForPrintInfo:(NSPrintInfo *)printInfo autoRotate:(BOOL)doRotate;
+ at end
+
 extern "C" NSString *_NSPathForSystemFramework(NSString *framework);
     
 @interface WKPDFView : NSView
@@ -179,4 +183,9 @@ NSBundle* PDFViewController::pdfKitBundle()
     return pdfKitBundle;
 }
 
+NSPrintOperation *PDFViewController::makePrintOperation(NSPrintInfo *printInfo)
+{
+    return [[m_pdfView document] getPrintOperationForPrintInfo:printInfo autoRotate:YES];
+}
+
 } // namespace WebKit
diff --git a/WebKit2/UIProcess/API/mac/WKView.h b/WebKit2/UIProcess/API/mac/WKView.h
index 10f7688..a63f757 100644
--- a/WebKit2/UIProcess/API/mac/WKView.h
+++ b/WebKit2/UIProcess/API/mac/WKView.h
@@ -36,6 +36,9 @@ WK_EXPORT
 - (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef;
 - (id)initWithFrame:(NSRect)frame contextRef:(WKContextRef)contextRef pageGroupRef:(WKPageGroupRef)pageGroupRef;
 
+- (NSPrintOperation *)printOperationWithPrintInfo:(NSPrintInfo *)printInfo forFrame:(WKFrameRef)frameRef;
+- (BOOL)canPrintHeadersAndFooters;
+
 @property(readonly) WKPageRef pageRef;
 
 @property BOOL drawsBackground;
diff --git a/WebKit2/UIProcess/API/mac/WKView.mm b/WebKit2/UIProcess/API/mac/WKView.mm
index a66581a..3b4e1f9 100644
--- a/WebKit2/UIProcess/API/mac/WKView.mm
+++ b/WebKit2/UIProcess/API/mac/WKView.mm
@@ -1196,6 +1196,22 @@ static bool isViewVisible(NSView *view)
     return (NSInteger)self;
 }
 
+- (NSPrintOperation *)printOperationWithPrintInfo:(NSPrintInfo *)printInfo forFrame:(WKFrameRef)frameRef
+{
+    // Only the top frame can currently contain a PDF view.
+    if (_data->_pdfViewController) {
+        ASSERT(toImpl(frameRef)->isMainFrame());
+        return _data->_pdfViewController->makePrintOperation(printInfo);
+    }
+    return [NSPrintOperation printOperationWithView:self printInfo:printInfo];
+}
+
+- (BOOL)canPrintHeadersAndFooters
+{
+    // PDF documents are already paginated, so we can't change them to add headers and footers.
+    return !_data->_pdfViewController;
+}
+
 @end
 
 @implementation WKView (Internal)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list