Chromium Code Reviews| 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 3e77142273bf41af06906e9d9f0b6a56ea6718b5..70198bfc77afbac453930f708b6240755b8205be 100644 |
| --- a/components/printing/renderer/print_web_view_helper.cc |
| +++ b/components/printing/renderer/print_web_view_helper.cc |
| @@ -234,7 +234,7 @@ void CalculatePageLayoutFromPrintParams( |
| int content_height = params.content_size.height(); |
| // Scale the content to its normal size for purpose of computing page layout. |
| // Otherwise we will get negative margins. |
| - if (scale_factor > 0 && (fit_to_page || params.print_to_pdf)) { |
| + if (scale_factor >= 0.01f && (fit_to_page || params.print_to_pdf)) { |
|
Lei Zhang
2016/10/29 00:26:53
Add a constexpr double kEpsilon constant and use t
rbpotter
2016/10/29 00:41:53
Done.
|
| content_width = |
| static_cast<int>(static_cast<double>(content_width) * scale_factor); |
| content_height = |
| @@ -721,7 +721,7 @@ PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint( |
| frame->printBegin(web_print_params_, node_to_print_); |
| double scale_factor = 1.0f; |
| #if defined(ENABLE_PRINT_PREVIEW) |
| - if (print_params.scale_factor > 0) |
| + if (print_params.scale_factor >= 0.01f) |
| scale_factor = print_params.scale_factor; |
| #endif |
| print_params = CalculatePrintParamsForCss( |
| @@ -1232,7 +1232,7 @@ bool PrintWebViewHelper::CreatePreviewDocument() { |
| PageSizeMargins default_page_layout; |
| double scale_factor = |
| - print_params.scale_factor > 0 ? print_params.scale_factor : 1.0f; |
| + print_params.scale_factor >= 0.01f ? print_params.scale_factor : 1.0f; |
| ComputePageLayoutInPointsForCss(print_preview_context_.prepared_frame(), 0, |
| print_params, ignore_css_margins_, |
| @@ -1828,7 +1828,7 @@ void PrintWebViewHelper::PrintPageInternal( |
| double css_scale_factor = 1.0f; |
| #if defined(ENABLE_PRINT_PREVIEW) |
| - if (params.params.scale_factor > 0) |
| + if (params.params.scale_factor >= 0.01f) |
| css_scale_factor = params.params.scale_factor; |
| #endif |
| ComputePageLayoutInPointsForCss(frame, params.page_number, params.params, |