| 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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 ConvertPixelsToPointDouble(margin_bottom_in_pixels); | 431 ConvertPixelsToPointDouble(margin_bottom_in_pixels); |
| 432 if (margin_left_in_points) | 432 if (margin_left_in_points) |
| 433 *margin_left_in_points = | 433 *margin_left_in_points = |
| 434 ConvertPixelsToPointDouble(margin_left_in_pixels); | 434 ConvertPixelsToPointDouble(margin_left_in_pixels); |
| 435 } | 435 } |
| 436 | 436 |
| 437 void PrintWebViewHelper::UpdatePrintableSizeInPrintParameters( | 437 void PrintWebViewHelper::UpdatePrintableSizeInPrintParameters( |
| 438 WebFrame* frame, ViewMsg_Print_Params* params) { | 438 WebFrame* frame, ViewMsg_Print_Params* params) { |
| 439 double content_width_in_points; | 439 double content_width_in_points; |
| 440 double content_height_in_points; | 440 double content_height_in_points; |
| 441 PrepareFrameAndViewForPrint prepare(*params, frame, frame->view()); |
| 441 PrintWebViewHelper::GetPageSizeAndMarginsInPoints(frame, 0, *params, | 442 PrintWebViewHelper::GetPageSizeAndMarginsInPoints(frame, 0, *params, |
| 442 &content_width_in_points, | 443 &content_width_in_points, |
| 443 &content_height_in_points, | 444 &content_height_in_points, |
| 444 NULL, NULL, NULL, NULL); | 445 NULL, NULL, NULL, NULL); |
| 445 #if defined(OS_MACOSX) | 446 #if defined(OS_MACOSX) |
| 446 params->printable_size = gfx::Size( | 447 params->printable_size = gfx::Size( |
| 447 static_cast<int>(content_width_in_points), | 448 static_cast<int>(content_width_in_points), |
| 448 static_cast<int>(content_height_in_points)); | 449 static_cast<int>(content_height_in_points)); |
| 449 #else | 450 #else |
| 450 params->printable_size = gfx::Size( | 451 params->printable_size = gfx::Size( |
| 451 static_cast<int>(ConvertUnitDouble( | 452 static_cast<int>(ConvertUnitDouble( |
| 452 content_width_in_points, printing::kPointsPerInch, params->dpi)), | 453 content_width_in_points, printing::kPointsPerInch, params->dpi)), |
| 453 static_cast<int>(ConvertUnitDouble( | 454 static_cast<int>(ConvertUnitDouble( |
| 454 content_height_in_points, printing::kPointsPerInch, params->dpi))); | 455 content_height_in_points, printing::kPointsPerInch, params->dpi))); |
| 455 #endif | 456 #endif |
| 456 } | 457 } |
| OLD | NEW |