[WK2] Clicking a print button in a PDF doesn't do anything
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Oct 2011 04:57:09 +0000 (04:57 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 22 Oct 2011 04:57:09 +0000 (04:57 +0000)
https://bugs.webkit.org/show_bug.cgi?id=70663
<rdar://problem/9795014>

Reviewed by Dan Bernstein.

* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::printMainFrame): Added a public method
that PDFViewController could call.

* UIProcess/API/mac/PDFViewController.h:
* UIProcess/API/mac/PDFViewController.mm:
(-[WKPDFView PDFViewPerformPrint:]):
(WebKit::PDFViewController::print):
Connect PDFView delegate method for printing.

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/mac/PDFViewController.h
Source/WebKit2/UIProcess/API/mac/PDFViewController.mm
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h

index dd329d7f4b6494f32f277aa9cb59099643d0765b..9ddd4adcef7b814b3678dd85db8e5c020d906b43 100644 (file)
@@ -1,3 +1,21 @@
+2011-10-21  Alexey Proskuryakov  <ap@apple.com>
+
+        [WK2] Clicking a print button in a PDF doesn't do anything
+        https://bugs.webkit.org/show_bug.cgi?id=70663
+        <rdar://problem/9795014>
+
+        Reviewed by Dan Bernstein.
+
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::printMainFrame): Added a public method
+        that PDFViewController could call.
+
+        * UIProcess/API/mac/PDFViewController.h:
+        * UIProcess/API/mac/PDFViewController.mm:
+        (-[WKPDFView PDFViewPerformPrint:]):
+        (WebKit::PDFViewController::print):
+        Connect PDFView delegate method for printing.
+
 2011-10-21  Sam Weinig  <sam@webkit.org>
 
         Lookup does not work on text using web fonts in WebKit2
index 041aa7be78e6f9598f68b4c22c07a253c5e6b481..3a4f2f6003ceaba38dc3434384abdd813bc80c27 100644 (file)
@@ -66,6 +66,7 @@ public:
     void openPDFInFinder();
     void savePDFToDownloadsFolder();
     void linkClicked(const String& url);
+    void print();
 
     void findString(const String&, FindOptions, unsigned maxMatchCount);
     void countStringMatches(const String&, FindOptions, unsigned maxMatchCount);
index 4585460f33cf462f94b3ade9e624b99a02737fdf..e75ca01c1fbe74d8b7c7d8d98279d7932a45c5dd 100644 (file)
@@ -360,6 +360,11 @@ static BOOL _PDFSelectionsAreEqual(PDFSelection *selectionA, PDFSelection *selec
     _pdfViewController->savePDFToDownloadsFolder();
 }
 
+- (void)PDFViewPerformPrint:(PDFView *)sender
+{
+    _pdfViewController->print();
+}
+
 @end
 
 namespace WebKit {
@@ -603,6 +608,11 @@ void PDFViewController::linkClicked(const String& url)
     page()->linkClicked(url, event);
 }
 
+void PDFViewController::print()
+{
+    page()->printMainFrame();
+}
+
 void PDFViewController::findString(const String& string, FindOptions options, unsigned maxMatchCount)
 {
     BOOL forward = !(options & FindOptionsBackwards);
index 1f179c07ab34a31da39cedb09558b72652bc9c44..5347140d386871963e6970dd2c39ef2f3b587020 100644 (file)
@@ -2200,6 +2200,11 @@ void WebPageProxy::printFrame(uint64_t frameID)
     m_isPerformingDOMPrintOperation = false;
 }
 
+void WebPageProxy::printMainFrame()
+{
+    printFrame(m_mainFrame->frameID());
+}
+
 #if PLATFORM(QT)
 void WebPageProxy::didChangeContentsSize(const IntSize& size)
 {
index eea1219958620aafd6b21835e87d3895ea8eb907..c770b1599fef86a2bce225f624675400a903cdc7 100644 (file)
@@ -568,6 +568,8 @@ public:
 
     void setShouldSendEventsSynchronously(bool sync) { m_shouldSendEventsSynchronously = sync; };
 
+    void printMainFrame();
+
 private:
     WebPageProxy(PageClient*, PassRefPtr<WebProcessProxy>, WebPageGroup*, uint64_t pageID);