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:
Jonathan Watt 2023-11-20 09:14:50 +00:00
parent 387f4997eb
commit 50f811aef5
6 changed files with 15 additions and 14 deletions

View file

@ -268,7 +268,7 @@ nsSize PrintedSheetFrame::ComputeSheetSize(const nsPresContext* aPresContext) {
}
if (!StaticPrefs::layout_css_page_orientation_enabled()) {
if (mPD->mPrintSettings->HasOrthogonalSheetsAndPages()) {
if (mPD->mPrintSettings->HasOrthogonalPagesPerSheet()) {
std::swap(sheetSize.width, sheetSize.height);
}
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
// actually need to double switch.
if ((sheetIsPortrait != pageIsPortrait) !=
mPD->mPrintSettings->HasOrthogonalSheetsAndPages()) {
mPD->mPrintSettings->HasOrthogonalPagesPerSheet()) {
std::swap(sheetSize.width, sheetSize.height);
}
@ -337,7 +337,7 @@ void PrintedSheetFrame::ComputePagesPerSheetGridMetrics(
// XXXjwatt Once we support heterogeneous sheet orientations, we'll also need
// 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
// that we do in this case (the orientation implied by the page size
// dimensions in the nsIPrintSettings applies to *pages*). That is not the

View file

@ -1307,7 +1307,7 @@ nsresult nsPrintJob::ReflowPrintObject(const UniquePtr<nsPrintObject>& aPO) {
// 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.
nsSize pageSize = adjSize;
if (mPrintSettings->HasOrthogonalSheetsAndPages()) {
if (mPrintSettings->HasOrthogonalPagesPerSheet()) {
std::swap(pageSize.width, pageSize.height);
}
// XXXalaskanemily: Is this actually necessary? We set it again before the

View file

@ -249,7 +249,7 @@ void nsPrintSettingsX::SetFromPrintInfo(NSPrintInfo* aPrintInfo,
// got a pages-per-sheet value with orthogonal pages/sheets, in which case
// it's reversed.
const bool arePagesPortraitMode =
(areSheetsOfPaperPortraitMode != HasOrthogonalSheetsAndPages());
(areSheetsOfPaperPortraitMode != HasOrthogonalPagesPerSheet());
if (arePagesPortraitMode) {
mOrientation = nsIPrintSettings::kPortraitOrientation;

View file

@ -198,11 +198,12 @@ interface nsIPrintSettings : nsISupports
[noscript, notxpcom, nostdcall] long GetSheetOrientation();
/**
* Convenience getter, which returns true IFF the sheet orientation and the
* page orientation are orthogonal. (In other words, returns true IFF we
* are printing with 2 or 6 pages-per-sheet.)
* Convenience getter, which returns true IFF the value of `numPagesPerSheet`
* would require us to orient the pages orthogonally to the sheet in order
* 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

View file

@ -61,7 +61,7 @@ void nsPrintSettings::InitWithInitializer(
const bool areSheetsOfPaperPortraitMode =
(aSettings.mSheetOrientation == kPortraitOrientation);
const bool arePagesPortraitMode =
(areSheetsOfPaperPortraitMode != HasOrthogonalSheetsAndPages());
(areSheetsOfPaperPortraitMode != HasOrthogonalPagesPerSheet());
SetOrientation(arePagesPortraitMode ? kPortraitOrientation
: kLandscapeOrientation);
@ -654,7 +654,7 @@ nsPrintSettings::GetEffectivePageSize(double* aWidth, double* aHeight) {
return NS_OK;
}
bool nsPrintSettings::HasOrthogonalSheetsAndPages() {
bool nsPrintSettings::HasOrthogonalPagesPerSheet() {
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:
MOZ_ASSERT(NS_SUCCEEDED(rv), "Uh oh, GetEffectivePageSize failed");
if (HasOrthogonalSheetsAndPages()) {
if (HasOrthogonalPagesPerSheet()) {
std::swap(*aWidth, *aHeight);
}
}
int32_t nsPrintSettings::GetSheetOrientation() {
if (HasOrthogonalSheetsAndPages()) {
if (HasOrthogonalPagesPerSheet()) {
// Sheet orientation is rotated with respect to the page orientation.
return kLandscapeOrientation == mOrientation ? kPortraitOrientation
: kLandscapeOrientation;

View file

@ -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
// case it's reversed.
const bool arePagesPortraitMode =
(areSheetsOfPaperPortraitMode != HasOrthogonalSheetsAndPages());
(areSheetsOfPaperPortraitMode != HasOrthogonalPagesPerSheet());
// Record the orientation of the pages (determined above) in mOrientation:
mOrientation = int32_t(arePagesPortraitMode ? kPortraitOrientation