From 414e22d1c43a273b6d3c2e41d93bbf7cc95fe961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Tue, 25 Aug 2020 12:29:17 +0000 Subject: [PATCH] Bug 1660986 - Handle print in color setting on Windows. r=bobowen Differential Revision: https://phabricator.services.mozilla.com/D88128 --- widget/windows/nsPrintSettingsWin.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/widget/windows/nsPrintSettingsWin.cpp b/widget/windows/nsPrintSettingsWin.cpp index 97843b2082d8..9dd1aed284df 100644 --- a/widget/windows/nsPrintSettingsWin.cpp +++ b/widget/windows/nsPrintSettingsWin.cpp @@ -206,6 +206,10 @@ void nsPrintSettingsWin::InitWithInitializer( SetPrintInColor(devmode->dmColor == DMCOLOR_COLOR); } + if (devmode->dmFields & DM_COLOR) { + SetPrintInColor(devmode->dmColor == DMCOLOR_COLOR); + } + // Set the paper sizes to match the unit. double pointsToSizeUnit = mPaperSizeUnit == kPaperSizeInches ? 1.0 / 72.0 : 25.4 / 72.0; @@ -394,6 +398,10 @@ void nsPrintSettingsWin::CopyFromNative(HDC aHdc, DEVMODEW* aDevMode) { mPrintInColor = aDevMode->dmColor == DMCOLOR_COLOR; } + if (aDevMode->dmFields & DM_COLOR) { + mPrintInColor = aDevMode->dmColor == DMCOLOR_COLOR; + } + InitUnwriteableMargin(aHdc); // The length and width in DEVMODE are always in tenths of a millimeter. @@ -445,6 +453,9 @@ void nsPrintSettingsWin::CopyToNative(DEVMODEW* aDevMode) { aDevMode->dmFields |= DM_COLOR; aDevMode->dmColor = mPrintInColor ? DMCOLOR_COLOR : DMCOLOR_MONOCHROME; + aDevMode->dmFields |= DM_COLOR; + aDevMode->dmColor = mPrintInColor ? DMCOLOR_COLOR : DMCOLOR_MONOCHROME; + // The length and width in DEVMODE are always in tenths of a millimeter. double sizeUnitToTenthsOfAmm = 10L * (mPaperSizeUnit == kPaperSizeInches ? MM_PER_INCH_FLOAT : 1L);