diff options
author | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-08 00:37:53 +0000 |
---|---|---|
committer | vandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-08 00:37:53 +0000 |
commit | 44e4e1a420496ae836cd89c2c62d40be904a4793 (patch) | |
tree | 7e659c3b23d49dce5fc0f0aadd85b36aa4002d32 /printing | |
parent | c35e533db8c4331a4c390afe8b2ff2487f227122 (diff) | |
download | chromium_src-44e4e1a420496ae836cd89c2c62d40be904a4793.zip chromium_src-44e4e1a420496ae836cd89c2c62d40be904a4793.tar.gz chromium_src-44e4e1a420496ae836cd89c2c62d40be904a4793.tar.bz2 |
Sanity check the printable area returned by windows.
BUG=96063
TEST=NONE
Review URL: http://codereview.chromium.org/8200010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104615 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing')
-rw-r--r-- | printing/page_setup.cc | 2 | ||||
-rw-r--r-- | printing/print_settings_initializer_win.cc | 8 |
2 files changed, 8 insertions, 2 deletions
diff --git a/printing/page_setup.cc b/printing/page_setup.cc index 46431d8..9ac3e520 100644 --- a/printing/page_setup.cc +++ b/printing/page_setup.cc @@ -119,8 +119,6 @@ void PageSetup::Init(const gfx::Size& physical_size, physical_size.height() - effective_margins_.bottom - content_area_.y())); - // TODO(vandebo) Remove once bug 96063 is resolved. - CHECK(content_area_.width() > 0 && content_area_.height() > 0); } void PageSetup::SetRequestedMargins(const PageMargins& requested_margins) { diff --git a/printing/print_settings_initializer_win.cc b/printing/print_settings_initializer_win.cc index 0f6a930..0ec96d0 100644 --- a/printing/print_settings_initializer_win.cc +++ b/printing/print_settings_initializer_win.cc @@ -49,6 +49,14 @@ void PrintSettingsInitializerWin::InitPrintSettings( GetDeviceCaps(hdc, HORZRES), GetDeviceCaps(hdc, VERTRES)); + // Sanity check the printable_area: we've seen crashes caused by a printable + // area rect of 0, 0, 0, 0, so it seems some drivers don't set it. + if (printable_area_device_units.IsEmpty() || + !gfx::Rect(physical_size_device_units).Contains( + printable_area_device_units)) { + printable_area_device_units = gfx::Rect(physical_size_device_units); + } + print_settings->SetPrinterPrintableArea(physical_size_device_units, printable_area_device_units, dpi); |