diff options
author | hamaji@chromium.org <hamaji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-28 09:46:00 +0000 |
---|---|---|
committer | hamaji@chromium.org <hamaji@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-28 09:46:00 +0000 |
commit | 4ebf5d12a9da2fe381b5bc6e53eba76a2abed8d4 (patch) | |
tree | 8709d2a1c9b6afcff614c4d58b774cb2ba89ff31 /chrome/renderer/print_web_view_helper_linux.cc | |
parent | fae8f2508f0927d4099fa78be85f089bae55575c (diff) | |
download | chromium_src-4ebf5d12a9da2fe381b5bc6e53eba76a2abed8d4.zip chromium_src-4ebf5d12a9da2fe381b5bc6e53eba76a2abed8d4.tar.gz chromium_src-4ebf5d12a9da2fe381b5bc6e53eba76a2abed8d4.tar.bz2 |
Create constant variables kPointsPerInch and kPixelsPerInch and conversion functions.
BUG=47277
TEST=units_unittest.cc
Review URL: http://codereview.chromium.org/2877001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50968 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/print_web_view_helper_linux.cc')
-rw-r--r-- | chrome/renderer/print_web_view_helper_linux.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/chrome/renderer/print_web_view_helper_linux.cc b/chrome/renderer/print_web_view_helper_linux.cc index 2a0e333..609f099 100644 --- a/chrome/renderer/print_web_view_helper_linux.cc +++ b/chrome/renderer/print_web_view_helper_linux.cc @@ -8,9 +8,11 @@ #include "base/logging.h" #include "chrome/common/render_messages.h" #include "printing/native_metafile.h" +#include "printing/units.h" #include "skia/ext/vector_canvas.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" +using printing::NativeMetafile; using WebKit::WebFrame; void PrintWebViewHelper::Print(WebFrame* frame, bool script_initiated) { @@ -23,14 +25,11 @@ void PrintWebViewHelper::Print(WebFrame* frame, bool script_initiated) { // For testing purpose, we hard-coded printing parameters here. // The paper size is US Letter (8.5 in. by 11 in.). - // Using default margins: - // Left = 0.25 in. - // Right = 0.25 in. - // Top = 0.25 in. - // Bottom = 0.56 in. - const int kDPI = 72; - const int kWidth = static_cast<int>((8.5-0.25-0.25) * kDPI); - const int kHeight = static_cast<int>((11-0.25-0.56) * kDPI); + const int kDPI = printing::kPointsPerInch; + const int kWidth = static_cast<int>( + 8.5 * kDPI - NativeMetafile::kLeftMargin - NativeMetafile::kRightMargin); + const int kHeight = static_cast<int>( + 11 * kDPI - NativeMetafile::kTopMargin - NativeMetafile::kBottomMargin); ViewMsg_Print_Params default_settings; default_settings.printable_size = gfx::Size(kWidth, kHeight); default_settings.dpi = kDPI; |