Backed out changeset 50f830bdb2c8 (bug 1315121) for failing reftest-sanity/page-width-4.1in.html on OS X 10.10 debug. r=backout on a CLOSED TREE

This commit is contained in:
Sebastian Hengst 2016-11-17 21:53:26 +01:00
parent 20a51e488b
commit d35d1a1445
5 changed files with 2 additions and 75 deletions

View File

@ -118,8 +118,6 @@ struct PrintData {
*/
float widthScale;
float heightScale;
double adjustedPaperWidth;
double adjustedPaperHeight;
};
} // namespace embedding

View File

@ -145,18 +145,7 @@ nsPrintDialogServiceX::Show(nsPIDOMWindowOuter *aParent, nsIPrintSettings *aSett
[dict setObject: [NSNumber numberWithFloat: 1]
forKey: NSPrintScalingFactor];
}
// Set the scaling factor to 100% in the NSPrintInfo
// object so that it will not affect the paper size
// retrieved from the PMPageFormat routines.
[copy setScalingFactor:1.0];
} else {
aSettings->SetScaling([copy scalingFactor]);
}
// Set the adjusted paper size now that we've updated
// the scaling factor.
settingsX->InitAdjustedPaperSize();
[copy release];
int16_t pageRange;

View File

@ -71,11 +71,6 @@ nsPrintOptionsX::SerializeToPrintData(nsIPrintSettings* aSettings,
return NS_ERROR_FAILURE;
}
double adjustedWidth, adjustedHeight;
settingsX->GetAdjustedPaperSize(&adjustedWidth, &adjustedHeight);
data->adjustedPaperWidth() = adjustedWidth;
data->adjustedPaperHeight() = adjustedHeight;
NSDictionary* dict = [printInfo dictionary];
if (NS_WARN_IF(!dict)) {
return NS_ERROR_FAILURE;
@ -290,9 +285,6 @@ nsPrintOptionsX::DeserializeToPrintSettings(const PrintData& data,
settingsX->SetCocoaPrintInfo(newPrintInfo);
[newPrintInfo release];
settingsX->SetAdjustedPaperSize(data.adjustedPaperWidth(),
data.adjustedPaperHeight());
return NS_OK;
}

View File

@ -25,8 +25,6 @@ public:
void SetCocoaPrintInfo(NSPrintInfo* aPrintInfo);
virtual nsresult ReadPageFormatFromPrefs();
virtual nsresult WritePageFormatToPrefs();
virtual nsresult GetEffectivePageSize(double *aWidth,
double *aHeight) override;
PMPrintSettings GetPMPrintSettings();
PMPrintSession GetPMPrintSession();
@ -37,16 +35,9 @@ public:
// Should be called whenever mPageFormat is initialized or overwritten.
nsresult InitUnwriteableMargin();
// Re-initialize mAdjustedPaper{Width,Height} with values from mPageFormat.
// Should be called whenever mPageFormat is initialized or overwritten.
nsresult InitAdjustedPaperSize();
void SetInchesScale(float aWidthScale, float aHeightScale);
void GetInchesScale(float *aWidthScale, float *aHeightScale);
void SetAdjustedPaperSize(double aWidth, double aHeight);
void GetAdjustedPaperSize(double *aWidth, double *aHeight);
protected:
virtual ~nsPrintSettingsX();
@ -66,8 +57,6 @@ protected:
// paper size units to inches
float mWidthScale;
float mHeightScale;
double mAdjustedPaperWidth;
double mAdjustedPaperHeight;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsPrintSettingsX, NS_PRINTSETTINGSX_IID)

View File

@ -68,7 +68,6 @@ nsresult nsPrintSettingsX::Init()
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
InitUnwriteableMargin();
InitAdjustedPaperSize();
return NS_OK;
@ -95,23 +94,6 @@ NS_IMETHODIMP nsPrintSettingsX::InitUnwriteableMargin()
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
NS_IMETHODIMP nsPrintSettingsX::InitAdjustedPaperSize()
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
PMPageFormat pageFormat = GetPMPageFormat();
PMRect paperRect;
::PMGetAdjustedPaperRect(pageFormat, &paperRect);
mAdjustedPaperWidth = paperRect.right - paperRect.left;
mAdjustedPaperHeight = paperRect.bottom - paperRect.top;
return NS_OK;
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
}
void
nsPrintSettingsX::SetCocoaPrintInfo(NSPrintInfo* aPrintInfo)
{
@ -224,10 +206,8 @@ nsPrintSettingsX::SetPMPageFormat(PMPageFormat aPageFormat)
void
nsPrintSettingsX::SetInchesScale(float aWidthScale, float aHeightScale)
{
if (aWidthScale > 0 && aHeightScale > 0) {
mWidthScale = aWidthScale;
mHeightScale = aHeightScale;
}
mWidthScale = aWidthScale;
mHeightScale = aHeightScale;
}
void
@ -236,24 +216,3 @@ nsPrintSettingsX::GetInchesScale(float *aWidthScale, float *aHeightScale)
*aWidthScale = mWidthScale;
*aHeightScale = mHeightScale;
}
NS_IMETHODIMP
nsPrintSettingsX::GetEffectivePageSize(double *aWidth, double *aHeight)
{
*aWidth = NS_INCHES_TO_TWIPS(mAdjustedPaperWidth / mWidthScale);
*aHeight = NS_INCHES_TO_TWIPS(mAdjustedPaperHeight / mHeightScale);
return NS_OK;
}
void nsPrintSettingsX::SetAdjustedPaperSize(double aWidth, double aHeight)
{
mAdjustedPaperWidth = aWidth;
mAdjustedPaperHeight = aHeight;
}
void nsPrintSettingsX::GetAdjustedPaperSize(double *aWidth, double *aHeight)
{
*aWidth = mAdjustedPaperWidth;
*aHeight = mAdjustedPaperHeight;
}