Bug 1660986 - Handle print in color setting on Windows. r=bobowen

Differential Revision: https://phabricator.services.mozilla.com/D88128
This commit is contained in:
Emilio Cobos Álvarez 2020-08-25 12:29:17 +00:00
Родитель cb8b44285b
Коммит 414e22d1c4
1 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -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);