Bug 1667953 p1. Stop reading printer specific settings from global prefs. r=bobowen

Differential Revision: https://phabricator.services.mozilla.com/D91819
This commit is contained in:
Jonathan Watt 2020-09-29 18:51:35 +00:00
Родитель 3c813005a1
Коммит 3f30f74084
3 изменённых файлов: 34 добавлений и 2 удалений

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

@ -913,6 +913,14 @@ pref("browser.fixup.alternate.prefix", "www.");
pref("browser.fixup.alternate.suffix", ".com");
pref("browser.fixup.fallback-to-https", true);
// NOTE: On most platforms we save print settins to prefs with the name of the
// printer in the pref name (Android being the notable exception, where prefs
// are saved "globally" without a printer name in the pref name). For those
// platforms, the prefs below simply act as default values for when we
// encounter a printer for the first time, but only a subset of prefs will be
// used in this case. See nsPrintSettingsService::InitPrintSettingsFromPrefs
// for the restrictions on which prefs can act as defaults.
// Print/Preview Shrink-To-Fit won't shrink below 20% for text-ish documents.
pref("print.shrink-to-fit.scale-limit-percent", 20);

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

@ -173,7 +173,17 @@ nsresult nsPrintSettingsServiceX::_CreatePrintSettings(nsIPrintSettings** _retva
return rv;
}
InitPrintSettingsFromPrefs(*_retval, false, nsIPrintSettings::kInitSaveAll);
auto globalPrintSettings =
nsIPrintSettings::kInitSaveShrinkToFit | nsIPrintSettings::kInitSaveHeaderLeft |
nsIPrintSettings::kInitSaveHeaderCenter | nsIPrintSettings::kInitSaveHeaderRight |
nsIPrintSettings::kInitSaveFooterLeft | nsIPrintSettings::kInitSaveFooterCenter |
nsIPrintSettings::kInitSaveFooterRight | nsIPrintSettings::kInitSaveEdges |
nsIPrintSettings::kInitSaveReversed | nsIPrintSettings::kInitSaveInColor;
// XXX Why is Mac special? Why are we copying global print settings here?
// nsPrintSettingsService::InitPrintSettingsFromPrefs already gets the few
// global defaults that we want, doesn't it?
InitPrintSettingsFromPrefs(*_retval, false, globalPrintSettings);
return rv;
}

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

@ -938,10 +938,24 @@ nsPrintSettingsService::InitPrintSettingsFromPrefs(nsIPrintSettings* aPS,
if (isInitialized) return NS_OK;
auto globalPrintSettings = aFlags;
#ifndef MOZ_WIDGET_ANDROID
globalPrintSettings &= nsIPrintSettings::kInitSaveShrinkToFit |
nsIPrintSettings::kInitSaveHeaderLeft |
nsIPrintSettings::kInitSaveHeaderCenter |
nsIPrintSettings::kInitSaveHeaderRight |
nsIPrintSettings::kInitSaveFooterLeft |
nsIPrintSettings::kInitSaveFooterCenter |
nsIPrintSettings::kInitSaveFooterRight |
nsIPrintSettings::kInitSaveEdges |
nsIPrintSettings::kInitSaveReversed |
nsIPrintSettings::kInitSaveInColor;
#endif
nsAutoString prtName;
// read any non printer specific prefs
// with empty printer name
nsresult rv = ReadPrefs(aPS, prtName, aFlags);
nsresult rv = ReadPrefs(aPS, prtName, globalPrintSettings);
NS_ENSURE_SUCCESS(rv, rv);
// Get the Printer Name from the PrintSettings to use as a prefix for Pref