| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
| 10 #include "chrome/renderer/render_view.h" | 10 #include "chrome/renderer/render_view.h" |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 ConvertPixelsToPointDouble(margin_bottom_in_pixels); | 432 ConvertPixelsToPointDouble(margin_bottom_in_pixels); |
| 433 if (margin_left_in_points) | 433 if (margin_left_in_points) |
| 434 *margin_left_in_points = | 434 *margin_left_in_points = |
| 435 ConvertPixelsToPointDouble(margin_left_in_pixels); | 435 ConvertPixelsToPointDouble(margin_left_in_pixels); |
| 436 } | 436 } |
| 437 | 437 |
| 438 void PrintWebViewHelper::UpdatePrintableSizeInPrintParameters( | 438 void PrintWebViewHelper::UpdatePrintableSizeInPrintParameters( |
| 439 WebFrame* frame, ViewMsg_Print_Params* params) { | 439 WebFrame* frame, ViewMsg_Print_Params* params) { |
| 440 double content_width_in_points; | 440 double content_width_in_points; |
| 441 double content_height_in_points; | 441 double content_height_in_points; |
| 442 PrepareFrameAndViewForPrint prepare(*params, frame, frame->view()); |
| 442 PrintWebViewHelper::GetPageSizeAndMarginsInPoints(frame, 0, *params, | 443 PrintWebViewHelper::GetPageSizeAndMarginsInPoints(frame, 0, *params, |
| 443 &content_width_in_points, | 444 &content_width_in_points, |
| 444 &content_height_in_points, | 445 &content_height_in_points, |
| 445 NULL, NULL, NULL, NULL); | 446 NULL, NULL, NULL, NULL); |
| 446 #if defined(OS_MACOSX) | 447 #if defined(OS_MACOSX) |
| 447 params->printable_size = gfx::Size( | 448 params->printable_size = gfx::Size( |
| 448 static_cast<int>(content_width_in_points), | 449 static_cast<int>(content_width_in_points), |
| 449 static_cast<int>(content_height_in_points)); | 450 static_cast<int>(content_height_in_points)); |
| 450 #else | 451 #else |
| 451 params->printable_size = gfx::Size( | 452 params->printable_size = gfx::Size( |
| 452 static_cast<int>(ConvertUnitDouble( | 453 static_cast<int>(ConvertUnitDouble( |
| 453 content_width_in_points, printing::kPointsPerInch, params->dpi)), | 454 content_width_in_points, printing::kPointsPerInch, params->dpi)), |
| 454 static_cast<int>(ConvertUnitDouble( | 455 static_cast<int>(ConvertUnitDouble( |
| 455 content_height_in_points, printing::kPointsPerInch, params->dpi))); | 456 content_height_in_points, printing::kPointsPerInch, params->dpi))); |
| 456 #endif | 457 #endif |
| 457 } | 458 } |
| OLD | NEW |