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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 &content_area); | 128 &content_area); |
129 if (content_rect) | 129 if (content_rect) |
130 *content_rect = content_area; | 130 *content_rect = content_area; |
131 | 131 |
132 scale_factor *= webkit_shrink_factor; | 132 scale_factor *= webkit_shrink_factor; |
133 | 133 |
134 gfx::Rect canvas_area = | 134 gfx::Rect canvas_area = |
135 params.display_header_footer ? gfx::Rect(*page_size) : content_area; | 135 params.display_header_footer ? gfx::Rect(*page_size) : content_area; |
136 | 136 |
137 { | 137 { |
138 SkCanvas* canvas = metafile->GetVectorCanvasForNewPage( | 138 cc::PaintCanvas* canvas = metafile->GetVectorCanvasForNewPage( |
danakj
2017/01/20 23:34:14
same?
| |
139 *page_size, canvas_area, scale_factor); | 139 *page_size, canvas_area, scale_factor); |
140 if (!canvas) | 140 if (!canvas) |
141 return; | 141 return; |
142 | 142 |
143 MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile); | 143 MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile); |
144 skia::SetIsPreviewMetafile(*canvas, is_preview); | 144 skia::SetIsPreviewMetafile(*canvas, is_preview); |
145 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) | 145 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
146 if (params.display_header_footer) { | 146 if (params.display_header_footer) { |
147 PrintHeaderAndFooter(static_cast<blink::WebCanvas*>(canvas), | 147 PrintHeaderAndFooter(canvas, page_number + 1, |
148 page_number + 1, | |
149 print_preview_context_.total_page_count(), *frame, | 148 print_preview_context_.total_page_count(), *frame, |
150 scale_factor, page_layout_in_points, params); | 149 scale_factor, page_layout_in_points, params); |
151 } | 150 } |
152 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) | 151 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) |
153 RenderPageContent(frame, page_number, canvas_area, content_area, | 152 RenderPageContent(frame, page_number, canvas_area, content_area, |
154 scale_factor, static_cast<blink::WebCanvas*>(canvas)); | 153 scale_factor, canvas); |
155 } | 154 } |
156 | 155 |
157 // Done printing. Close the device context to retrieve the compiled metafile. | 156 // Done printing. Close the device context to retrieve the compiled metafile. |
158 metafile->FinishPage(); | 157 metafile->FinishPage(); |
159 } | 158 } |
160 | 159 |
161 } // namespace printing | 160 } // namespace printing |
OLD | NEW |