Skip to content

Commit

Permalink
Sanity check the printable area returned by windows.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
vandebo@chromium.org committed Oct 8, 2011
1 parent c35e533 commit 44e4e1a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
1 change: 0 additions & 1 deletion chrome/renderer/print_web_view_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions printing/page_setup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 8 additions & 0 deletions printing/print_settings_initializer_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 44e4e1a

Please sign in to comment.