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 GetPageSizeAndMarginsInPoints(NULL, page_index, default_params, | 1001 GetPageSizeAndMarginsInPoints(NULL, page_index, default_params, |
1000 page_layout_in_points); | 1002 page_layout_in_points); |
1001 return; | 1003 return; |
1002 } | 1004 } |
1003 | 1005 |
1004 page_layout_in_points->margin_top = | 1006 page_layout_in_points->margin_top = |
1005 ConvertPixelsToPointDouble(margin_top_in_pixels); | 1007 ConvertPixelsToPointDouble(margin_top_in_pixels); |
1006 page_layout_in_points->margin_right = | 1008 page_layout_in_points->margin_right = |
1007 ConvertPixelsToPointDouble(margin_right_in_pixels); | 1009 ConvertPixelsToPointDouble(margin_right_in_pixels); |
1008 page_layout_in_points->margin_bottom = | 1010 page_layout_in_points->margin_bottom = |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1522 const gfx::Size& | 1524 const gfx::Size& |
1523 PrintWebViewHelper::PrintPreviewContext::GetPrintCanvasSize() const { | 1525 PrintWebViewHelper::PrintPreviewContext::GetPrintCanvasSize() const { |
1524 return prep_frame_view_->GetPrintCanvasSize(); | 1526 return prep_frame_view_->GetPrintCanvasSize(); |
1525 } | 1527 } |
1526 | 1528 |
1527 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { | 1529 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { |
1528 prep_frame_view_.reset(); | 1530 prep_frame_view_.reset(); |
1529 metafile_.reset(); | 1531 metafile_.reset(); |
1530 pages_to_render_.clear(); | 1532 pages_to_render_.clear(); |
1531 } | 1533 } |
OLD | NEW |