Bug 1769717 - Remove nsPrintJob::GetPrintPreviewPresShell(). r=emilio

Long ago we used to play switcheroo with PresShells in order to print a
document, but for over a decade we've been cloning the document that is
to be printed (bug 487667). Since then we've had no need for this method.

Differential Revision: https://phabricator.services.mozilla.com/D146545
This commit is contained in:
Jonathan Watt
2022-05-17 11:36:20 +00:00
parent ceffb867aa
commit 1f5693261e
3 changed files with 2 additions and 9 deletions

View File

@@ -3019,8 +3019,7 @@ nsDocumentViewer::PrintPreviewScrollToPage(int16_t aType, int32_t aPageNum) {
if (!GetIsPrintPreview() || mPrintJob->GetIsCreatingPrintPreview())
return NS_ERROR_FAILURE;
nsIScrollableFrame* sf =
mPrintJob->GetPrintPreviewPresShell()->GetRootScrollFrameAsScrollable();
nsIScrollableFrame* sf = mPresShell->GetRootScrollFrameAsScrollable();
if (!sf) return NS_OK;
auto [seqFrame, sheetCount] = mPrintJob->GetSeqFrameAndCountSheets();
@@ -3094,8 +3093,7 @@ nsDocumentViewer::GetCurrentSheetFrameAndNumber() const {
return {nullptr, 0};
}
nsIScrollableFrame* sf =
mPrintJob->GetPrintPreviewPresShell()->GetRootScrollFrameAsScrollable();
nsIScrollableFrame* sf = mPresShell->GetRootScrollFrameAsScrollable();
if (!sf) {
// No scrollable contents, returns 1 even if there are multiple sheets.
return {seqFrame->PrincipalChildList().FirstChild(), 1};

View File

@@ -276,10 +276,6 @@ bool nsPrintJob::CheckBeforeDestroy() const {
return mPrt && mPrt->mPreparingForPrint;
}
PresShell* nsPrintJob::GetPrintPreviewPresShell() {
return mPrtPreview->mPrintObject->mPresShell;
}
//-------------------------------------------------------
void nsPrintJob::Destroy() {
if (mIsDestroying) {

View File

@@ -150,7 +150,6 @@ class nsPrintJob final : public nsIWebProgressListener,
void FirePrintingErrorEvent(nsresult aPrintError);
bool CheckBeforeDestroy() const;
mozilla::PresShell* GetPrintPreviewPresShell();
nsresult Cancel();
void Destroy();
void DestroyPrintingData();