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

Unified Diff: components/printing/renderer/print_web_view_helper.cc

Issue 2633573002: Add Postscript Printing (Closed)
Patch Set: Fix Linux compile error Created 3 years, 11 months 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: components/printing/renderer/print_web_view_helper.cc
diff --git a/components/printing/renderer/print_web_view_helper.cc b/components/printing/renderer/print_web_view_helper.cc
index 3144c40e3de9dd340bd48f41e0bf61febe6030bf..79cfdd1232dad96a2f7b50bab2adc2c0e1f97c33 100644
--- a/components/printing/renderer/print_web_view_helper.cc
+++ b/components/printing/renderer/print_web_view_helper.cc
@@ -1099,6 +1099,7 @@ void PrintWebViewHelper::OnPrintForPrintPreview(
// printing and it expects real printable_area value.
// See http://crbug.com/123408
PrintMsg_Print_Params& print_params = print_pages_params_->params;
+ printer_printable_area_ = print_params.printable_area;
print_params.printable_area = gfx::Rect(print_params.page_size);
// Render Pages for printing.
@@ -1333,7 +1334,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
base::TimeTicks begin_time = base::TimeTicks::Now();
PrintPageInternal(page_params, print_preview_context_.prepared_frame(),
- initial_render_metafile, nullptr, nullptr);
+ initial_render_metafile, nullptr, nullptr, nullptr);
print_preview_context_.RenderedPreviewPage(
base::TimeTicks::Now() - begin_time);
if (draft_metafile.get()) {
@@ -1834,7 +1835,8 @@ void PrintWebViewHelper::PrintPageInternal(
blink::WebLocalFrame* frame,
PdfMetafileSkia* metafile,
gfx::Size* page_size_in_dpi,
- gfx::Rect* content_area_in_dpi) {
+ gfx::Rect* content_area_in_dpi,
+ gfx::Rect* printable_area_in_dpi) {
PageSizeMargins page_layout_in_points;
double css_scale_factor = 1.0f;
@@ -1864,6 +1866,9 @@ void PrintWebViewHelper::PrintPageInternal(
*content_area_in_dpi =
gfx::Rect(0, 0, page_size_in_dpi->width(), page_size_in_dpi->height());
}
+ if (printable_area_in_dpi) {
+ *printable_area_in_dpi = printer_printable_area_;
+ }
gfx::Rect canvas_area =
params.params.display_header_footer ? gfx::Rect(page_size) : content_area;

Powered by Google App Engine
This is Rietveld 408576698