| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/renderer/print_web_view_helper.h" | 5 #include "chrome/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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 DCHECK(success); | 165 DCHECK(success); |
| 166 // printPage can create autoreleased references to |context|. PDF contexts | 166 // printPage can create autoreleased references to |context|. PDF contexts |
| 167 // don't write all their data until they are destroyed, so we need to make | 167 // don't write all their data until they are destroyed, so we need to make |
| 168 // certain that there are no lingering references. | 168 // certain that there are no lingering references. |
| 169 base::mac::ScopedNSAutoreleasePool pool; | 169 base::mac::ScopedNSAutoreleasePool pool; |
| 170 CGContextRef cgContext = metafile->context(); | 170 CGContextRef cgContext = metafile->context(); |
| 171 CGContextRef canvas_ptr = cgContext; | 171 CGContextRef canvas_ptr = cgContext; |
| 172 #endif | 172 #endif |
| 173 | 173 |
| 174 printing::PageSizeMargins page_layout_in_points; | 174 printing::PageSizeMargins page_layout_in_points; |
| 175 GetPageSizeAndMarginsInPoints(frame, page_number, | 175 GetPageSizeAndMarginsInPoints( |
| 176 print_pages_params_->params, | 176 frame, page_number, print_pages_params_->params, |
| 177 &page_layout_in_points); | 177 ignore_frame_margins_css_, fit_to_page_, NULL, |
| 178 &page_layout_in_points); |
| 178 | 179 |
| 179 #if !defined(USE_SKIA) | 180 #if !defined(USE_SKIA) |
| 180 // For CoreGraphics, print in the margins before printing in the content | 181 // For CoreGraphics, print in the margins before printing in the content |
| 181 // area so that we don't spill over. Webkit draws a white background in the | 182 // area so that we don't spill over. Webkit draws a white background in the |
| 182 // content area and this acts as a clip. | 183 // content area and this acts as a clip. |
| 183 // TODO(aayushkumar): Combine the calls to PrintHeaderAndFooter once we | 184 // TODO(aayushkumar): Combine the calls to PrintHeaderAndFooter once we |
| 184 // can draw in the margins safely in Skia in any order. | 185 // can draw in the margins safely in Skia in any order. |
| 185 if (print_pages_params_->params.display_header_footer) { | 186 if (print_pages_params_->params.display_header_footer) { |
| 186 PrintHeaderAndFooter(canvas_ptr, page_number + 1, | 187 PrintHeaderAndFooter(canvas_ptr, page_number + 1, |
| 187 print_preview_context_.total_page_count(), | 188 print_preview_context_.total_page_count(), |
| (...skipping 11 matching lines...) Expand all Loading... |
| 199 print_preview_context_.total_page_count(), | 200 print_preview_context_.total_page_count(), |
| 200 scale_factor, page_layout_in_points, | 201 scale_factor, page_layout_in_points, |
| 201 *header_footer_info_); | 202 *header_footer_info_); |
| 202 } | 203 } |
| 203 #endif // defined(USE_SKIA) | 204 #endif // defined(USE_SKIA) |
| 204 } | 205 } |
| 205 | 206 |
| 206 // Done printing. Close the device context to retrieve the compiled metafile. | 207 // Done printing. Close the device context to retrieve the compiled metafile. |
| 207 metafile->FinishPage(); | 208 metafile->FinishPage(); |
| 208 } | 209 } |
| OLD | NEW |