Commit 224cfeb1 authored by Jonathan Watt's avatar Jonathan Watt
Browse files

Bug 1770539 p5 - Move nsPrintData::mPreparingForPrint to nsPrintJob. r=emilio

parent 47516e9e
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -24,11 +24,7 @@ extern mozilla::LazyLogModule gPrintingLog;
//-- nsPrintData Class Impl
//---------------------------------------------------
nsPrintData::nsPrintData(ePrintDataType aType)
    : mType(aType),
      mPrintDocList(0),
      mOnStartSent(false),
      mIsAborted(false),
      mPreparingForPrint(false) {}
    : mType(aType), mPrintDocList(0), mOnStartSent(false), mIsAborted(false) {}

nsPrintData::~nsPrintData() {
  // Only Send an OnEndPrinting if we have started printing
+1 −9
Original line number Diff line number Diff line
@@ -20,13 +20,6 @@
class nsPrintObject;
class nsIWebProgressListener;

//------------------------------------------------------------------------
// nsPrintData Class
//
// mPreparingForPrint - indicates that we have started Printing but
//   have not gone to the timer to start printing the pages. It gets turned
//   off right before we go to the timer.
//------------------------------------------------------------------------
class nsPrintData {
 public:
  typedef enum { eIsPrinting, eIsPrintPreview } ePrintDataType;
@@ -62,7 +55,6 @@ class nsPrintData {

  bool mOnStartSent;
  bool mIsAborted;  // tells us the document is being aborted
  bool mPreparingForPrint;  // see comments above

 private:
  nsPrintData() = delete;
+4 −6
Original line number Diff line number Diff line
@@ -230,9 +230,7 @@ nsPrintJob::~nsPrintJob() {
  DisconnectPagePrintTimer();
}

bool nsPrintJob::CheckBeforeDestroy() const {
  return mPrt && mPrt->mPreparingForPrint;
}
bool nsPrintJob::CheckBeforeDestroy() const { return mPreparingForPrint; }

//-------------------------------------------------------
void nsPrintJob::Destroy() {
@@ -1667,7 +1665,7 @@ nsresult nsPrintJob::DoPrint(const UniquePtr<nsPrintObject>& aPO) {
    MOZ_ASSERT(seqFrame, "no page sequence frame");

    // We are done preparing for printing, so we can turn this off
    printData->mPreparingForPrint = false;
    mPreparingForPrint = false;

#ifdef EXTENDED_DEBUG_PRINTING
    nsIFrame* rootFrame = poPresShell->GetRootFrame();
@@ -1865,8 +1863,8 @@ void nsPrintJob::PageDone(nsresult aResult) {
//---------------------------------------------------------------------
void nsPrintJob::SetIsPrinting(bool aIsPrinting) {
  mIsDoingPrinting = aIsPrinting;
  if (mPrt && aIsPrinting) {
    mPrt->mPreparingForPrint = true;
  if (aIsPrinting) {
    mPreparingForPrint = true;
  }
}

+5 −0
Original line number Diff line number Diff line
@@ -268,6 +268,11 @@ class nsPrintJob final : public nsIWebProgressListener,

  int32_t mNumPrintablePages = 0;

  // If true, indicates that we have started Printing but have not gone to the
  // timer to start printing the pages. It gets turned off right before we go
  // to the timer.
  bool mPreparingForPrint = false;

  bool mCreatedForPrintPreview = false;
  bool mIsCreatingPrintPreview = false;
  bool mIsDoingPrinting = false;