Commit 2fc4e1ba authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Consistently apply scale factor when printing.

In https://crrev.com/560879, PrintRenderFrameHelper::PrintPagesNative()
started to consider the scale factor. The Linux version of
PrintPagesNative() applied it consistently to every page using
GetScaleFactor(), but the Windows/Mac version of PrintPagesNative() is
missing a GetScaleFactor() call for the first page.

The comments for patch set 15 of the CL say PrintPagesNative() is most
commonly used for printing with the system dialog, where the scale
factor is always 1, so the missing GetScaleFactor() call does not matter
in this case. The only time when the scale factor may be set to some
other value is for headless printing. Likely nobody noticed because:

- Headless printing on Win/Mac is uncommon.
- Headless printing with a different scale factor is uncommon.
- The combination of the two is rare.

Nevertheless, the missing GetScaleFactor() should be added.

Change-Id: Ic4318e3bd0a9537e0170454cbdfcb7015efad237
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1705643Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#678429}
parent 32e80abc
...@@ -1795,8 +1795,9 @@ bool PrintRenderFrameHelper::PrintPagesNative(blink::WebLocalFrame* frame, ...@@ -1795,8 +1795,9 @@ bool PrintRenderFrameHelper::PrintPagesNative(blink::WebLocalFrame* frame,
PrintHostMsg_DidPrintDocument_Params page_params; PrintHostMsg_DidPrintDocument_Params page_params;
PrintPageInternal(print_params, printed_pages[0], page_count, PrintPageInternal(print_params, printed_pages[0], page_count,
print_params.scale_factor, frame, &metafile, GetScaleFactor(print_params.scale_factor, is_pdf), frame,
&page_params.page_size, &page_params.content_area); &metafile, &page_params.page_size,
&page_params.content_area);
for (size_t i = 1; i < printed_pages.size(); ++i) { for (size_t i = 1; i < printed_pages.size(); ++i) {
PrintPageInternal(print_params, printed_pages[i], page_count, PrintPageInternal(print_params, printed_pages[i], page_count,
GetScaleFactor(print_params.scale_factor, is_pdf), frame, GetScaleFactor(print_params.scale_factor, is_pdf), frame,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment