Index: chrome/renderer/print_web_view_helper.h |
diff --git a/chrome/renderer/print_web_view_helper.h b/chrome/renderer/print_web_view_helper.h |
index 24de40ef2530380b8025b96decc83c102e603bad..2115850ee481b00e92799ca5a55d6b8c8123d0ca 100644 |
--- a/chrome/renderer/print_web_view_helper.h |
+++ b/chrome/renderer/print_web_view_helper.h |
@@ -117,6 +117,19 @@ class PrintWebViewHelper |
// Print the document with the print preview frame/node. |
void OnPrintForSystemDialog(); |
+ // Get |page_size| and |content_area| information from |
+ // |page_layout_in_points|. |
+ void GetPageSizeAndContentAreaFromPageLayout( |
+ const printing::PageSizeMargins& page_layout_in_points, |
+ gfx::Size* page_size, |
+ gfx::Rect* content_area); |
+ |
+ // Update |ignore_css_margins_| based on settings. |
+ void UpdateFrameMarginsCssInfo(const base::DictionaryValue& settings); |
+ |
+ // Returns true if the current destination printer is PRINT_TO_PDF. |
+ bool IsPrintToPdfRequested(const base::DictionaryValue& settings); |
+ |
// Initiate print preview. |
void OnInitiatePrintPreview(); |
@@ -216,14 +229,16 @@ class PrintWebViewHelper |
// |metafile| or a new one. In either case, the caller owns both |metafile| |
// and the result. |
printing::Metafile* RenderPage(const PrintMsg_Print_Params& params, |
- float* scale_factor, int page_number, |
+ double* scale_factor, int page_number, |
vandebo (ex-Chrome)
2012/01/03 21:55:12
output args should be at the end of the arg list.
kmadhusu
2012/01/04 16:55:35
oops.. fixed.
|
bool is_preview, WebKit::WebFrame* frame, |
- printing::Metafile* metafile); |
+ printing::Metafile* metafile, |
+ gfx::Size* page_size_in_dpi, |
+ gfx::Rect* content_area_in_dpi); |
#elif defined(OS_MACOSX) |
- void RenderPage(const gfx::Size& page_size, const gfx::Rect& content_area, |
- const float& scale_factor, int page_number, |
- WebKit::WebFrame* frame, bool is_preview, |
- printing::Metafile* metafile); |
+ void RenderPage(const PrintMsg_Print_Params& params, |
+ int page_number, WebKit::WebFrame* frame, bool is_preview, |
+ printing::Metafile* metafile, double* scale_factor, |
+ gfx::Size* page_size); |
#elif defined(OS_POSIX) |
bool RenderPages(const PrintMsg_PrintPages_Params& params, |
WebKit::WebFrame* frame, const WebKit::WebNode& node, |
@@ -238,17 +253,25 @@ class PrintWebViewHelper |
bool CopyMetafileDataToSharedMem(printing::Metafile* metafile, |
base::SharedMemoryHandle* shared_mem_handle); |
- static void GetPageSizeAndMarginsInPoints( |
+ // Helper method to get page layout in points and fit to page if needed. |
+ static void ComputePageLayout( |
WebKit::WebFrame* frame, |
int page_index, |
const PrintMsg_Print_Params& default_params, |
+ bool ignore_css_margins, |
+ bool fit_to_page, |
+ double* scale_factor, |
printing::PageSizeMargins* page_layout_in_points); |
- static void UpdatePrintableSizeInPrintParameters( |
+ // Prepare the frame and view for print and then call this function to honor |
+ // the CSS page layout information. |
+ static void UpdateFrameAndViewFromCssPageLayout( |
WebKit::WebFrame* frame, |
const WebKit::WebNode& node, |
PrepareFrameAndViewForPrint* prepare, |
- PrintMsg_Print_Params* params); |
+ const PrintMsg_Print_Params& params, |
+ bool ignore_css_margins, |
+ bool fit_to_page); |
// Given the |device| and |canvas| to draw on, prints the appropriate headers |
// and footers using strings from |header_footer_info| on to the canvas. |
@@ -299,6 +322,11 @@ class PrintWebViewHelper |
scoped_ptr<PrintMsg_PrintPages_Params> print_pages_params_; |
bool is_preview_enabled_; |
bool is_print_ready_metafile_sent_; |
+ bool ignore_css_margins_; |
+ |
+ // True if we need to auto fit to page else false. |
+ // NOTE: When we print to pdf, we don't fit to page. |
+ bool fit_to_page_; |
// Used for scripted initiated printing blocking. |
base::Time last_cancelled_script_print_; |
@@ -343,7 +371,9 @@ class PrintWebViewHelper |
// Create the print preview document. |pages| is empty to print all pages. |
bool CreatePreviewDocument(PrintMsg_Print_Params* params, |
- const std::vector<int>& pages); |
+ const std::vector<int>& pages, |
+ bool ignore_css_margins, |
+ bool fit_to_page); |
// Called after a page gets rendered. |page_time| is how long the |
// rendering took. |