Title: [118062] trunk
Revision
118062
Author
commit-qu...@webkit.org
Date
2012-05-22 15:11:12 -0700 (Tue, 22 May 2012)

Log Message

[Chromium] Use overloaded printBegin() webkit API to support auto fit to page functionality.
https://bugs.webkit.org/show_bug.cgi?id=86684

Patch by Kausalya Madhusudhanan <kmadh...@chromium.org> on 2012-05-22
Reviewed by Darin Fisher.

Source/WebKit/chromium:

* public/WebFrame.h:
(WebFrame):
* public/WebPlugin.h:
(WebPlugin):
* public/WebPrintParams.h:
(WebKit::WebPrintParams::WebPrintParams):
(WebPrintParams):
* src/WebFrameImpl.cpp:
(WebKit):
* src/WebFrameImpl.h:
(WebFrameImpl):
* src/WebPluginContainerImpl.cpp:
(WebKit::WebPluginContainerImpl::printBegin):

Tools:

* DumpRenderTree/chromium/LayoutTestController.cpp:
(LayoutTestController::numberOfPages):
* DumpRenderTree/chromium/WebViewHost.cpp:
(WebViewHost::printPage):

Modified Paths

Diff

Modified: trunk/Source/WebKit/chromium/ChangeLog (118061 => 118062)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-05-22 22:08:20 UTC (rev 118061)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-05-22 22:11:12 UTC (rev 118062)
@@ -1,3 +1,24 @@
+2012-05-22  Kausalya Madhusudhanan  <kmadh...@chromium.org>
+
+        [Chromium] Use overloaded printBegin() webkit API to support auto fit to page functionality.
+        https://bugs.webkit.org/show_bug.cgi?id=86684
+
+        Reviewed by Darin Fisher.
+
+        * public/WebFrame.h:
+        (WebFrame):
+        * public/WebPlugin.h:
+        (WebPlugin):
+        * public/WebPrintParams.h:
+        (WebKit::WebPrintParams::WebPrintParams):
+        (WebPrintParams):
+        * src/WebFrameImpl.cpp:
+        (WebKit):
+        * src/WebFrameImpl.h:
+        (WebFrameImpl):
+        * src/WebPluginContainerImpl.cpp:
+        (WebKit::WebPluginContainerImpl::printBegin):
+
 2012-05-22  Adam Barth  <aba...@webkit.org>
 
         [Chromium] Expose setMediaPlaybackRequiresUserGesture via WebSettings

Modified: trunk/Source/WebKit/chromium/public/WebFrame.h (118061 => 118062)


--- trunk/Source/WebKit/chromium/public/WebFrame.h	2012-05-22 22:08:20 UTC (rev 118061)
+++ trunk/Source/WebKit/chromium/public/WebFrame.h	2012-05-22 22:11:12 UTC (rev 118062)
@@ -455,23 +455,6 @@
 
     // Printing ------------------------------------------------------------
 
-    // Reformats the WebFrame for printing. printContentSize is the print
-    // content size in points (a point is 1/72 of an inch). If constrainToNode
-    // node is specified, then only the given node is printed (for now only
-    // plugins are supported), instead of the entire frame. printerDPI is the
-    // user selected, DPI for the printer. Returns the number of pages that can
-    // be printed at the given page size. The out param useBrowserOverlays
-    // specifies whether the browser process should use its overlays (header,
-    // footer, margins etc) or whether the renderer controls this.
-    //
-    // FIXME: This is a temporary interface to avoid the compile errors. Remove
-    // this interface after fixing crbug.com/85132. We will use the overloaded
-    // printBegin function.
-    virtual int printBegin(const WebSize& printContentSize,
-                           const WebNode& constrainToNode = WebNode(),
-                           int printerDPI = 72,
-                           bool* useBrowserOverlays = 0) = 0;
-
     // Reformats the WebFrame for printing. WebPrintParams specifies the printable
     // content size, paper size, printable area size, printer DPI and print
     // scaling option. If constrainToNode node is specified, then only the given node

Modified: trunk/Source/WebKit/chromium/public/WebPlugin.h (118061 => 118062)


--- trunk/Source/WebKit/chromium/public/WebPlugin.h	2012-05-22 22:08:20 UTC (rev 118061)
+++ trunk/Source/WebKit/chromium/public/WebPlugin.h	2012-05-22 22:11:12 UTC (rev 118062)
@@ -98,12 +98,6 @@
     // the printer's printable area.
     virtual bool isPrintScalingDisabled() { return false; }
 
-    // Sets up printing at the given print rect and printer DPI.
-    // printContentArea is in points ( a point is 1/72 of an inch). Returns the
-    // number of pages to be printed at these settings.
-    // FIXME: Remove this function after fixing crbug.com/85132. For detailed
-    // information, please refer to the comments in WebFrame.h
-    virtual int printBegin(const WebRect& printContentArea, int printerDPI) { return 0; }
     // Sets up printing with the specified printParams. Returns the number of
     // pages to be printed at these settings.
     virtual int printBegin(const WebPrintParams& printParams) { return 0; }

Modified: trunk/Source/WebKit/chromium/public/WebPrintParams.h (118061 => 118062)


--- trunk/Source/WebKit/chromium/public/WebPrintParams.h	2012-05-22 22:08:20 UTC (rev 118061)
+++ trunk/Source/WebKit/chromium/public/WebPrintParams.h	2012-05-22 22:11:12 UTC (rev 118062)
@@ -59,6 +59,13 @@
         : printerDPI(72)
         , printScalingOption(WebPrintScalingOptionFitToPrintableArea) { }
 
+    WebPrintParams(const WebSize& paperSize)
+        : printContentArea(WebRect(0, 0, paperSize.width, paperSize.height))
+        , printableArea(WebRect(0, 0, paperSize.width, paperSize.height))
+        , paperSize(paperSize)
+        , printerDPI(72)
+        , printScalingOption(WebPrintScalingOptionSourceSize) { }
+
     WebPrintParams(const WebRect& printContentArea, const WebRect& printableArea, const WebSize& paperSize, int printerDPI, WebPrintScalingOption printScalingOption)
         : printContentArea(printContentArea)
         , printableArea(printableArea)

Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp (118061 => 118062)


--- trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp	2012-05-22 22:08:20 UTC (rev 118061)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp	2012-05-22 22:11:12 UTC (rev 118062)
@@ -1449,21 +1449,6 @@
     return node->renderer()->positionForPoint(result.localPoint());
 }
 
-// TODO(kmadh...@chromium.org): Remove this function after fixing
-// crbug.com/85132. For more information, please refer to the comments in
-// WebFrame.h
-int WebFrameImpl::printBegin(const WebSize& printContentSize,
-                             const WebNode& constrainToNode,
-                             int printerDPI,
-                             bool* useBrowserOverlays) {
-    WebRect printableArea(0, 0, printContentSize.width, printContentSize.height);
-    WebSize paperSize(printContentSize);
-    WebRect printContentArea(0, 0, printContentSize.width, printContentSize.height);
-    WebPrintParams printParams(printContentArea, printableArea, paperSize,
-                               printerDPI, WebPrintScalingOptionSourceSize);
-    return printBegin(printParams, constrainToNode, useBrowserOverlays);
-}
-
 int WebFrameImpl::printBegin(const WebPrintParams& printParams,
                              const WebNode& constrainToNode,
                              bool* useBrowserOverlays)

Modified: trunk/Source/WebKit/chromium/src/WebFrameImpl.h (118061 => 118062)


--- trunk/Source/WebKit/chromium/src/WebFrameImpl.h	2012-05-22 22:08:20 UTC (rev 118061)
+++ trunk/Source/WebKit/chromium/src/WebFrameImpl.h	2012-05-22 22:11:12 UTC (rev 118062)
@@ -178,12 +178,6 @@
     virtual bool selectWordAroundCaret();
     virtual void selectRange(const WebPoint& start, const WebPoint& end);
     virtual void selectRange(const WebRange&);
-    // FIXME: Remove this function after fixing crbug.com/85132. For detailed
-    // information, please refer to the comments in WebFrame.h
-    virtual int printBegin(const WebSize& printContentSize,
-                           const WebNode& constrainToNode,
-                           int printerDPI,
-                           bool* useBrowserOverlays);
     virtual int printBegin(const WebPrintParams&,
                            const WebNode& constrainToNode,
                            bool* useBrowserOverlays);

Modified: trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp (118061 => 118062)


--- trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp	2012-05-22 22:08:20 UTC (rev 118061)
+++ trunk/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp	2012-05-22 22:11:12 UTC (rev 118062)
@@ -254,10 +254,7 @@
 
 int WebPluginContainerImpl::printBegin(const WebPrintParams& printParams) const
 {
-    return m_webPlugin->printBegin(printParams.printContentArea, printParams.printerDPI);
-    // FIXME: After committing this CL, update the chrome plugin printBegin()
-    // function to use the overloaded printBegin function.
-    // return m_webPlugin->printBegin(printParams);
+    return m_webPlugin->printBegin(printParams);
 }
 
 bool WebPluginContainerImpl::printPage(int pageNumber,

Modified: trunk/Tools/ChangeLog (118061 => 118062)


--- trunk/Tools/ChangeLog	2012-05-22 22:08:20 UTC (rev 118061)
+++ trunk/Tools/ChangeLog	2012-05-22 22:11:12 UTC (rev 118062)
@@ -1 +1,13 @@
+2012-05-22  Kausalya Madhusudhanan  <kmadh...@chromium.org>
+
+        [Chromium] Use overloaded printBegin() webkit API to support auto fit to page functionality.
+        https://bugs.webkit.org/show_bug.cgi?id=86684
+
+        Reviewed by Darin Fisher.
+
+        * DumpRenderTree/chromium/LayoutTestController.cpp:
+        (LayoutTestController::numberOfPages):
+        * DumpRenderTree/chromium/WebViewHost.cpp:
+        (WebViewHost::printPage):
+
 == Rolled over to ChangeLog-2012-05-22 ==

Modified: trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp (118061 => 118062)


--- trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp	2012-05-22 22:08:20 UTC (rev 118061)
+++ trunk/Tools/DumpRenderTree/chromium/LayoutTestController.cpp	2012-05-22 22:11:12 UTC (rev 118062)
@@ -54,6 +54,7 @@
 #include "WebKit.h"
 #include "WebNotificationPresenter.h"
 #include "WebPermissions.h"
+#include "WebPrintParams.h"
 #include "WebScriptSource.h"
 #include "WebSecurityPolicy.h"
 #include "platform/WebSerializedScriptValue.h"
@@ -1807,8 +1808,8 @@
     WebFrame* frame = m_shell->webView()->mainFrame();
     if (!frame)
         return;
-    WebSize size(pageWidthInPixels, pageHeightInPixels);
-    int numberOfPages = frame->printBegin(size);
+    WebPrintParams printParams(WebSize(pageWidthInPixels, pageHeightInPixels));
+    int numberOfPages = frame->printBegin(printParams);
     frame->printEnd();
     result->set(numberOfPages);
 }

Modified: trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp (118061 => 118062)


--- trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2012-05-22 22:08:20 UTC (rev 118061)
+++ trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp	2012-05-22 22:11:12 UTC (rev 118062)
@@ -55,6 +55,7 @@
 #include "WebPluginParams.h"
 #include "WebPopupMenu.h"
 #include "WebPopupType.h"
+#include "WebPrintParams.h"
 #include "WebRange.h"
 #include "platform/WebRect.h"
 #include "WebScreenInfo.h"
@@ -1853,7 +1854,7 @@
 void WebViewHost::printPage(WebKit::WebFrame* frame)
 {
     WebSize pageSizeInPixels = webWidget()->size();
-
-    frame->printBegin(pageSizeInPixels);
+    WebPrintParams printParams(pageSizeInPixels);
+    frame->printBegin(printParams);
     frame->printEnd();
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to