зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1765059: Stop storing/reading the print resolution in about:config pref. r=bobowen
This per-printer "print_resolution" about:config pref (which ends up in nsPrintSettings 'mResolution' member-var) is never exposed in UI, and it's almost entirely unused. For the usages that do exist (usages of nsPrintSettings::mResolution), we potentially do the wrong thing when the value comes from an about:config pref, as described in this bug. These usages scale the printed output *as if we're printing to a printer with the given resolution*, though of course we have no guarantee of this being the printer's actual resolution, when this value comes from about:config prefs. After this patch, nsPrintSettings will simply use the value that we actually get from the printer, instead of this potentially-bogus value from about:config. This will avoid the scaling issues described in this bug. Differential Revision: https://phabricator.services.mozilla.com/D146261
This commit is contained in:
Родитель
1e9689eaf3
Коммит
50464c1e32
|
@ -42,7 +42,7 @@ interface nsIPrintSettings : nsISupports
|
|||
const unsigned long kInitSaveBGColors = 0x00000080;
|
||||
const unsigned long kInitSaveBGImages = 0x00000100;
|
||||
const unsigned long kInitSavePaperSize = 0x00000200;
|
||||
const unsigned long kInitSaveResolution = 0x00000400;
|
||||
/* Flag 0x00000400 is unused */
|
||||
const unsigned long kInitSaveDuplex = 0x00000800;
|
||||
/* Flag 0x00001000 is unused */
|
||||
/* Flag 0x00002000 is unused */
|
||||
|
|
|
@ -84,7 +84,6 @@ static const char kPrintBGColors[] = "print_bgcolor";
|
|||
static const char kPrintBGImages[] = "print_bgimages";
|
||||
static const char kPrintShrinkToFit[] = "print_shrink_to_fit";
|
||||
static const char kPrintScaling[] = "print_scaling";
|
||||
static const char kPrintResolution[] = "print_resolution";
|
||||
static const char kPrintDuplex[] = "print_duplex";
|
||||
|
||||
static const char kJustLeft[] = "left";
|
||||
|
@ -570,15 +569,6 @@ nsresult nsPrintSettingsService::ReadPrefs(nsIPrintSettings* aPS,
|
|||
}
|
||||
}
|
||||
|
||||
if (aFlags & nsIPrintSettings::kInitSaveResolution) {
|
||||
// DPI. Again, an arbitrary range mainly to purge bad values that have made
|
||||
// their way into user prefs.
|
||||
if (GETINTPREF(kPrintResolution, &iVal) && iVal >= 50 && iVal <= 12000) {
|
||||
aPS->SetResolution(iVal);
|
||||
noValidPrefsFound = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (aFlags & nsIPrintSettings::kInitSaveDuplex) {
|
||||
if (GETINTPREF(kPrintDuplex, &iVal)) {
|
||||
aPS->SetDuplex(iVal);
|
||||
|
@ -588,6 +578,7 @@ nsresult nsPrintSettingsService::ReadPrefs(nsIPrintSettings* aPS,
|
|||
|
||||
// Not Reading In:
|
||||
// Number of Copies
|
||||
// Print Resolution
|
||||
|
||||
return noValidPrefsFound ? NS_ERROR_NOT_AVAILABLE : NS_OK;
|
||||
}
|
||||
|
@ -769,12 +760,6 @@ nsresult nsPrintSettingsService::WritePrefs(nsIPrintSettings* aPS,
|
|||
}
|
||||
}
|
||||
|
||||
if (aFlags & nsIPrintSettings::kInitSaveResolution) {
|
||||
if (NS_SUCCEEDED(aPS->GetResolution(&iVal))) {
|
||||
Preferences::SetInt(GetPrefName(kPrintResolution, aPrinterName), iVal);
|
||||
}
|
||||
}
|
||||
|
||||
if (aFlags & nsIPrintSettings::kInitSaveDuplex) {
|
||||
if (NS_SUCCEEDED(aPS->GetDuplex(&iVal))) {
|
||||
Preferences::SetInt(GetPrefName(kPrintDuplex, aPrinterName), iVal);
|
||||
|
@ -783,6 +768,7 @@ nsresult nsPrintSettingsService::WritePrefs(nsIPrintSettings* aPS,
|
|||
|
||||
// Not Writing Out:
|
||||
// Number of Copies
|
||||
// Print Resolution
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче