From 48364b8cbb9f15083e8b30cb2366bc5cd65569ed Mon Sep 17 00:00:00 2001 From: Jonathan Watt Date: Tue, 4 Jun 2019 17:03:35 +0100 Subject: [PATCH] Bug 1558210. Make various nsPrintJob methods private. r=bobowen Also removes two unused (not even defined) method declarations. Differential Revision: https://phabricator.services.mozilla.com/D34357 --HG-- extra : rebase_source : bd03bbe8f6a532aa38f9ae871e0b60ca9fa088a7 extra : amend_source : 758bb89dbe6413116647f78ced8afa41b9ce422e --- layout/printing/nsPrintJob.h | 112 +++++++++++++++-------------------- 1 file changed, 49 insertions(+), 63 deletions(-) diff --git a/layout/printing/nsPrintJob.h b/layout/printing/nsPrintJob.h index 004c793bcb43..8150e09d0b69 100644 --- a/layout/printing/nsPrintJob.h +++ b/layout/printing/nsPrintJob.h @@ -120,43 +120,20 @@ class nsPrintJob final : public nsIObserver, nsresult GetDocumentName(nsAString& aDocName); already_AddRefed GetCurrentPrintSettings(); + // The setters here also update the DocViewer + void SetIsPrinting(bool aIsPrinting); + bool GetIsPrinting() { return mIsDoingPrinting; } + void SetIsPrintPreview(bool aIsPrintPreview); + bool GetIsPrintPreview() { return mIsDoingPrintPreview; } + bool GetIsCreatingPrintPreview() { return mIsCreatingPrintPreview; } + // This enum tells indicates what the default should be for the title // if the title from the document is null enum eDocTitleDefault { eDocTitleDefBlank, eDocTitleDefURLDoc }; - void Destroy(); - void DestroyPrintingData(); - nsresult GetSeqFrameAndCountPages(nsIFrame*& aSeqFrame, int32_t& aCount); - // - // The following three methods are used for printing... - // - nsresult DocumentReadyForPrinting(); - nsresult GetSelectionDocument(nsIDeviceContextSpec* aDevSpec, - mozilla::dom::Document** aNewDoc); - - nsresult SetupToPrintContent(); - nsresult EnablePOsForPrinting(); - nsPrintObject* FindSmallestSTF(); - - bool PrintDocContent(const mozilla::UniquePtr& aPO, - nsresult& aStatus); - nsresult DoPrint(const mozilla::UniquePtr& aPO); - - void SetPrintPO(nsPrintObject* aPO, bool aPrint); - void TurnScriptingOn(bool aDoTurnOn); - bool CheckDocumentForPPCaching(); - - /** - * Filters out certain user events while Print Preview is open to prevent - * the user from interacting with the Print Preview document and breaking - * printing invariants. - */ - void SuppressPrintPreviewUserEvents(); - - // nsIDocumentViewerPrint Printing Methods: /** * Checks to see if the document this print engine is associated with has any @@ -168,7 +145,48 @@ class nsPrintJob final : public nsIObserver, bool PrintPage(nsPrintObject* aPOect, bool& aInRange); bool DonePrintingPages(nsPrintObject* aPO, nsresult aResult); - //--------------------------------------------------------------------- + nsresult CleanupOnFailure(nsresult aResult, bool aIsPrinting); + // If FinishPrintPreview() fails, caller may need to reset the state of the + // object, for example by calling CleanupOnFailure(). + nsresult FinishPrintPreview(); + void FirePrintingErrorEvent(nsresult aPrintError); + bool CheckBeforeDestroy() const { return mPrt && mPrt->mPreparingForPrint; } + + mozilla::PresShell* GetPrintPreviewPresShell() { + return mPrtPreview->mPrintObject->mPresShell; + } + + float GetPrintPreviewScale() { + return mPrtPreview->mPrintObject->mPresContext->GetPrintPreviewScale(); + } + + nsresult Cancel(); + void Destroy(); + void DestroyPrintingData(); + + private: + nsPrintJob& operator=(const nsPrintJob& aOther) = delete; + + ~nsPrintJob(); + + nsresult DocumentReadyForPrinting(); + nsresult SetupToPrintContent(); + nsresult EnablePOsForPrinting(); + nsPrintObject* FindSmallestSTF(); + + bool PrintDocContent(const mozilla::UniquePtr& aPO, + nsresult& aStatus); + nsresult DoPrint(const mozilla::UniquePtr& aPO); + + void SetPrintPO(nsPrintObject* aPO, bool aPrint); + + /** + * Filters out certain user events while Print Preview is open to prevent + * the user from interacting with the Print Preview document and breaking + * printing invariants. + */ + void SuppressPrintPreviewUserEvents(); + nsresult ReflowDocList(const mozilla::UniquePtr& aPO, bool aSetPixelScale); @@ -177,10 +195,6 @@ class nsPrintJob final : public nsIObserver, void CalcNumPrintablePages(int32_t& aNumPages); void ShowPrintProgress(bool aIsForPrinting, bool& aDoNotify); - nsresult CleanupOnFailure(nsresult aResult, bool aIsPrinting); - // If FinishPrintPreview() fails, caller may need to reset the state of the - // object, for example by calling CleanupOnFailure(). - nsresult FinishPrintPreview(); void SetURLAndTitleOnProgressParams( const mozilla::UniquePtr& aPO, nsIPrintProgressParams* aParams); @@ -188,10 +202,6 @@ class nsPrintJob final : public nsIObserver, bool IsThereARangeSelection(nsPIDOMWindowOuter* aDOMWin); - void FirePrintingErrorEvent(nsresult aPrintError); - //--------------------------------------------------------------------- - - // Timer Methods nsresult StartPagePrintTimer(const mozilla::UniquePtr& aPO); bool IsWindowsInOurSubTree(nsPIDOMWindowOuter* aDOMWindow) const; @@ -206,30 +216,6 @@ class nsPrintJob final : public nsIObserver, nsAString& aTitle, nsAString& aURLStr, eDocTitleDefault aDefType); - bool CheckBeforeDestroy() const { return mPrt && mPrt->mPreparingForPrint; } - - nsresult Cancel(); - - mozilla::PresShell* GetPrintPreviewPresShell() { - return mPrtPreview->mPrintObject->mPresShell; - } - - float GetPrintPreviewScale() { - return mPrtPreview->mPrintObject->mPresContext->GetPrintPreviewScale(); - } - - // These calls also update the DocViewer - void SetIsPrinting(bool aIsPrinting); - bool GetIsPrinting() { return mIsDoingPrinting; } - void SetIsPrintPreview(bool aIsPrintPreview); - bool GetIsPrintPreview() { return mIsDoingPrintPreview; } - bool GetIsCreatingPrintPreview() { return mIsCreatingPrintPreview; } - - private: - nsPrintJob& operator=(const nsPrintJob& aOther) = delete; - - ~nsPrintJob(); - nsresult CommonPrint(bool aIsPrintPreview, nsIPrintSettings* aPrintSettings, nsIWebProgressListener* aWebProgressListener, mozilla::dom::Document* aSourceDoc);