forked from mirrors/gecko-dev
Bug 1865485. Rename nsIPrintSettings::HasOrthogonalSheetsAndPages to HasOrthogonalPagesPerSheet. r=dholbert
The old name is potentially misleading now that we implement 'page-orientation' since that provides a new mechanism by which pages could end up orthoganal to the sheet, but this method is very specifically about pages-per-sheet induced rotation. Differential Revision: https://phabricator.services.mozilla.com/D193989
This commit is contained in:
parent
387f4997eb
commit
50f811aef5
6 changed files with 15 additions and 14 deletions
|
|
@ -268,7 +268,7 @@ nsSize PrintedSheetFrame::ComputeSheetSize(const nsPresContext* aPresContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!StaticPrefs::layout_css_page_orientation_enabled()) {
|
if (!StaticPrefs::layout_css_page_orientation_enabled()) {
|
||||||
if (mPD->mPrintSettings->HasOrthogonalSheetsAndPages()) {
|
if (mPD->mPrintSettings->HasOrthogonalPagesPerSheet()) {
|
||||||
std::swap(sheetSize.width, sheetSize.height);
|
std::swap(sheetSize.width, sheetSize.height);
|
||||||
}
|
}
|
||||||
return sheetSize;
|
return sheetSize;
|
||||||
|
|
@ -314,7 +314,7 @@ nsSize PrintedSheetFrame::ComputeSheetSize(const nsPresContext* aPresContext) {
|
||||||
// orthogonal sheet layout, but not if both are true since then we'd
|
// orthogonal sheet layout, but not if both are true since then we'd
|
||||||
// actually need to double switch.
|
// actually need to double switch.
|
||||||
if ((sheetIsPortrait != pageIsPortrait) !=
|
if ((sheetIsPortrait != pageIsPortrait) !=
|
||||||
mPD->mPrintSettings->HasOrthogonalSheetsAndPages()) {
|
mPD->mPrintSettings->HasOrthogonalPagesPerSheet()) {
|
||||||
std::swap(sheetSize.width, sheetSize.height);
|
std::swap(sheetSize.width, sheetSize.height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -337,7 +337,7 @@ void PrintedSheetFrame::ComputePagesPerSheetGridMetrics(
|
||||||
|
|
||||||
// XXXjwatt Once we support heterogeneous sheet orientations, we'll also need
|
// XXXjwatt Once we support heterogeneous sheet orientations, we'll also need
|
||||||
// to rotate uwm if this sheet is not the primary orientation.
|
// to rotate uwm if this sheet is not the primary orientation.
|
||||||
if (mPD->mPrintSettings->HasOrthogonalSheetsAndPages()) {
|
if (mPD->mPrintSettings->HasOrthogonalPagesPerSheet()) {
|
||||||
// aSheetSize already takes account of the switch of *sheet* orientation
|
// aSheetSize already takes account of the switch of *sheet* orientation
|
||||||
// that we do in this case (the orientation implied by the page size
|
// that we do in this case (the orientation implied by the page size
|
||||||
// dimensions in the nsIPrintSettings applies to *pages*). That is not the
|
// dimensions in the nsIPrintSettings applies to *pages*). That is not the
|
||||||
|
|
|
||||||
|
|
@ -1307,7 +1307,7 @@ nsresult nsPrintJob::ReflowPrintObject(const UniquePtr<nsPrintObject>& aPO) {
|
||||||
// scenario). For some pages-per-sheet values, the pages are orthogonal to
|
// scenario). For some pages-per-sheet values, the pages are orthogonal to
|
||||||
// the sheet; we adjust for that here by swapping the width with the height.
|
// the sheet; we adjust for that here by swapping the width with the height.
|
||||||
nsSize pageSize = adjSize;
|
nsSize pageSize = adjSize;
|
||||||
if (mPrintSettings->HasOrthogonalSheetsAndPages()) {
|
if (mPrintSettings->HasOrthogonalPagesPerSheet()) {
|
||||||
std::swap(pageSize.width, pageSize.height);
|
std::swap(pageSize.width, pageSize.height);
|
||||||
}
|
}
|
||||||
// XXXalaskanemily: Is this actually necessary? We set it again before the
|
// XXXalaskanemily: Is this actually necessary? We set it again before the
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,7 @@ void nsPrintSettingsX::SetFromPrintInfo(NSPrintInfo* aPrintInfo,
|
||||||
// got a pages-per-sheet value with orthogonal pages/sheets, in which case
|
// got a pages-per-sheet value with orthogonal pages/sheets, in which case
|
||||||
// it's reversed.
|
// it's reversed.
|
||||||
const bool arePagesPortraitMode =
|
const bool arePagesPortraitMode =
|
||||||
(areSheetsOfPaperPortraitMode != HasOrthogonalSheetsAndPages());
|
(areSheetsOfPaperPortraitMode != HasOrthogonalPagesPerSheet());
|
||||||
|
|
||||||
if (arePagesPortraitMode) {
|
if (arePagesPortraitMode) {
|
||||||
mOrientation = nsIPrintSettings::kPortraitOrientation;
|
mOrientation = nsIPrintSettings::kPortraitOrientation;
|
||||||
|
|
|
||||||
|
|
@ -198,11 +198,12 @@ interface nsIPrintSettings : nsISupports
|
||||||
[noscript, notxpcom, nostdcall] long GetSheetOrientation();
|
[noscript, notxpcom, nostdcall] long GetSheetOrientation();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convenience getter, which returns true IFF the sheet orientation and the
|
* Convenience getter, which returns true IFF the value of `numPagesPerSheet`
|
||||||
* page orientation are orthogonal. (In other words, returns true IFF we
|
* would require us to orient the pages orthogonally to the sheet in order
|
||||||
* are printing with 2 or 6 pages-per-sheet.)
|
* to make best use of the space on the sheet. Specifically, this returns
|
||||||
|
* true IFF `numPagesPerSheet` is set to 2 or 6 pages-per-sheet.
|
||||||
*/
|
*/
|
||||||
[noscript, notxpcom, nostdcall] bool HasOrthogonalSheetsAndPages();
|
[noscript, notxpcom, nostdcall] bool HasOrthogonalPagesPerSheet();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes a new copy
|
* Makes a new copy
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ void nsPrintSettings::InitWithInitializer(
|
||||||
const bool areSheetsOfPaperPortraitMode =
|
const bool areSheetsOfPaperPortraitMode =
|
||||||
(aSettings.mSheetOrientation == kPortraitOrientation);
|
(aSettings.mSheetOrientation == kPortraitOrientation);
|
||||||
const bool arePagesPortraitMode =
|
const bool arePagesPortraitMode =
|
||||||
(areSheetsOfPaperPortraitMode != HasOrthogonalSheetsAndPages());
|
(areSheetsOfPaperPortraitMode != HasOrthogonalPagesPerSheet());
|
||||||
SetOrientation(arePagesPortraitMode ? kPortraitOrientation
|
SetOrientation(arePagesPortraitMode ? kPortraitOrientation
|
||||||
: kLandscapeOrientation);
|
: kLandscapeOrientation);
|
||||||
|
|
||||||
|
|
@ -654,7 +654,7 @@ nsPrintSettings::GetEffectivePageSize(double* aWidth, double* aHeight) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nsPrintSettings::HasOrthogonalSheetsAndPages() {
|
bool nsPrintSettings::HasOrthogonalPagesPerSheet() {
|
||||||
return mNumPagesPerSheet == 2 || mNumPagesPerSheet == 6;
|
return mNumPagesPerSheet == 2 || mNumPagesPerSheet == 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -664,13 +664,13 @@ void nsPrintSettings::GetEffectiveSheetSize(double* aWidth, double* aHeight) {
|
||||||
// Our GetEffectivePageSize impls only return NS_OK, so this should hold:
|
// Our GetEffectivePageSize impls only return NS_OK, so this should hold:
|
||||||
MOZ_ASSERT(NS_SUCCEEDED(rv), "Uh oh, GetEffectivePageSize failed");
|
MOZ_ASSERT(NS_SUCCEEDED(rv), "Uh oh, GetEffectivePageSize failed");
|
||||||
|
|
||||||
if (HasOrthogonalSheetsAndPages()) {
|
if (HasOrthogonalPagesPerSheet()) {
|
||||||
std::swap(*aWidth, *aHeight);
|
std::swap(*aWidth, *aHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t nsPrintSettings::GetSheetOrientation() {
|
int32_t nsPrintSettings::GetSheetOrientation() {
|
||||||
if (HasOrthogonalSheetsAndPages()) {
|
if (HasOrthogonalPagesPerSheet()) {
|
||||||
// Sheet orientation is rotated with respect to the page orientation.
|
// Sheet orientation is rotated with respect to the page orientation.
|
||||||
return kLandscapeOrientation == mOrientation ? kPortraitOrientation
|
return kLandscapeOrientation == mOrientation ? kPortraitOrientation
|
||||||
: kLandscapeOrientation;
|
: kLandscapeOrientation;
|
||||||
|
|
|
||||||
|
|
@ -294,7 +294,7 @@ void nsPrintSettingsWin::CopyFromNative(HDC aHdc, DEVMODEW* aDevMode) {
|
||||||
// we've got a pages-per-sheet value with orthogonal pages/sheets, in which
|
// we've got a pages-per-sheet value with orthogonal pages/sheets, in which
|
||||||
// case it's reversed.
|
// case it's reversed.
|
||||||
const bool arePagesPortraitMode =
|
const bool arePagesPortraitMode =
|
||||||
(areSheetsOfPaperPortraitMode != HasOrthogonalSheetsAndPages());
|
(areSheetsOfPaperPortraitMode != HasOrthogonalPagesPerSheet());
|
||||||
|
|
||||||
// Record the orientation of the pages (determined above) in mOrientation:
|
// Record the orientation of the pages (determined above) in mOrientation:
|
||||||
mOrientation = int32_t(arePagesPortraitMode ? kPortraitOrientation
|
mOrientation = int32_t(arePagesPortraitMode ? kPortraitOrientation
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue