Bug 1091112 - Serialize nsIPrintSettings options bitfield. r=jimm

This commit is contained in:
Mike Conley 2015-05-06 15:35:35 -04:00
parent 0e7edc78fc
commit eb9cc06bce
4 changed files with 20 additions and 3 deletions

View File

@ -72,6 +72,7 @@ struct PrintData {
bool isInitializedFromPrinter;
bool isInitializedFromPrefs;
bool persistMarginBoxSettings;
int32_t optionFlags;
/* Windows-specific things */
nsString driverName;

View File

@ -22,7 +22,7 @@ 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
{
@ -137,10 +137,15 @@ interface nsIPrintSettings : nsISupports
boolean GetPrintOptions(in int32_t aType);
/**
* Set PrintOptions Bit field
* 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).

View File

@ -223,6 +223,8 @@ nsPrintOptions::SerializeToPrintData(nsIPrintSettings* aSettings,
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
@ -324,6 +326,8 @@ nsPrintOptions::DeserializeToPrintSettings(const PrintData& data,
settings->SetIsInitializedFromPrefs(data.isInitializedFromPrefs());
settings->SetPersistMarginBoxSettings(data.persistMarginBoxSettings());
settings->SetPrintOptionsBits(data.optionFlags());
return NS_OK;
}

View File

@ -693,7 +693,7 @@ nsPrintSettings::SetPrintOptions(int32_t aType, bool aTurnOnOff)
* See documentation in nsPrintSettingsImpl.h
* @update 1/12/01 rods
*/
NS_IMETHODIMP
NS_IMETHODIMP
nsPrintSettings::GetPrintOptionsBits(int32_t *aBits)
{
NS_ENSURE_ARG_POINTER(aBits);
@ -701,6 +701,13 @@ nsPrintSettings::GetPrintOptionsBits(int32_t *aBits)
return NS_OK;
}
NS_IMETHODIMP
nsPrintSettings::SetPrintOptionsBits(int32_t aBits)
{
mPrintOptions = aBits;
return NS_OK;
}
/* attribute wstring docTitle; */
nsresult
nsPrintSettings::GetMarginStrs(char16_t * *aTitle,