Skip to content

Commit

Permalink
Backed out changeset 50f830bdb2c8 (bug 1315121) for failing reftest-s…
Browse files Browse the repository at this point in the history
…anity/page-width-4.1in.html on OS X 10.10 debug. r=backout on a CLOSED TREE
  • Loading branch information
Archaeopteryx committed Nov 17, 2016
1 parent d5bfe81 commit a41abfb
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 75 deletions.
2 changes: 0 additions & 2 deletions embedding/components/printingui/ipc/PPrintingTypes.ipdlh
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ struct PrintData {
*/
float widthScale;
float heightScale;
double adjustedPaperWidth;
double adjustedPaperHeight;
};

} // namespace embedding
Expand Down
11 changes: 0 additions & 11 deletions widget/cocoa/nsPrintDialogX.mm
Original file line number Diff line number Diff line change
Expand Up @@ -145,18 +145,7 @@
[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;
Expand Down
8 changes: 0 additions & 8 deletions widget/cocoa/nsPrintOptionsX.mm
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,6 @@
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;
Expand Down Expand Up @@ -290,9 +285,6 @@
settingsX->SetCocoaPrintInfo(newPrintInfo);
[newPrintInfo release];

settingsX->SetAdjustedPaperSize(data.adjustedPaperWidth(),
data.adjustedPaperHeight());

return NS_OK;
}

Expand Down
11 changes: 0 additions & 11 deletions widget/cocoa/nsPrintSettingsX.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ class nsPrintSettingsX : public nsPrintSettings
void SetCocoaPrintInfo(NSPrintInfo* aPrintInfo);
virtual nsresult ReadPageFormatFromPrefs();
virtual nsresult WritePageFormatToPrefs();
virtual nsresult GetEffectivePageSize(double *aWidth,
double *aHeight) override;

PMPrintSettings GetPMPrintSettings();
PMPrintSession GetPMPrintSession();
Expand All @@ -37,16 +35,9 @@ class nsPrintSettingsX : public nsPrintSettings
// 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();

Expand All @@ -66,8 +57,6 @@ class nsPrintSettingsX : public nsPrintSettings
// paper size units to inches
float mWidthScale;
float mHeightScale;
double mAdjustedPaperWidth;
double mAdjustedPaperHeight;
};

NS_DEFINE_STATIC_IID_ACCESSOR(nsPrintSettingsX, NS_PRINTSETTINGSX_IID)
Expand Down
45 changes: 2 additions & 43 deletions widget/cocoa/nsPrintSettingsX.mm
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;

InitUnwriteableMargin();
InitAdjustedPaperSize();

return NS_OK;

Expand All @@ -95,23 +94,6 @@
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)
{
Expand Down Expand Up @@ -224,10 +206,8 @@
void
nsPrintSettingsX::SetInchesScale(float aWidthScale, float aHeightScale)
{
if (aWidthScale > 0 && aHeightScale > 0) {
mWidthScale = aWidthScale;
mHeightScale = aHeightScale;
}
mWidthScale = aWidthScale;
mHeightScale = aHeightScale;
}

void
Expand All @@ -236,24 +216,3 @@
*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;
}

0 comments on commit a41abfb

Please sign in to comment.