| 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 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 margin_left_in_pixels - | 989 margin_left_in_pixels - |
| 990 margin_right_in_pixels); | 990 margin_right_in_pixels); |
| 991 page_layout_in_points->content_height = | 991 page_layout_in_points->content_height = |
| 992 ConvertPixelsToPoint(page_size_in_pixels.height - | 992 ConvertPixelsToPoint(page_size_in_pixels.height - |
| 993 margin_top_in_pixels - | 993 margin_top_in_pixels - |
| 994 margin_bottom_in_pixels); | 994 margin_bottom_in_pixels); |
| 995 | 995 |
| 996 // Invalid page size and/or margins. We just use the default setting. | 996 // Invalid page size and/or margins. We just use the default setting. |
| 997 if (page_layout_in_points->content_width < 1.0 || | 997 if (page_layout_in_points->content_width < 1.0 || |
| 998 page_layout_in_points->content_height < 1.0) { | 998 page_layout_in_points->content_height < 1.0) { |
| 999 // TODO(vandebo) remove CHECK after debugging crbug.com/96063 | |
| 1000 CHECK(frame != NULL); | 999 CHECK(frame != NULL); |
| 1001 GetPageSizeAndMarginsInPoints(NULL, page_index, default_params, | 1000 GetPageSizeAndMarginsInPoints(NULL, page_index, default_params, |
| 1002 page_layout_in_points); | 1001 page_layout_in_points); |
| 1003 return; | 1002 return; |
| 1004 } | 1003 } |
| 1005 | 1004 |
| 1006 page_layout_in_points->margin_top = | 1005 page_layout_in_points->margin_top = |
| 1007 ConvertPixelsToPointDouble(margin_top_in_pixels); | 1006 ConvertPixelsToPointDouble(margin_top_in_pixels); |
| 1008 page_layout_in_points->margin_right = | 1007 page_layout_in_points->margin_right = |
| 1009 ConvertPixelsToPointDouble(margin_right_in_pixels); | 1008 ConvertPixelsToPointDouble(margin_right_in_pixels); |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1529 const gfx::Size& | 1528 const gfx::Size& |
| 1530 PrintWebViewHelper::PrintPreviewContext::GetPrintCanvasSize() const { | 1529 PrintWebViewHelper::PrintPreviewContext::GetPrintCanvasSize() const { |
| 1531 return prep_frame_view_->GetPrintCanvasSize(); | 1530 return prep_frame_view_->GetPrintCanvasSize(); |
| 1532 } | 1531 } |
| 1533 | 1532 |
| 1534 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { | 1533 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { |
| 1535 prep_frame_view_.reset(); | 1534 prep_frame_view_.reset(); |
| 1536 metafile_.reset(); | 1535 metafile_.reset(); |
| 1537 pages_to_render_.clear(); | 1536 pages_to_render_.clear(); |
| 1538 } | 1537 } |
| OLD | NEW |