Backed out changeset f42cde0309b3 (bug 1805477) for causing build bustages at nsPrintDialogX. CLOSED TREE

This commit is contained in:
Butkovits Atila 2022-12-14 01:18:58 +02:00
parent ec475d5196
commit 314ba119e0

View File

@ -25,46 +25,6 @@ using mozilla::gfx::PrintTarget;
NS_IMPL_ISUPPORTS(nsPrintDialogServiceX, nsIPrintDialogService)
// Splits our single pages-per-sheet count for native NSPrintInfo:
static void setPagesPerSheet(NSPrintInfo* aPrintInfo, int32_t aPPS) {
int32_t across, down;
// Assumes portrait - we'll swap if landscape.
switch (aPPS) {
case 2:
across = 1;
down = 2;
break;
case 4:
across = 2;
down = 2;
break;
case 6:
across = 2;
down = 3;
break;
case 9:
across = 3;
down = 3;
break;
case 16:
across = 4;
down = 4;
break;
default:
across = 1;
down = 1;
break;
}
if ([aPrintInfo orientation] == NSPaperOrientationLandscape) {
std::swap(across, down);
}
NSDictionary* dict = [aPrintInfo dictionary];
[dict setObject:[NSNumber numberWithInt:across] forKey:@"NSPagesAcross"];
[dict setObject:[NSNumber numberWithInt:down] forKey:@"NSPagesDown"];
}
nsPrintDialogServiceX::nsPrintDialogServiceX() {}
nsPrintDialogServiceX::~nsPrintDialogServiceX() {}
@ -114,12 +74,6 @@ nsPrintDialogServiceX::ShowPrintDialog(mozIDOMWindowProxy* aParent, bool aHaveSe
}
}
// Temporarily set the pages-per-sheet count set in our print preview to
// pre-populate the system dialog with the same value:
int32_t pagesPerSheet;
aSettings->GetNumPagesPerSheet(&pagesPerSheet);
setPagesPerSheet(printInfo, pagesPerSheet);
// Put the print info into the current print operation, since that's where
// [panel runModal] will look for it. We create the view because otherwise
// we'll get unrelated warnings printed to the console.
@ -157,16 +111,6 @@ nsPrintDialogServiceX::ShowPrintDialog(mozIDOMWindowProxy* aParent, bool aHaveSe
return NS_ERROR_ABORT;
}
// We handle pages-per-sheet internally and we want to prevent the macOS
// printing code from also applying the pages-per-sheet count. So we need
// to move the count off the NSPrintInfo and over to the nsIPrintSettings.
NSDictionary* dict = [result dictionary];
auto pagesAcross = [[dict objectForKey:@"NSPagesAcross"] intValue];
auto pagesDown = [[dict objectForKey:@"NSPagesDown"] intValue];
[dict setObject:[NSNumber numberWithUnsignedInt:1] forKey:@"NSPagesAcross"];
[dict setObject:[NSNumber numberWithUnsignedInt:1] forKey:@"NSPagesDown"];
aSettings->SetNumPagesPerSheet(pagesAcross * pagesDown);
// Export settings.
[viewController exportSettings];