From 2896dccc7a66c857f53f297d9ae9790b242a0e92 Mon Sep 17 00:00:00 2001 From: "thestig@chromium.org" Date: Tue, 15 Mar 2011 19:54:10 +0000 Subject: Printing: Move the default margin constants out of PdfPsMetafile. BUG=none TEST=none Review URL: http://codereview.chromium.org/6694005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78266 0039d316-1c4b-4281-b951-d872f2087c98 --- printing/print_settings_initializer_gtk.cc | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'printing/print_settings_initializer_gtk.cc') diff --git a/printing/print_settings_initializer_gtk.cc b/printing/print_settings_initializer_gtk.cc index 8a62929..833db52 100644 --- a/printing/print_settings_initializer_gtk.cc +++ b/printing/print_settings_initializer_gtk.cc @@ -51,9 +51,7 @@ void PrintSettingsInitializerGtk::InitPrintSettings( gtk_page_setup_get_page_width(page_setup, GTK_UNIT_INCH) * dpi, gtk_page_setup_get_page_height(page_setup, GTK_UNIT_INCH) * dpi); } else { - // Use dummy values if we cannot get valid values. - // TODO(jhawkins) Remove this hack when the Linux printing refactoring - // finishes. + // Use default values if we cannot get valid values from the print dialog. dpi = kPixelsPerInch; double page_width_in_pixel = 8.5 * dpi; double page_height_in_pixel = 11.0 * dpi; @@ -61,16 +59,10 @@ void PrintSettingsInitializerGtk::InitPrintSettings( static_cast(page_width_in_pixel), static_cast(page_height_in_pixel)); printable_area_device_units.SetRect( - static_cast( - PdfPsMetafile::kLeftMarginInInch * dpi), - static_cast( - PdfPsMetafile::kTopMarginInInch * dpi), - page_width_in_pixel - - (PdfPsMetafile::kLeftMarginInInch + - PdfPsMetafile::kRightMarginInInch) * dpi, - page_height_in_pixel - - (PdfPsMetafile::kTopMarginInInch + - PdfPsMetafile::kBottomMarginInInch) * dpi); + static_cast(kLeftMarginInInch * dpi), + static_cast(kTopMarginInInch * dpi), + page_width_in_pixel - (kLeftMarginInInch + kRightMarginInInch) * dpi, + page_height_in_pixel - (kTopMarginInInch + kBottomMarginInInch) * dpi); } print_settings->set_dpi(dpi); @@ -79,4 +71,9 @@ void PrintSettingsInitializerGtk::InitPrintSettings( dpi); } +const double PrintSettingsInitializerGtk::kTopMarginInInch = 0.25; +const double PrintSettingsInitializerGtk::kBottomMarginInInch = 0.56; +const double PrintSettingsInitializerGtk::kLeftMarginInInch = 0.25; +const double PrintSettingsInitializerGtk::kRightMarginInInch = 0.25; + } // namespace printing -- cgit v1.1