| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/printing/renderer/print_web_view_helper.h" | 5 #include "components/printing/renderer/print_web_view_helper.h" |
| 6 | 6 |
| 7 #import <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/mac/scoped_nsautorelease_pool.h" | 10 #include "base/mac/scoped_nsautorelease_pool.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 } | 107 } |
| 108 #endif // defined(ENABLE_PRINT_PREVIEW) | 108 #endif // defined(ENABLE_PRINT_PREVIEW) |
| 109 | 109 |
| 110 void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params, | 110 void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params, |
| 111 int page_number, | 111 int page_number, |
| 112 blink::WebLocalFrame* frame, | 112 blink::WebLocalFrame* frame, |
| 113 bool is_preview, | 113 bool is_preview, |
| 114 PdfMetafileSkia* metafile, | 114 PdfMetafileSkia* metafile, |
| 115 gfx::Size* page_size, | 115 gfx::Size* page_size, |
| 116 gfx::Rect* content_rect) { | 116 gfx::Rect* content_rect) { |
| 117 double scale_factor = params.scale_factor > 0 ? params.scale_factor : 1.0f; | 117 double scale_factor = |
| 118 params.scale_factor >= kEpsilon ? params.scale_factor : 1.0f; |
| 118 double webkit_shrink_factor = frame->getPrintPageShrink(page_number); | 119 double webkit_shrink_factor = frame->getPrintPageShrink(page_number); |
| 119 PageSizeMargins page_layout_in_points; | 120 PageSizeMargins page_layout_in_points; |
| 120 gfx::Rect content_area; | 121 gfx::Rect content_area; |
| 121 | 122 |
| 122 ComputePageLayoutInPointsForCss(frame, page_number, params, | 123 ComputePageLayoutInPointsForCss(frame, page_number, params, |
| 123 ignore_css_margins_, &scale_factor, | 124 ignore_css_margins_, &scale_factor, |
| 124 &page_layout_in_points); | 125 &page_layout_in_points); |
| 125 GetPageSizeAndContentAreaFromPageLayout(page_layout_in_points, page_size, | 126 GetPageSizeAndContentAreaFromPageLayout(page_layout_in_points, page_size, |
| 126 &content_area); | 127 &content_area); |
| 127 if (content_rect) | 128 if (content_rect) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 150 #endif // defined(ENABLE_PRINT_PREVIEW) | 151 #endif // defined(ENABLE_PRINT_PREVIEW) |
| 151 RenderPageContent(frame, page_number, canvas_area, content_area, | 152 RenderPageContent(frame, page_number, canvas_area, content_area, |
| 152 scale_factor, static_cast<blink::WebCanvas*>(canvas)); | 153 scale_factor, static_cast<blink::WebCanvas*>(canvas)); |
| 153 } | 154 } |
| 154 | 155 |
| 155 // Done printing. Close the device context to retrieve the compiled metafile. | 156 // Done printing. Close the device context to retrieve the compiled metafile. |
| 156 metafile->FinishPage(); | 157 metafile->FinishPage(); |
| 157 } | 158 } |
| 158 | 159 |
| 159 } // namespace printing | 160 } // namespace printing |
| OLD | NEW |