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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "printing/print_settings_initializer_win.h" 5 #include "printing/print_settings_initializer_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "printing/print_settings.h" 9 #include "printing/print_settings.h"
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 DCHECK_EQ(GetDeviceCaps(hdc, SCALINGFACTORY), 0); 42 DCHECK_EQ(GetDeviceCaps(hdc, SCALINGFACTORY), 0);
43 43
44 // Initialize page_setup_device_units_. 44 // Initialize page_setup_device_units_.
45 gfx::Size physical_size_device_units(GetDeviceCaps(hdc, PHYSICALWIDTH), 45 gfx::Size physical_size_device_units(GetDeviceCaps(hdc, PHYSICALWIDTH),
46 GetDeviceCaps(hdc, PHYSICALHEIGHT)); 46 GetDeviceCaps(hdc, PHYSICALHEIGHT));
47 gfx::Rect printable_area_device_units(GetDeviceCaps(hdc, PHYSICALOFFSETX), 47 gfx::Rect printable_area_device_units(GetDeviceCaps(hdc, PHYSICALOFFSETX),
48 GetDeviceCaps(hdc, PHYSICALOFFSETY), 48 GetDeviceCaps(hdc, PHYSICALOFFSETY),
49 GetDeviceCaps(hdc, HORZRES), 49 GetDeviceCaps(hdc, HORZRES),
50 GetDeviceCaps(hdc, VERTRES)); 50 GetDeviceCaps(hdc, VERTRES));
51 51
52 // Sanity check the printable_area: we've seen crashes caused by a printable
53 // area rect of 0, 0, 0, 0, so it seems some drivers don't set it.
54 if (printable_area_device_units.IsEmpty() ||
55 !gfx::Rect(physical_size_device_units).Contains(
56 printable_area_device_units)) {
57 printable_area_device_units = gfx::Rect(physical_size_device_units);
58 }
59
52 print_settings->SetPrinterPrintableArea(physical_size_device_units, 60 print_settings->SetPrinterPrintableArea(physical_size_device_units,
53 printable_area_device_units, 61 printable_area_device_units,
54 dpi); 62 dpi);
55 } 63 }
56 64
57 } // namespace printing 65 } // namespace printing
OLDNEW
« 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