diff --git a/build/win32/orderfile.txt b/build/win32/orderfile.txt index 4d81bcfbfdea..198120229284 100644 --- a/build/win32/orderfile.txt +++ b/build/win32/orderfile.txt @@ -10084,7 +10084,6 @@ Gecko_IsDocumentBody ?StripTrackingIdentifiers@URLDecorationStripper@mozilla@@SA?AW4nsresult@@PAVnsIURI@@AAV?$nsTSubstring@D@@@Z ??1gfxWindowsNativeDrawing@@QAE@XZ ?RecvAddChild@SHEntryParent@dom@mozilla@@AAE_NPAVPSHEntryParent@23@ABHAB_NPAW4nsresult@@@Z -?SetPrintOptionsBits@nsPrintSettings@@UAG?AW4nsresult@@H@Z ?SetRealmPrincipals@JS@@YAXPAVRealm@1@PAUJSPrincipals@@@Z ?MarkAsBroken@nsHtml5TreeOpExecutor@@UAE?AW4nsresult@@W42@@Z ??$AppendElements@UnsTArrayInfallibleAllocator@@@?$nsTArray_Impl@VPrincipalInfo@ipc@mozilla@@UnsTArrayInfallibleAllocator@@@@IAEPAVPrincipalInfo@ipc@mozilla@@I@Z diff --git a/layout/printing/nsPrintJob.cpp b/layout/printing/nsPrintJob.cpp index d8f22493c64e..9b43038bbf85 100644 --- a/layout/printing/nsPrintJob.cpp +++ b/layout/printing/nsPrintJob.cpp @@ -605,8 +605,7 @@ nsresult nsPrintJob::DoCommonPrint(bool aIsPrintPreview, } // Now determine how to set up the Frame print UI - printData->mPrintSettings->SetPrintOptions( - nsIPrintSettings::kEnableSelectionRB, + printData->mPrintSettings->SetIsPrintSelectionRBEnabled( !mDisallowSelectionPrint && printData->mSelectionRoot); bool printingViaParent = diff --git a/toolkit/components/printing/content/print.js b/toolkit/components/printing/content/print.js index b8ceaf409455..1cd106e15bb1 100644 --- a/toolkit/components/printing/content/print.js +++ b/toolkit/components/printing/content/print.js @@ -624,10 +624,8 @@ var PrintEventHandler = { numPages = settings.endPageRange - settings.startPageRange + 1; } // Update the settings print options on whether there is a selection. - settings.SetPrintOptions( - Ci.nsIPrintSettings.kEnableSelectionRB, - hasSelection - ); + settings.isPrintSelectionRBEnabled = hasSelection; + document.dispatchEvent( new CustomEvent("page-count", { detail: { numPages, totalPages: totalPageCount }, diff --git a/toolkit/components/printingui/ipc/PPrintingTypes.ipdlh b/toolkit/components/printingui/ipc/PPrintingTypes.ipdlh index 5640810c67cf..44071fc68488 100644 --- a/toolkit/components/printingui/ipc/PPrintingTypes.ipdlh +++ b/toolkit/components/printingui/ipc/PPrintingTypes.ipdlh @@ -34,6 +34,7 @@ struct PrintData { bool printBGImages; bool honorPageRuleMargins; bool showMarginGuides; + bool isPrintSelectionRBEnabled; bool printSelectionOnly; short printRange; nsString title; @@ -67,7 +68,6 @@ struct PrintData { int32_t duplex; bool isInitializedFromPrinter; bool isInitializedFromPrefs; - int32_t optionFlags; /* Windows-specific things */ nsString driverName; diff --git a/widget/cocoa/nsPrintDialogX.mm b/widget/cocoa/nsPrintDialogX.mm index fdba6a2cbf53..2472cf7a4cb6 100644 --- a/widget/cocoa/nsPrintDialogX.mm +++ b/widget/cocoa/nsPrintDialogX.mm @@ -363,8 +363,7 @@ static const char sHeaderFooterTags[][4] = {"", "&T", "&U", "&D", "&P", "&PT"}; mPrintSelectionOnlyCheckbox = [self checkboxWithLabel:"selectionOnly" andFrame:NSMakeRect(156, 155, 0, 0)]; - bool canPrintSelection; - mSettings->GetPrintOptions(nsIPrintSettings::kEnableSelectionRB, &canPrintSelection); + bool canPrintSelection = mSettings->GetIsPrintSelectionRBEnabled(); [mPrintSelectionOnlyCheckbox setEnabled:canPrintSelection]; if (mSettings->GetPrintSelectionOnly()) { diff --git a/widget/gtk/nsPrintDialogGTK.cpp b/widget/gtk/nsPrintDialogGTK.cpp index f38fcf698848..38dff1e2dea5 100644 --- a/widget/gtk/nsPrintDialogGTK.cpp +++ b/widget/gtk/nsPrintDialogGTK.cpp @@ -197,9 +197,7 @@ nsPrintDialogWidgetGTK::nsPrintDialogWidgetGTK(nsPIDOMWindowOuter* aParent, // GTK+2.18 and above allow us to add a "Selection" option to the main // settings screen, rather than adding an option on a custom tab like we must // do on older versions. - bool canSelectText; - aSettings->GetPrintOptions(nsIPrintSettings::kEnableSelectionRB, - &canSelectText); + bool canSelectText = aSettings->GetIsPrintSelectionRBEnabled(); if (gtk_major_version > 2 || (gtk_major_version == 2 && gtk_minor_version >= 18)) { useNativeSelection = true; diff --git a/widget/nsIPrintSettings.idl b/widget/nsIPrintSettings.idl index 81debe5f9912..03090eff5331 100644 --- a/widget/nsIPrintSettings.idl +++ b/widget/nsIPrintSettings.idl @@ -62,9 +62,6 @@ interface nsIPrintSettings : nsISupports const unsigned long kInitSaveAll = 0xFFFFFFFF; - /* Print Option Flags for Bit Field*/ - const long kEnableSelectionRB = 0x00000001; - /* Print Range Enums */ const long kRangeAllPages = 0; const long kRangeSpecifiedPageRange = 1; @@ -100,26 +97,6 @@ interface nsIPrintSettings : nsISupports const short kDuplexHorizontal = 1; const short kDuplexVertical = 2; - /** - * Set PrintOptions - */ - void SetPrintOptions(in int32_t aType, in boolean aTurnOnOff); - - /** - * Get PrintOptions - */ - boolean GetPrintOptions(in int32_t aType); - - /** - * Get PrintOptions Bit field - */ - int32_t GetPrintOptionsBits(); - - /** - * Set PrintOptions Bit field - */ - void SetPrintOptionsBits(in int32_t bits); - /** * Get the page size in twips, considering the * orientation (portrait or landscape). @@ -183,6 +160,10 @@ interface nsIPrintSettings : nsISupports /** Whether to draw guidelines showing the margin settings */ [infallible] attribute boolean showMarginGuides; + /** Whether whether the "print selection" radio button should be enabled + * in the UI (i.e. whether there is an active selection) */ + [infallible] attribute boolean isPrintSelectionRBEnabled; + /** Whether to only print the selected nodes */ [infallible] attribute boolean printSelectionOnly; diff --git a/widget/nsPrintSettingsImpl.cpp b/widget/nsPrintSettingsImpl.cpp index 1a0ab9ce4acc..2d5a5270198f 100644 --- a/widget/nsPrintSettingsImpl.cpp +++ b/widget/nsPrintSettingsImpl.cpp @@ -16,8 +16,7 @@ NS_IMPL_ISUPPORTS(nsPrintSettings, nsIPrintSettings) nsPrintSettings::nsPrintSettings() - : mPrintOptions(0L), - mPrintRange(kRangeAllPages), + : mPrintRange(kRangeAllPages), mStartPageNum(1), mEndPageNum(1), mScaling(1.0), @@ -30,6 +29,7 @@ nsPrintSettings::nsPrintSettings() mShowPrintProgress(true), mShowMarginGuides(false), mHonorPageRuleMargins(true), + mIsPrintSelectionRBEnabled(false), mPrintSelectionOnly(false), mPrintPageDelay(50), mPaperWidth(8.5), @@ -470,47 +470,6 @@ NS_IMETHODIMP nsPrintSettings::SetDocURL(const nsAString& aDocURL) { return NS_OK; } -/** --------------------------------------------------- - * See documentation in nsPrintSettingsImpl.h - * @update 1/12/01 rods - */ -NS_IMETHODIMP -nsPrintSettings::GetPrintOptions(int32_t aType, bool* aTurnOnOff) { - NS_ENSURE_ARG_POINTER(aTurnOnOff); - *aTurnOnOff = mPrintOptions & aType ? true : false; - return NS_OK; -} -/** --------------------------------------------------- - * See documentation in nsPrintSettingsImpl.h - * @update 1/12/01 rods - */ -NS_IMETHODIMP -nsPrintSettings::SetPrintOptions(int32_t aType, bool aTurnOnOff) { - if (aTurnOnOff) { - mPrintOptions |= aType; - } else { - mPrintOptions &= ~aType; - } - return NS_OK; -} - -/** --------------------------------------------------- - * See documentation in nsPrintSettingsImpl.h - * @update 1/12/01 rods - */ -NS_IMETHODIMP -nsPrintSettings::GetPrintOptionsBits(int32_t* aBits) { - NS_ENSURE_ARG_POINTER(aBits); - *aBits = mPrintOptions; - return NS_OK; -} - -NS_IMETHODIMP -nsPrintSettings::SetPrintOptionsBits(int32_t aBits) { - mPrintOptions = aBits; - return NS_OK; -} - NS_IMETHODIMP nsPrintSettings::GetHeaderStrLeft(nsAString& aTitle) { aTitle = mHeaderStrs[0]; return NS_OK; @@ -615,6 +574,17 @@ NS_IMETHODIMP nsPrintSettings::SetHonorPageRuleMargins(bool aHonor) { return NS_OK; } +NS_IMETHODIMP nsPrintSettings::GetIsPrintSelectionRBEnabled( + bool* aIsPrintSelectionRBEnabled) { + *aIsPrintSelectionRBEnabled = mIsPrintSelectionRBEnabled; + return NS_OK; +} +NS_IMETHODIMP nsPrintSettings::SetIsPrintSelectionRBEnabled( + bool aIsPrintSelectionRBEnabled) { + mIsPrintSelectionRBEnabled = aIsPrintSelectionRBEnabled; + return NS_OK; +} + NS_IMETHODIMP nsPrintSettings::GetPrintSelectionOnly(bool* aResult) { *aResult = mPrintSelectionOnly; return NS_OK; @@ -791,7 +761,6 @@ nsPrintSettings& nsPrintSettings::operator=(const nsPrintSettings& rhs) { mMargin = rhs.mMargin; mEdge = rhs.mEdge; mUnwriteableMargin = rhs.mUnwriteableMargin; - mPrintOptions = rhs.mPrintOptions; mScaling = rhs.mScaling; mPrintBGColors = rhs.mPrintBGColors; mPrintBGImages = rhs.mPrintBGImages; @@ -805,6 +774,7 @@ nsPrintSettings& nsPrintSettings::operator=(const nsPrintSettings& rhs) { mShowPrintProgress = rhs.mShowPrintProgress; mShowMarginGuides = rhs.mShowMarginGuides; mHonorPageRuleMargins = rhs.mHonorPageRuleMargins; + mIsPrintSelectionRBEnabled = rhs.mIsPrintSelectionRBEnabled; mPrintSelectionOnly = rhs.mPrintSelectionOnly; mPaperId = rhs.mPaperId; mPaperWidth = rhs.mPaperWidth; diff --git a/widget/nsPrintSettingsImpl.h b/widget/nsPrintSettingsImpl.h index 0de623fa4d38..c0c5f5fbaa31 100644 --- a/widget/nsPrintSettingsImpl.h +++ b/widget/nsPrintSettingsImpl.h @@ -78,8 +78,6 @@ class nsPrintSettings : public nsIPrintSettings { nsIntMargin mEdge; nsIntMargin mUnwriteableMargin; - int32_t mPrintOptions; - // scriptable data members int16_t mPrintRange; int32_t mStartPageNum; // only used for ePrintRange_SpecifiedRange @@ -95,6 +93,7 @@ class nsPrintSettings : public nsIPrintSettings { bool mShowPrintProgress; bool mShowMarginGuides; bool mHonorPageRuleMargins; + bool mIsPrintSelectionRBEnabled; bool mPrintSelectionOnly; int32_t mPrintPageDelay; diff --git a/widget/nsPrintSettingsService.cpp b/widget/nsPrintSettingsService.cpp index c482121bb243..ef14aea9d777 100644 --- a/widget/nsPrintSettingsService.cpp +++ b/widget/nsPrintSettingsService.cpp @@ -115,6 +115,7 @@ nsPrintSettingsService::SerializeToPrintData(nsIPrintSettings* aSettings, data->honorPageRuleMargins() = aSettings->GetHonorPageRuleMargins(); data->showMarginGuides() = aSettings->GetShowMarginGuides(); + data->isPrintSelectionRBEnabled() = aSettings->GetIsPrintSelectionRBEnabled(); data->printSelectionOnly() = aSettings->GetPrintSelectionOnly(); aSettings->GetPrintRange(&data->printRange()); @@ -159,8 +160,6 @@ nsPrintSettingsService::SerializeToPrintData(nsIPrintSettings* aSettings, aSettings->GetIsInitializedFromPrinter(&data->isInitializedFromPrinter()); aSettings->GetIsInitializedFromPrefs(&data->isInitializedFromPrefs()); - aSettings->GetPrintOptionsBits(&data->optionFlags()); - // Initialize the platform-specific values that don't // default-initialize, so that we don't send uninitialized data over // IPC (which leads to valgrind warnings, and, for bools, fatal @@ -215,6 +214,7 @@ nsPrintSettingsService::DeserializeToPrintSettings(const PrintData& data, settings->SetPrintBGImages(data.printBGImages()); settings->SetHonorPageRuleMargins(data.honorPageRuleMargins()); settings->SetShowMarginGuides(data.showMarginGuides()); + settings->SetIsPrintSelectionRBEnabled(data.isPrintSelectionRBEnabled()); settings->SetPrintSelectionOnly(data.printSelectionOnly()); settings->SetPrintRange(data.printRange()); @@ -261,8 +261,6 @@ nsPrintSettingsService::DeserializeToPrintSettings(const PrintData& data, settings->SetIsInitializedFromPrinter(data.isInitializedFromPrinter()); settings->SetIsInitializedFromPrefs(data.isInitializedFromPrefs()); - settings->SetPrintOptionsBits(data.optionFlags()); - return NS_OK; } diff --git a/widget/windows/nsPrintDialogUtil.cpp b/widget/windows/nsPrintDialogUtil.cpp index fa4f0eab901e..1835eceef44b 100644 --- a/widget/windows/nsPrintDialogUtil.cpp +++ b/widget/windows/nsPrintDialogUtil.cpp @@ -215,9 +215,7 @@ static nsresult ShowNativePrintDialog(HWND aHWnd, PD_ALLPAGES | PD_RETURNIC | PD_USEDEVMODECOPIESANDCOLLATE | PD_COLLATE; // if there is a current selection then enable the "Selection" radio button - bool isOn; - aPrintSettings->GetPrintOptions(nsIPrintSettings::kEnableSelectionRB, &isOn); - if (!isOn) { + if (!aPrintSettings->GetIsPrintSelectionRBEnabled()) { prntdlg.Flags |= PD_NOSELECTION; }