Skip to content

Commit

Permalink
Bug 1821331 - For macOS printing, ensure paper orientation matches th…
Browse files Browse the repository at this point in the history
…e dimensions being set. r=emilio

Depends on D174243

Differential Revision: https://phabricator.services.mozilla.com/D174244
  • Loading branch information
jfkthame committed Apr 14, 2023
1 parent 39434af commit 223d5f1
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions widget/cocoa/nsPrintSettingsX.mm
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,18 @@

NSSize paperSize;
if (GetSheetOrientation() == kPortraitOrientation) {
[printInfo setOrientation:NSPaperOrientationPortrait];
paperSize.width = CocoaPointsFromPaperSize(mPaperWidth);
paperSize.height = CocoaPointsFromPaperSize(mPaperHeight);
[printInfo setPaperSize:paperSize];
} else {
[printInfo setOrientation:NSPaperOrientationLandscape];
paperSize.width = CocoaPointsFromPaperSize(mPaperHeight);
paperSize.height = CocoaPointsFromPaperSize(mPaperWidth);
[printInfo setPaperSize:paperSize];
}
[printInfo setPaperSize:paperSize];

if (paperSize.width > paperSize.height) {
[printInfo setOrientation:NSPaperOrientationLandscape];
} else {
[printInfo setOrientation:NSPaperOrientationPortrait];
}

[printInfo setTopMargin:mUnwriteableMargin.top];
Expand Down

0 comments on commit 223d5f1

Please sign in to comment.