Commit 981db60f authored by Jonathan Watt's avatar Jonathan Watt
Browse files

Bug 1769999 - Remove the last of the nsPrintJob::mPrtPreview code. r=emilio

Since bug 1659432 landed, we no longer keep the nsPrintJob around across print
settings changes, only replacing the nsPrintData. Now that we throw away
everything on a settings change it doesn't make sense to have code that was
written for juggling nsPrintData objects. That code was just making things
difficult to understand.

Differential Revision: https://phabricator.services.mozilla.com/D146718
parent 0103525a
Loading
Loading
Loading
Loading
+3 −15
Original line number Diff line number Diff line
@@ -285,9 +285,6 @@ void nsPrintJob::Destroy() {

  mPrt = nullptr;

#ifdef NS_PRINT_PREVIEW
  mPrtPreview = nullptr;
#endif
  mDocViewerPrint = nullptr;
}

@@ -334,12 +331,11 @@ nsresult nsPrintJob::Initialize(nsIDocumentViewerPrint* aDocViewerPrint,
//-----------------------------------------------------------------
std::tuple<nsPageSequenceFrame*, int32_t>
nsPrintJob::GetSeqFrameAndCountSheets() const {
  nsPrintData* printData = mPrtPreview ? mPrtPreview : mPrt;
  if (NS_WARN_IF(!printData)) {
  if (NS_WARN_IF(!mPrt)) {
    return {nullptr, 0};
  }

  const nsPrintObject* po = printData->mPrintObject.get();
  const nsPrintObject* po = mPrt->mPrintObject.get();
  if (NS_WARN_IF(!po)) {
    return {nullptr, 0};
  }
@@ -880,9 +876,7 @@ nsresult nsPrintJob::SetupToPrintContent() {

  // Here is where we figure out if extra reflow for shrinking the content
  // is required.
  // But skip this step if we are in PrintPreview
  bool ppIsShrinkToFit = mPrtPreview && mPrtPreview->mShrinkToFit;
  if (printData->mShrinkToFit && !ppIsShrinkToFit) {
  if (printData->mShrinkToFit) {
    printData->mShrinkRatio = printData->mPrintObject->mShrinkRatio;

    if (printData->mShrinkRatio < 0.998f) {
@@ -2081,12 +2075,6 @@ nsresult nsPrintJob::FinishPrintPreview() {
  // before it is to be created

  printData->OnEndPrinting();
  // XXX If mPrt becomes nullptr or different instance here, what should we
  //     do?

  // PrintPreview was built using the mPrt (code reuse)
  // then we assign it over
  mPrtPreview = std::move(mPrt);

#endif  // NS_PRINT_PREVIEW

+0 −6
Original line number Diff line number Diff line
@@ -244,12 +244,6 @@ class nsPrintJob final : public nsIWebProgressListener,
  // member-data.
  RefPtr<nsPrintData> mPrt;

  // The nsPrintData for our last print preview (replaced every time the
  // user changes settings in the print preview window).
  // Note: Our new print preview nsPrintData is stored in mPtr until we move it
  // to mPrtPreview once we've finish creating the print preview.
  RefPtr<nsPrintData> mPrtPreview;

  RefPtr<nsPagePrintTimer> mPagePrintTimer;

  // Only set if this nsPrintJob was created for a real print.