0

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
This commit is contained in:
vandebo@chromium.org
2011-10-08 00:37:53 +00:00
parent c35e533db8
commit 44e4e1a420
3 changed files with 8 additions and 3 deletions

@ -1002,7 +1002,6 @@ void PrintWebViewHelper::GetPageSizeAndMarginsInPoints(
// Invalid page size and/or margins. We just use the default setting.
if (page_layout_in_points->content_width < 1.0 ||
page_layout_in_points->content_height < 1.0) {
// TODO(vandebo) remove CHECK after debugging crbug.com/96063
CHECK(frame != NULL);
GetPageSizeAndMarginsInPoints(NULL, page_index, default_params,
page_layout_in_points);

@ -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) {

@ -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);