Bug 1271900: Don't require a minimum page size when setting up DEVMODE from print settings. r=jimm a=lizzard
authorBob Owen <bobowencode@gmail.com>
Wed, 11 May 2016 10:18:10 +0100
changeset 332876 ef0e7d240660bf60dc9ef3f7bb07274504952943
parent 332875 083385f30a43954843fc5f4bba0c52958307be0c
child 332877 9a4077c55f8be12165d91029b4560073e6c1f7d5
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm, lizzard
bugs1271900
milestone48.0a2
Bug 1271900: Don't require a minimum page size when setting up DEVMODE from print settings. r=jimm a=lizzard MozReview-Commit-ID: ByO4KHPtkkM
widget/windows/nsPrintSettingsWin.cpp
--- a/widget/windows/nsPrintSettingsWin.cpp
+++ b/widget/windows/nsPrintSettingsWin.cpp
@@ -247,27 +247,28 @@ nsPrintSettingsWin::CopyToNative(DEVMODE
   if (mPaperSizeUnit == kPaperSizeMillimeters) {
     paperHeight = mPaperHeight;
     paperWidth = mPaperWidth;
   } else {
     paperHeight = mPaperHeight * MM_PER_INCH_FLOAT;
     paperWidth = mPaperWidth * MM_PER_INCH_FLOAT;
   }
 
-  // Set a sensible limit on the minimum height and width.
-  if (paperHeight >= MM_PER_INCH_FLOAT) {
+  // Note: small page sizes can be required here for sticker, label and slide
+  // printers etc. see bug 1271900.
+  if (paperHeight > 0) {
     // In DEVMODEs, physical lengths are stored in tenths of millimeters.
     aDevMode->dmPaperLength = paperHeight * 10l;
     aDevMode->dmFields |= DM_PAPERLENGTH;
   } else {
     aDevMode->dmPaperLength = 0;
     aDevMode->dmFields &= ~DM_PAPERLENGTH;
   }
 
-  if (paperWidth >= MM_PER_INCH_FLOAT) {
+  if (paperWidth > 0) {
     aDevMode->dmPaperWidth = paperWidth * 10l;
     aDevMode->dmFields |= DM_PAPERWIDTH;
   } else {
     aDevMode->dmPaperWidth = 0;
     aDevMode->dmFields &= ~DM_PAPERWIDTH;
   }
 
   // Setup Orientation