Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Unified Diff: chrome/renderer/print_web_view_helper_linux.cc

Issue 8585017: PrintPreview: Honor the print media page size and margin values. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed review comments Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/print_web_view_helper_linux.cc
diff --git a/chrome/renderer/print_web_view_helper_linux.cc b/chrome/renderer/print_web_view_helper_linux.cc
index 6b6d9e6b43e07ed12894abc92ccb8b7ec177a9cc..76c225f1379e5193c329e50e23171c9b86917010 100644
--- a/chrome/renderer/print_web_view_helper_linux.cc
+++ b/chrome/renderer/print_web_view_helper_linux.cc
@@ -143,7 +143,9 @@ bool PrintWebViewHelper::RenderPages(const PrintMsg_PrintPages_Params& params,
PrepareFrameAndViewForPrint* prepare,
printing::Metafile* metafile) {
PrintMsg_Print_Params print_params = params.params;
- UpdatePrintableSizeInPrintParameters(frame, node, prepare, &print_params);
+ UpdatePrintableSizeInPrintParameters(frame, node, prepare, print_params,
+ ignore_frame_margins_css_,
+ fit_to_page_);
*page_count = prepare->GetExpectedPageCount();
if (!*page_count)
@@ -181,23 +183,23 @@ void PrintWebViewHelper::PrintPageInternal(
WebFrame* frame,
printing::Metafile* metafile) {
printing::PageSizeMargins page_layout_in_points;
+ double scale_factor = 1.0f;
GetPageSizeAndMarginsInPoints(frame, params.page_number, params.params,
- &page_layout_in_points);
-
+ ignore_frame_margins_css_, fit_to_page_,
+ &scale_factor, &page_layout_in_points);
gfx::Size page_size(
page_layout_in_points.content_width +
- page_layout_in_points.margin_right +
- page_layout_in_points.margin_left,
+ page_layout_in_points.margin_right +
vandebo (ex-Chrome) 2011/12/04 22:20:34 nit: I'd leave the indent the way it was - it's cl
kmadhusu 2011/12/05 09:06:54 Done.
+ page_layout_in_points.margin_left,
page_layout_in_points.content_height +
- page_layout_in_points.margin_top +
- page_layout_in_points.margin_bottom);
+ page_layout_in_points.margin_top +
+ page_layout_in_points.margin_bottom);
gfx::Rect content_area(page_layout_in_points.margin_left,
page_layout_in_points.margin_top,
page_layout_in_points.content_width,
page_layout_in_points.content_height);
-
SkDevice* device = metafile->StartPageForVectorCanvas(
- page_size, content_area, 1.0f);
+ page_size, content_area, scale_factor);
if (!device)
return;
@@ -213,8 +215,9 @@ void PrintWebViewHelper::PrintPageInternal(
// |page_number| is 0-based, so 1 is added.
// The scale factor on Linux is 1.
PrintHeaderAndFooter(canvas.get(), params.page_number + 1,
- print_preview_context_.total_page_count(), 1,
- page_layout_in_points, *header_footer_info_);
+ print_preview_context_.total_page_count(),
+ scale_factor, page_layout_in_points,
+ *header_footer_info_);
}
// Done printing. Close the device context to retrieve the compiled metafile.

Powered by Google App Engine
This is Rietveld 408576698