Bug 1091112 - Serialize nsIPrintSettings options bitfield. r=jimm
authorMike Conley <mconley@mozilla.com>
Wed, 06 May 2015 15:35:35 -0400
changeset 246487 c85e82f11795ee0c8ef23539ab42876b8dc53103
parent 246486 ca9f7945ed558f6dd3ef50260080c9964210cdbc
child 246488 9b2f9883b6a8d5b787a5ba69ef1e574a19f74b9a
push id13282
push usercbook@mozilla.com
push dateMon, 01 Jun 2015 13:38:44 +0000
treeherderfx-team@87b49eca8ced [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm
bugs1091112
milestone41.0a1
Bug 1091112 - Serialize nsIPrintSettings options bitfield. r=jimm
embedding/components/printingui/ipc/PPrintingTypes.ipdlh
widget/nsIPrintSettings.idl
widget/nsPrintOptionsImpl.cpp
widget/nsPrintSettingsImpl.cpp
--- a/embedding/components/printingui/ipc/PPrintingTypes.ipdlh
+++ b/embedding/components/printingui/ipc/PPrintingTypes.ipdlh
@@ -67,16 +67,17 @@ struct PrintData {
   nsString toFileName;
   short outputFormat;
   int32_t printPageDelay;
   int32_t resolution;
   int32_t duplex;
   bool isInitializedFromPrinter;
   bool isInitializedFromPrefs;
   bool persistMarginBoxSettings;
+  int32_t optionFlags;
 
   /* Windows-specific things */
   nsString driverName;
   nsString deviceName;
   bool isFramesetDocument;
   bool isFramesetFrameSelected;
   bool isIFrameSelected;
   bool isRangeSelection;
--- a/widget/nsIPrintSettings.idl
+++ b/widget/nsIPrintSettings.idl
@@ -17,17 +17,17 @@
   [ref] native nsNativeIntMarginRef(nsIntMargin);
   [ref] native IntegerArray(nsTArray<int32_t>);
   
 interface nsIPrintSession;
 
 /**
  * Simplified graphics interface for JS rendering.
  */
-[scriptable, uuid(1bcfc611-8941-4c39-9e06-7116e564a1ce)]
+[scriptable, uuid(11b86b46-12c9-4e63-8023-129dd239ace7)]
 
 interface nsIPrintSettings : nsISupports
 {
   /**
    * PrintSettings to be Saved Navigation Constants
    */
   const unsigned long kInitSaveOddEvenPages   = 0x00000001;
   const unsigned long kInitSaveHeaderLeft     = 0x00000002;
@@ -132,19 +132,24 @@ interface nsIPrintSettings : nsISupports
   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
    */
-  int32_t GetPrintOptionsBits();
+  void SetPrintOptionsBits(in int32_t bits);
 
   /**
    * Get the page size in twips, considering the
    * orientation (portrait or landscape).
    */
   void GetEffectivePageSize(out double aWidth, out double aHeight);
 
   /**
--- a/widget/nsPrintOptionsImpl.cpp
+++ b/widget/nsPrintOptionsImpl.cpp
@@ -218,16 +218,18 @@ nsPrintOptions::SerializeToPrintData(nsI
   aSettings->GetOutputFormat(&data->outputFormat());
   aSettings->GetPrintPageDelay(&data->printPageDelay());
   aSettings->GetResolution(&data->resolution());
   aSettings->GetDuplex(&data->duplex());
   aSettings->GetIsInitializedFromPrinter(&data->isInitializedFromPrinter());
   aSettings->GetIsInitializedFromPrefs(&data->isInitializedFromPrefs());
   aSettings->GetPersistMarginBoxSettings(&data->persistMarginBoxSettings());
 
+  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
   // assertions).
   // data->driverName() default-initializes
   // data->deviceName() default-initializes
   data->isFramesetDocument() = false;
   data->isFramesetFrameSelected() = false;
@@ -319,16 +321,18 @@ nsPrintOptions::DeserializeToPrintSettin
   settings->SetOutputFormat(data.outputFormat());
   settings->SetPrintPageDelay(data.printPageDelay());
   settings->SetResolution(data.resolution());
   settings->SetDuplex(data.duplex());
   settings->SetIsInitializedFromPrinter(data.isInitializedFromPrinter());
   settings->SetIsInitializedFromPrefs(data.isInitializedFromPrefs());
   settings->SetPersistMarginBoxSettings(data.persistMarginBoxSettings());
 
+  settings->SetPrintOptionsBits(data.optionFlags());
+
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsPrintOptions::ShowPrintSetupDialog(nsIPrintSettings *aPS)
 {
   NS_ENSURE_ARG_POINTER(aPS);
--- a/widget/nsPrintSettingsImpl.cpp
+++ b/widget/nsPrintSettingsImpl.cpp
@@ -688,24 +688,31 @@ nsPrintSettings::SetPrintOptions(int32_t
   }
   return NS_OK;
 }
 
 /** ---------------------------------------------------
  *  See documentation in nsPrintSettingsImpl.h
  *	@update 1/12/01 rods
  */
-NS_IMETHODIMP 
+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;
+}
+
 /* attribute wstring docTitle; */
 nsresult 
 nsPrintSettings::GetMarginStrs(char16_t * *aTitle, 
                               nsHeaderFooterEnum aType, 
                               int16_t aJust)
 {
   NS_ENSURE_ARG_POINTER(aTitle);
   *aTitle = nullptr;