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 9ee4cd9cc3c91ab72584ea76c0223434075fdbab..823c9574eb870e6f7c988d0711e63a2024992c97 100644 |
--- a/components/printing/renderer/print_web_view_helper.cc |
+++ b/components/printing/renderer/print_web_view_helper.cc |
@@ -78,9 +78,6 @@ enum PrintPreviewHelperEvents { |
const double kMinDpi = 1.0; |
-// Also set in third_party/WebKit/Source/core/page/PrintContext.cpp |
-const float kPrintingMinimumShrinkFactor = 1.333f; |
- |
#if defined(ENABLE_PRINT_PREVIEW) |
bool g_is_preview_enabled = true; |
@@ -680,19 +677,15 @@ PrepareFrameAndViewForPrint::~PrepareFrameAndViewForPrint() { |
void PrepareFrameAndViewForPrint::ResizeForPrinting() { |
// Layout page according to printer page size. Since WebKit shrinks the |
- // size of the page automatically (from 133.3% to 200%) we trick it to |
- // think the page is 133.3% larger so the size of the page is correct for |
+ // size of the page automatically (from 125% to 200%) we trick it to |
+ // think the page is 125% larger so the size of the page is correct for |
// minimum (default) scaling. |
- // The scaling factor 1.25 was originally chosen as a magic number that |
- // was 'about right'. However per https://crbug.com/273306 1.333 seems to be |
- // the number that produces output with the correct physical size for elements |
- // that are specified in cm, mm, pt etc. |
// This is important for sites that try to fill the page. |
+ // The 1.25 value is |printingMinimumShrinkFactor|. |
gfx::Size print_layout_size(web_print_params_.printContentArea.width, |
web_print_params_.printContentArea.height); |
print_layout_size.set_height( |
- static_cast<int>(static_cast<double>(print_layout_size.height()) * |
- kPrintingMinimumShrinkFactor)); |
+ static_cast<int>(static_cast<double>(print_layout_size.height()) * 1.25)); |
if (!frame()) |
return; |
@@ -1787,12 +1780,12 @@ void PrintWebViewHelper::PrintPageInternal( |
#if defined(ENABLE_PRINT_PREVIEW) |
if (params.params.display_header_footer) { |
- // TODO(thestig): Figure out why Linux needs this. It is almost certainly |
- // |printingMinimumShrinkFactor| from Blink. |
+ // TODO(thestig): Figure out why Linux needs this. The value may be |
+ // |printingMinimumShrinkFactor|. |
#if defined(OS_WIN) |
const float fudge_factor = 1; |
#else |
- const float fudge_factor = kPrintingMinimumShrinkFactor; |
+ const float fudge_factor = 1.25; |
#endif |
// |page_number| is 0-based, so 1 is added. |
PrintHeaderAndFooter(canvas, params.page_number + 1, |