Bug 1553324. Remove nsIPrintSettings.printFrameTypeUsage. r=bobowen
authorJonathan Watt <jwatt@jwatt.org>
Mon, 13 May 2019 16:30:20 +0100
changeset 475396 919893dc7365431d63b09f1603a961e6e5285f20
parent 475395 1af5cf2905662442515ff17166e79cb3e10e252f
child 475397 740009023b1b6867a18b8f2f44e0ba84bfa229ec
push id36061
push usercbrindusan@mozilla.com
push dateFri, 24 May 2019 21:49:59 +0000
treeherdermozilla-central@5d3e1ea77693 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbobowen
bugs1553324
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1553324. Remove nsIPrintSettings.printFrameTypeUsage. r=bobowen Differential Revision: https://phabricator.services.mozilla.com/D32068
layout/printing/nsPrintJob.cpp
toolkit/components/printingui/ipc/PPrintingTypes.ipdlh
widget/nsIPrintSettings.idl
widget/nsIPrintSettingsService.idl
widget/nsPrintSettingsImpl.cpp
widget/nsPrintSettingsImpl.h
widget/nsPrintSettingsService.cpp
--- a/layout/printing/nsPrintJob.cpp
+++ b/layout/printing/nsPrintJob.cpp
@@ -981,65 +981,17 @@ nsresult nsPrintJob::DoCommonPrint(bool 
 
   if (aIsPrintPreview) {
     printData->mPrintSettings->SetPrintFrameType(nsIPrintSettings::kFramesAsIs);
 
     // override any UI that wants to PrintPreview any selection or page range
     // we want to view every page in PrintPreview each time
     printData->mPrintSettings->SetPrintRange(nsIPrintSettings::kRangeAllPages);
   } else {
-    // Always check and set the print settings first and then fall back
-    // onto the PrintService if there isn't a PrintSettings
-    //
-    // Posiible Usage values:
-    //   nsIPrintSettings::kUseInternalDefault
-    //   nsIPrintSettings::kUseSettingWhenPossible
-    //
-    // NOTE: The consts are the same for PrintSettings and PrintSettings
-    int16_t printFrameTypeUsage = nsIPrintSettings::kUseSettingWhenPossible;
-    printData->mPrintSettings->GetPrintFrameTypeUsage(&printFrameTypeUsage);
-
-    // Ok, see if we are going to use our value and override the default
-    if (printFrameTypeUsage == nsIPrintSettings::kUseSettingWhenPossible) {
-      // Get the Print Options/Settings PrintFrameType to see what is preferred
-      int16_t printFrameType = nsIPrintSettings::kEachFrameSep;
-      printData->mPrintSettings->GetPrintFrameType(&printFrameType);
-
-      // Don't let anybody do something stupid like try to set it to
-      // kNoFrames when we are printing a FrameSet
-      if (printFrameType == nsIPrintSettings::kNoFrames) {
-        printData->mPrintFrameType = nsIPrintSettings::kEachFrameSep;
-        printData->mPrintSettings->SetPrintFrameType(
-            printData->mPrintFrameType);
-      } else {
-        // First find out from the PrinService what options are available
-        // to us for Printing FrameSets
-        int16_t howToEnableFrameUI;
-        printData->mPrintSettings->GetHowToEnableFrameUI(&howToEnableFrameUI);
-        if (howToEnableFrameUI != nsIPrintSettings::kFrameEnableNone) {
-          switch (howToEnableFrameUI) {
-            case nsIPrintSettings::kFrameEnableAll:
-              printData->mPrintFrameType = printFrameType;
-              break;
-
-            case nsIPrintSettings::kFrameEnableAsIsAndEach:
-              if (printFrameType != nsIPrintSettings::kSelectedFrame) {
-                printData->mPrintFrameType = printFrameType;
-              } else {  // revert back to a good value
-                printData->mPrintFrameType = nsIPrintSettings::kEachFrameSep;
-              }
-              break;
-          }  // switch
-          printData->mPrintSettings->SetPrintFrameType(
-              printData->mPrintFrameType);
-        }
-      }
-    } else {
-      printData->mPrintSettings->GetPrintFrameType(&printData->mPrintFrameType);
-    }
+    printData->mPrintSettings->GetPrintFrameType(&printData->mPrintFrameType);
   }
 
   if (printData->mPrintFrameType == nsIPrintSettings::kEachFrameSep) {
     CheckForChildFrameSets(printData->mPrintObject);
   }
 
   if (NS_FAILED(EnablePOsForPrinting())) {
     return NS_ERROR_FAILURE;
--- a/toolkit/components/printingui/ipc/PPrintingTypes.ipdlh
+++ b/toolkit/components/printingui/ipc/PPrintingTypes.ipdlh
@@ -39,17 +39,16 @@ struct PrintData {
   nsString headerStrCenter;
   nsString headerStrRight;
   nsString footerStrLeft;
   nsString footerStrCenter;
   nsString footerStrRight;
 
   short  howToEnableFrameUI;
   bool isCancelled;
-  short printFrameTypeUsage;
   short  printFrameType;
   bool printSilent;
   bool shrinkToFit;
   bool showPrintProgress;
 
   nsString paperName;
   short paperData;
   double paperWidth;
--- a/widget/nsIPrintSettings.idl
+++ b/widget/nsIPrintSettings.idl
@@ -72,22 +72,16 @@ interface nsIPrintSettings : nsISupports
   const long kRangeSelection          = 2;
 
   /* Justification Enums */
   const long kJustLeft   = 0;
   const long kJustCenter = 1;
   const long kJustRight  = 2;
 
   /**
-   * FrameSet Default Type Constants
-   */
-  const short kUseInternalDefault    = 0;
-  const short kUseSettingWhenPossible = 1;
-
-  /**
    * Page Size Type Constants
    */
   const short kPaperSizeNativeData  = 0;
   const short kPaperSizeDefined     = 1;
 
   /**
    * Page Size Unit Constants
    */
@@ -209,17 +203,16 @@ interface nsIPrintSettings : nsISupports
 
   attribute AString footerStrLeft;
   attribute AString footerStrCenter;
   attribute AString footerStrRight;
 
   attribute short   howToEnableFrameUI;  /* indicates how to enable the frameset UI            */
   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 short   printFrameTypeUsage; /* indicates whether to use the interal value or not  */
   attribute short   printFrameType;
   attribute boolean printSilent;         /* print without putting up the dialog */
   attribute boolean shrinkToFit;         /* shrinks content to fit on page      */
   attribute boolean showPrintProgress;   /* indicates whether the progress dialog should be shown */
 
   /* Additional XP Related */
   attribute AString paperName;     /* name of paper */
   attribute short   paperData;     /* native data value */
--- a/widget/nsIPrintSettingsService.idl
+++ b/widget/nsIPrintSettingsService.idl
@@ -82,17 +82,17 @@ interface nsIPrintSettingsService : nsIS
    *
    * aPS - PrintSettings to have its settings read
    * aUsePrinterNamePrefix - indicates whether to use the printer name as a prefix
    * aFlags - indicates which prefs to read, see nsIPrintSettings.idl for the
    *          const values.
    *
    * Items not read:
    *   startPageRange, endPageRange, scaling, printRange, title
-   *   docURL, howToEnableFrameUI, isCancelled, printFrameTypeUsage
+   *   docURL, howToEnableFrameUI, isCancelled,
    *   printFrameType, printSilent, shrinkToFit, numCopies,
    *   printerName
    *
    */
   void initPrintSettingsFromPrefs(in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags);
 
   /**
    * Writes PrintSettings values to Prefs, 
@@ -103,17 +103,17 @@ interface nsIPrintSettingsService : nsIS
    * If a PrinterName is there, then it saves the items qualified for that Printer
    *
    * aPS - PrintSettings to have its settings saved
    * aUsePrinterNamePrefix - indicates whether to use the printer name as a prefix
    * aFlags - indicates which prefs to save, see nsIPrintSettings.idl for the const values.
    *
    * Items not written:
    *   startPageRange, endPageRange, scaling, printRange, title
-   *   docURL, howToEnableFrameUI, isCancelled, printFrameTypeUsage
+   *   docURL, howToEnableFrameUI, isCancelled,
    *   printFrameType, printSilent, shrinkToFit, numCopies
    *
    */
   void savePrintSettingsToPrefs(in nsIPrintSettings aPrintSettings, in boolean aUsePrinterNamePrefix, in unsigned long aFlags);
 
   /**
    * Given some nsIPrintSettings and (optionally) an nsIWebBrowserPrint,
    * populates a PrintData representing them which can be sent over IPC. Values
--- a/widget/nsPrintSettingsImpl.cpp
+++ b/widget/nsPrintSettingsImpl.cpp
@@ -15,17 +15,16 @@ NS_IMPL_ISUPPORTS(nsPrintSettings, nsIPr
 nsPrintSettings::nsPrintSettings()
     : mPrintOptions(0L),
       mPrintRange(kRangeAllPages),
       mStartPageNum(1),
       mEndPageNum(1),
       mScaling(1.0),
       mPrintBGColors(false),
       mPrintBGImages(false),
-      mPrintFrameTypeUsage(kUseInternalDefault),
       mPrintFrameType(kFramesAsIs),
       mHowToEnableFrameUI(kFrameEnableNone),
       mIsCancelled(false),
       mSaveOnCancel(true),
       mPrintSilent(false),
       mShrinkToFit(true),
       mShowPrintProgress(true),
       mPrintPageDelay(50),
@@ -532,28 +531,16 @@ NS_IMETHODIMP nsPrintSettings::GetFooter
   aTitle = mFooterStrs[2];
   return NS_OK;
 }
 NS_IMETHODIMP nsPrintSettings::SetFooterStrRight(const nsAString& aTitle) {
   mFooterStrs[2] = aTitle;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsPrintSettings::GetPrintFrameTypeUsage(
-    int16_t* aPrintFrameTypeUsage) {
-  NS_ENSURE_ARG_POINTER(aPrintFrameTypeUsage);
-  *aPrintFrameTypeUsage = mPrintFrameTypeUsage;
-  return NS_OK;
-}
-NS_IMETHODIMP nsPrintSettings::SetPrintFrameTypeUsage(
-    int16_t aPrintFrameTypeUsage) {
-  mPrintFrameTypeUsage = aPrintFrameTypeUsage;
-  return NS_OK;
-}
-
 NS_IMETHODIMP nsPrintSettings::GetPrintFrameType(int16_t* aPrintFrameType) {
   NS_ENSURE_ARG_POINTER(aPrintFrameType);
   *aPrintFrameType = (int32_t)mPrintFrameType;
   return NS_OK;
 }
 NS_IMETHODIMP nsPrintSettings::SetPrintFrameType(int16_t aPrintFrameType) {
   mPrintFrameType = aPrintFrameType;
   return NS_OK;
@@ -794,17 +781,16 @@ nsPrintSettings& nsPrintSettings::operat
   mScaling = rhs.mScaling;
   mPrintBGColors = rhs.mPrintBGColors;
   mPrintBGImages = rhs.mPrintBGImages;
   mPrintRange = rhs.mPrintRange;
   mTitle = rhs.mTitle;
   mURL = rhs.mURL;
   mHowToEnableFrameUI = rhs.mHowToEnableFrameUI;
   mIsCancelled = rhs.mIsCancelled;
-  mPrintFrameTypeUsage = rhs.mPrintFrameTypeUsage;
   mPrintFrameType = rhs.mPrintFrameType;
   mPrintSilent = rhs.mPrintSilent;
   mShrinkToFit = rhs.mShrinkToFit;
   mShowPrintProgress = rhs.mShowPrintProgress;
   mPaperName = rhs.mPaperName;
   mPaperData = rhs.mPaperData;
   mPaperWidth = rhs.mPaperWidth;
   mPaperHeight = rhs.mPaperHeight;
--- a/widget/nsPrintSettingsImpl.h
+++ b/widget/nsPrintSettingsImpl.h
@@ -50,17 +50,16 @@ class nsPrintSettings : public nsIPrintS
   // scriptable data members
   int16_t mPrintRange;
   int32_t mStartPageNum;  // only used for ePrintRange_SpecifiedRange
   int32_t mEndPageNum;
   double mScaling;
   bool mPrintBGColors;  // print background colors
   bool mPrintBGImages;  // print background images
 
-  int16_t mPrintFrameTypeUsage;
   int16_t mPrintFrameType;
   int16_t mHowToEnableFrameUI;
   bool mIsCancelled;
   bool mSaveOnCancel;
   bool mPrintSilent;
   bool mShrinkToFit;
   bool mShowPrintProgress;
   int32_t mPrintPageDelay;
--- a/widget/nsPrintSettingsService.cpp
+++ b/widget/nsPrintSettingsService.cpp
@@ -130,17 +130,16 @@ nsPrintSettingsService::SerializeToPrint
   aSettings->GetHeaderStrRight(data->headerStrRight());
 
   aSettings->GetFooterStrLeft(data->footerStrLeft());
   aSettings->GetFooterStrCenter(data->footerStrCenter());
   aSettings->GetFooterStrRight(data->footerStrRight());
 
   aSettings->GetHowToEnableFrameUI(&data->howToEnableFrameUI());
   aSettings->GetIsCancelled(&data->isCancelled());
-  aSettings->GetPrintFrameTypeUsage(&data->printFrameTypeUsage());
   aSettings->GetPrintFrameType(&data->printFrameType());
   aSettings->GetPrintSilent(&data->printSilent());
   aSettings->GetShrinkToFit(&data->shrinkToFit());
   aSettings->GetShowPrintProgress(&data->showPrintProgress());
 
   aSettings->GetPaperName(data->paperName());
   aSettings->GetPaperData(&data->paperData());
   aSettings->GetPaperWidth(&data->paperWidth());
@@ -238,17 +237,16 @@ nsPrintSettingsService::DeserializeToPri
 
   // Footer strings...
   settings->SetFooterStrLeft(data.footerStrLeft());
   settings->SetFooterStrCenter(data.footerStrCenter());
   settings->SetFooterStrRight(data.footerStrRight());
 
   settings->SetHowToEnableFrameUI(data.howToEnableFrameUI());
   settings->SetIsCancelled(data.isCancelled());
-  settings->SetPrintFrameTypeUsage(data.printFrameTypeUsage());
   settings->SetPrintFrameType(data.printFrameType());
   settings->SetPrintSilent(data.printSilent());
   settings->SetShrinkToFit(data.shrinkToFit());
   settings->SetShowPrintProgress(data.showPrintProgress());
 
   settings->SetPaperName(data.paperName());
 
   settings->SetPaperData(data.paperData());