mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 02:25:34 +00:00
Bug 1366744 - Fix wrong PaperSizeUnit handling. r=haik
MozReview-Commit-ID: 9cI3smid34l --HG-- extra : rebase_source : 4f8ab53e4caf18e9d6beb31f26eef7aca2f9274d extra : histedit_source : 5fda30c2e2ba6175766305df78eb87f87839491a
This commit is contained in:
parent
e09cc86975
commit
7c7f32088a
@ -70,10 +70,7 @@ NS_IMETHODIMP nsDeviceContextSpecX::Init(nsIWidget *aWidget,
|
||||
bool toPrinter = !toFile && !aIsPrintPreview;
|
||||
if (!toPrinter) {
|
||||
double width, height;
|
||||
settings->GetEffectivePageSize(&width, &height);
|
||||
width /= TWIPS_PER_POINT_FLOAT;
|
||||
height /= TWIPS_PER_POINT_FLOAT;
|
||||
|
||||
settings->GetFilePageSize(&width, &height);
|
||||
settings->SetCocoaPaperSize(width, height);
|
||||
}
|
||||
|
||||
|
@ -40,6 +40,7 @@ public:
|
||||
virtual nsresult WritePageFormatToPrefs();
|
||||
virtual nsresult GetEffectivePageSize(double *aWidth,
|
||||
double *aHeight) override;
|
||||
void GetFilePageSize(double *aWidth, double *aHeight);
|
||||
|
||||
// In addition to setting the paper width and height, these
|
||||
// overrides set the adjusted width and height returned from
|
||||
|
@ -254,16 +254,29 @@ NS_IMETHODIMP nsPrintSettingsX::SetPaperHeight(double aPaperHeight)
|
||||
NS_IMETHODIMP
|
||||
nsPrintSettingsX::GetEffectivePageSize(double *aWidth, double *aHeight)
|
||||
{
|
||||
if (kPaperSizeInches == GetCocoaUnit(mPaperSizeUnit)) {
|
||||
*aWidth = NS_INCHES_TO_TWIPS(mAdjustedPaperWidth / mWidthScale);
|
||||
*aHeight = NS_INCHES_TO_TWIPS(mAdjustedPaperHeight / mHeightScale);
|
||||
} else {
|
||||
*aWidth = NS_MILLIMETERS_TO_TWIPS(mAdjustedPaperWidth / mWidthScale);
|
||||
*aHeight = NS_MILLIMETERS_TO_TWIPS(mAdjustedPaperHeight / mHeightScale);
|
||||
}
|
||||
*aWidth = NS_INCHES_TO_TWIPS(mAdjustedPaperWidth / mWidthScale);
|
||||
*aHeight = NS_INCHES_TO_TWIPS(mAdjustedPaperHeight / mHeightScale);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsPrintSettingsX::GetFilePageSize(double *aWidth, double *aHeight)
|
||||
{
|
||||
double height, width;
|
||||
if (kPaperSizeInches == GetCocoaUnit(mPaperSizeUnit)) {
|
||||
width = NS_INCHES_TO_TWIPS(mAdjustedPaperWidth / mWidthScale);
|
||||
height = NS_INCHES_TO_TWIPS(mAdjustedPaperHeight / mHeightScale);
|
||||
} else {
|
||||
width = NS_MILLIMETERS_TO_TWIPS(mAdjustedPaperWidth / mWidthScale);
|
||||
height = NS_MILLIMETERS_TO_TWIPS(mAdjustedPaperHeight / mHeightScale);
|
||||
}
|
||||
width /= TWIPS_PER_POINT_FLOAT;
|
||||
height /= TWIPS_PER_POINT_FLOAT;
|
||||
|
||||
*aWidth = width;
|
||||
*aHeight = height;
|
||||
}
|
||||
|
||||
void nsPrintSettingsX::SetAdjustedPaperSize(double aWidth, double aHeight)
|
||||
{
|
||||
mAdjustedPaperWidth = aWidth;
|
||||
|
Loading…
Reference in New Issue
Block a user