Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1155)

Unified Diff: printing/print_settings_initializer_win.cc

Issue 8200010: Sanity check the printable area returned by windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« chrome/renderer/print_web_view_helper.cc ('K') | « printing/page_setup.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/print_settings_initializer_win.cc
diff --git a/printing/print_settings_initializer_win.cc b/printing/print_settings_initializer_win.cc
index 0f6a930b7c8f12c2fb1b28b18c6cce5ffc417e39..0ec96d0ab624a5f7f59240c3409bfe9331b4cd8c 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);
« chrome/renderer/print_web_view_helper.cc ('K') | « printing/page_setup.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698