mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1766651 - Remove nsIPrintSettings.isCancelled and nsIPrintSettings.saveOnCancel. r=bobowen
nsIPrintSettings.isCancelled was only being set to true by the Windows widget code ShowNativePrintDialog nowadays. That seems pointless since that widget code is only invoked under the _showPrintDialog call in print.js, and in the case that the widget code throws, the print is never invoked and the nsIPrintSettings object isn't used. nsIPrintSettings.saveOnCancel was set in some places but never read. Differential Revision: https://phabricator.services.mozilla.com/D144830
This commit is contained in:
parent
955cca94c2
commit
f2a529bd7b
@ -43,12 +43,10 @@ nsPrintData::~nsPrintData() {
|
||||
if (mPrintDC) {
|
||||
PR_PL(("****************** End Document ************************\n"));
|
||||
PR_PL(("\n"));
|
||||
bool isCancelled = false;
|
||||
mPrintSettings->GetIsCancelled(&isCancelled);
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (mType == eIsPrinting && mPrintDC->IsCurrentlyPrintingDocument()) {
|
||||
if (!isCancelled && !mIsAborted) {
|
||||
if (!mIsAborted) {
|
||||
rv = mPrintDC->EndDocument();
|
||||
} else {
|
||||
rv = mPrintDC->AbortDocument();
|
||||
|
@ -540,7 +540,6 @@ nsresult nsPrintJob::DoCommonPrint(bool aIsPrintPreview,
|
||||
|
||||
MOZ_TRY(EnsureSettingsHasPrinterNameSet(printData->mPrintSettings));
|
||||
|
||||
printData->mPrintSettings->SetIsCancelled(false);
|
||||
printData->mPrintSettings->GetShrinkToFit(&printData->mShrinkToFit);
|
||||
|
||||
// Create a print session and let the print settings know about it.
|
||||
@ -1950,11 +1949,6 @@ bool nsPrintJob::PrePrintSheet() {
|
||||
// FirePrintingErrorEvent().
|
||||
RefPtr<nsPrintData> printData = mPrt;
|
||||
|
||||
// Check setting to see if someone request it be cancelled
|
||||
bool isCancelled = false;
|
||||
printData->mPrintSettings->GetIsCancelled(&isCancelled);
|
||||
if (isCancelled) return true;
|
||||
|
||||
// Ask mPageSeqFrame if the sheet is ready to be printed.
|
||||
// If the sheet doesn't get printed at all, the |done| will be |true|.
|
||||
bool done = false;
|
||||
@ -2002,10 +1996,7 @@ bool nsPrintJob::PrintSheet(nsPrintObject* aPO, bool& aInRange) {
|
||||
PR_PL(("------ In DV::PrintSheet PO: %p (%s)\n", aPO,
|
||||
gFrameTypesStr[aPO->mFrameType]));
|
||||
|
||||
// Check setting to see if someone request it be cancelled
|
||||
bool isCancelled = false;
|
||||
printData->mPrintSettings->GetIsCancelled(&isCancelled);
|
||||
if (isCancelled || printData->mIsAborted) {
|
||||
if (printData->mIsAborted) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -25,15 +25,6 @@ nsPrintSettingsX::nsPrintSettingsX() {
|
||||
|
||||
mDestination = kPMDestinationInvalid;
|
||||
|
||||
/*
|
||||
* Don't save print settings after the user cancels out of the
|
||||
* print dialog. For saving print settings after a cancellation
|
||||
* to work properly, in addition to changing |mSaveOnCancel|,
|
||||
* the print dialog implementation must be updated to save changed
|
||||
* settings and serialize them back to the child process.
|
||||
*/
|
||||
mSaveOnCancel = false;
|
||||
|
||||
NS_OBJC_END_TRY_IGNORE_BLOCK;
|
||||
}
|
||||
|
||||
|
@ -275,8 +275,6 @@ interface nsIPrintSettings : nsISupports
|
||||
attribute AString footerStrCenter;
|
||||
attribute AString footerStrRight;
|
||||
|
||||
attribute boolean isCancelled; /* indicates whether the print job has been cancelled */
|
||||
readonly attribute boolean saveOnCancel; /* indicates whether the print settings should be saved after a cancel */
|
||||
attribute boolean printSilent; /* print without putting up the dialog */
|
||||
[infallible] attribute boolean shrinkToFit; /* shrinks content to fit on page */
|
||||
|
||||
|
@ -577,21 +577,6 @@ NS_IMETHODIMP nsPrintSettings::SetPaperId(const nsAString& aPaperId) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPrintSettings::GetIsCancelled(bool* aIsCancelled) {
|
||||
NS_ENSURE_ARG_POINTER(aIsCancelled);
|
||||
*aIsCancelled = mIsCancelled;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsPrintSettings::SetIsCancelled(bool aIsCancelled) {
|
||||
mIsCancelled = aIsCancelled;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPrintSettings::GetSaveOnCancel(bool* aSaveOnCancel) {
|
||||
*aSaveOnCancel = mSaveOnCancel;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPrintSettings::GetPaperWidth(double* aPaperWidth) {
|
||||
NS_ENSURE_ARG_POINTER(aPaperWidth);
|
||||
*aPaperWidth = mPaperWidth;
|
||||
@ -912,8 +897,6 @@ nsPrintSettings& nsPrintSettings::operator=(const nsPrintSettings& rhs) {
|
||||
mPrintBGImages = rhs.mPrintBGImages;
|
||||
mTitle = rhs.mTitle;
|
||||
mURL = rhs.mURL;
|
||||
mIsCancelled = rhs.mIsCancelled;
|
||||
mSaveOnCancel = rhs.mSaveOnCancel;
|
||||
mPrintSilent = rhs.mPrintSilent;
|
||||
mShrinkToFit = rhs.mShrinkToFit;
|
||||
mShowMarginGuides = rhs.mShowMarginGuides;
|
||||
|
@ -97,8 +97,6 @@ class nsPrintSettings : public nsIPrintSettings {
|
||||
bool mPrintBGColors = false;
|
||||
bool mPrintBGImages = false;
|
||||
|
||||
bool mIsCancelled = false;
|
||||
bool mSaveOnCancel = true;
|
||||
bool mPrintSilent = false;
|
||||
bool mShrinkToFit = true;
|
||||
bool mShowMarginGuides = false;
|
||||
|
@ -135,7 +135,6 @@ nsPrintSettingsService::SerializeToPrintData(nsIPrintSettings* aSettings,
|
||||
aSettings->GetFooterStrCenter(data->footerStrCenter());
|
||||
aSettings->GetFooterStrRight(data->footerStrRight());
|
||||
|
||||
aSettings->GetIsCancelled(&data->isCancelled());
|
||||
aSettings->GetPrintSilent(&data->printSilent());
|
||||
aSettings->GetShrinkToFit(&data->shrinkToFit());
|
||||
|
||||
@ -224,7 +223,6 @@ nsPrintSettingsService::DeserializeToPrintSettings(const PrintData& data,
|
||||
settings->SetFooterStrCenter(data.footerStrCenter());
|
||||
settings->SetFooterStrRight(data.footerStrRight());
|
||||
|
||||
settings->SetIsCancelled(data.isCancelled());
|
||||
settings->SetPrintSilent(data.printSilent());
|
||||
settings->SetShrinkToFit(data.shrinkToFit());
|
||||
|
||||
|
@ -279,10 +279,7 @@ static nsresult ShowNativePrintDialog(HWND aHWnd,
|
||||
result = ::PrintDlgExW(&prntdlg);
|
||||
}
|
||||
|
||||
auto cancelOnExit = mozilla::MakeScopeExit([&] {
|
||||
::SetFocus(aHWnd);
|
||||
aPrintSettings->SetIsCancelled(true);
|
||||
});
|
||||
auto cancelOnExit = mozilla::MakeScopeExit([&] { ::SetFocus(aHWnd); });
|
||||
|
||||
if (NS_WARN_IF(!SUCCEEDED(result))) {
|
||||
#ifdef DEBUG
|
||||
|
Loading…
Reference in New Issue
Block a user