Chromium Code Reviews| 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 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 978 margin_left_in_pixels - | 978 margin_left_in_pixels - |
| 979 margin_right_in_pixels); | 979 margin_right_in_pixels); |
| 980 page_layout_in_points->content_height = | 980 page_layout_in_points->content_height = |
| 981 ConvertPixelsToPoint(page_size_in_pixels.height - | 981 ConvertPixelsToPoint(page_size_in_pixels.height - |
| 982 margin_top_in_pixels - | 982 margin_top_in_pixels - |
| 983 margin_bottom_in_pixels); | 983 margin_bottom_in_pixels); |
| 984 | 984 |
| 985 // Invalid page size and/or margins. We just use the default setting. | 985 // Invalid page size and/or margins. We just use the default setting. |
| 986 if (page_layout_in_points->content_width < 1.0 || | 986 if (page_layout_in_points->content_width < 1.0 || |
| 987 page_layout_in_points->content_height < 1.0) { | 987 page_layout_in_points->content_height < 1.0) { |
| 988 // TODO(vandebo) remove CHECK after debugging crbug.com/96063 | |
| 989 CHECK(frame != NULL); | 988 CHECK(frame != NULL); |
|
vandebo (ex-Chrome)
2011/10/07 19:50:00
I'm leaving this check in because it won't run ver
| |
| 990 GetPageSizeAndMarginsInPoints(NULL, page_index, default_params, | 989 GetPageSizeAndMarginsInPoints(NULL, page_index, default_params, |
| 991 page_layout_in_points); | 990 page_layout_in_points); |
| 992 return; | 991 return; |
| 993 } | 992 } |
| 994 | 993 |
| 995 page_layout_in_points->margin_top = | 994 page_layout_in_points->margin_top = |
| 996 ConvertPixelsToPointDouble(margin_top_in_pixels); | 995 ConvertPixelsToPointDouble(margin_top_in_pixels); |
| 997 page_layout_in_points->margin_right = | 996 page_layout_in_points->margin_right = |
| 998 ConvertPixelsToPointDouble(margin_right_in_pixels); | 997 ConvertPixelsToPointDouble(margin_right_in_pixels); |
| 999 page_layout_in_points->margin_bottom = | 998 page_layout_in_points->margin_bottom = |
| (...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1568 PrintWebViewHelper::PrintPreviewContext::GetPrintCanvasSize() const { | 1567 PrintWebViewHelper::PrintPreviewContext::GetPrintCanvasSize() const { |
| 1569 return prep_frame_view_->GetPrintCanvasSize(); | 1568 return prep_frame_view_->GetPrintCanvasSize(); |
| 1570 } | 1569 } |
| 1571 | 1570 |
| 1572 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { | 1571 void PrintWebViewHelper::PrintPreviewContext::ClearContext() { |
| 1573 prep_frame_view_.reset(); | 1572 prep_frame_view_.reset(); |
| 1574 metafile_.reset(); | 1573 metafile_.reset(); |
| 1575 pages_to_render_.clear(); | 1574 pages_to_render_.clear(); |
| 1576 error_ = PREVIEW_ERROR_NONE; | 1575 error_ = PREVIEW_ERROR_NONE; |
| 1577 } | 1576 } |
| OLD | NEW |