summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryuzo@chromium.org <yuzo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-04 03:29:34 +0000
committeryuzo@chromium.org <yuzo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-04 03:29:34 +0000
commit386083e9ce54f1ee0c593450dacc8e1856faa58b (patch)
tree69d2081cb4e6b95cf7c74ddd4d7b061313b6b210
parent0bf2a95128f5b67d6b56db4a9ed9857c690e9c0c (diff)
downloadchromium_src-386083e9ce54f1ee0c593450dacc8e1856faa58b.zip
chromium_src-386083e9ce54f1ee0c593450dacc8e1856faa58b.tar.gz
chromium_src-386083e9ce54f1ee0c593450dacc8e1856faa58b.tar.bz2
Fix for Issue 50923: page is not properly positioned on paper when paper is
larger than page BUG=50923 TEST=manual Review URL: http://codereview.chromium.org/3067022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54865 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/renderer/print_web_view_helper.cc8
-rw-r--r--chrome/renderer/print_web_view_helper_win.cc4
2 files changed, 7 insertions, 5 deletions
diff --git a/chrome/renderer/print_web_view_helper.cc b/chrome/renderer/print_web_view_helper.cc
index d5b586c..6e07318 100644
--- a/chrome/renderer/print_web_view_helper.cc
+++ b/chrome/renderer/print_web_view_helper.cc
@@ -179,7 +179,6 @@ void PrintWebViewHelper::Print(WebFrame* frame, bool script_initiated) {
// If the settings are invalid, early quit.
if (print_settings.params.dpi &&
print_settings.params.document_cookie) {
- UpdatePrintableSizeInPrintParameters(frame, &print_settings.params);
if (print_settings.params.selection_only) {
CopyAndPrint(print_settings, frame);
} else {
@@ -311,13 +310,16 @@ void PrintWebViewHelper::PrintPageAsJPEG(
#if defined(OS_MACOSX) || defined(OS_WIN)
void PrintWebViewHelper::PrintPages(const ViewMsg_PrintPages_Params& params,
WebFrame* frame) {
- PrepareFrameAndViewForPrint prep_frame_view(params.params,
+ ViewMsg_Print_Params printParams = params.params;
+ UpdatePrintableSizeInPrintParameters(frame, &printParams);
+
+ PrepareFrameAndViewForPrint prep_frame_view(printParams,
frame,
frame->view());
int page_count = prep_frame_view.GetExpectedPageCount();
Send(new ViewHostMsg_DidGetPrintedPagesCount(routing_id(),
- params.params.document_cookie,
+ printParams.document_cookie,
page_count));
if (!page_count)
return;
diff --git a/chrome/renderer/print_web_view_helper_win.cc b/chrome/renderer/print_web_view_helper_win.cc
index 526ed56..586e081 100644
--- a/chrome/renderer/print_web_view_helper_win.cc
+++ b/chrome/renderer/print_web_view_helper_win.cc
@@ -54,8 +54,8 @@ void PrintWebViewHelper::PrintPage(const ViewMsg_PrintPage_Params& params,
int size_y = static_cast<int>(content_height_in_points *
params.params.max_shrink);
// Calculate the dpi adjustment.
- float shrink = static_cast<float>(canvas_size.width()) /
- params.params.printable_size.width();
+ float shrink = static_cast<float>(params.params.desired_dpi /
+ params.params.dpi);
#if 0
// TODO(maruel): This code is kept for testing until the 100% GDI drawing
// code is stable. maruels use this code's output as a reference when the