Commit c0b9f77a authored by Jonathan Watt's avatar Jonathan Watt
Browse files

Bug 1770539 p2 - Move nsPrintData::mShrinkToFit to nsPrintJob. r=emilio

Depends on D146973

Differential Revision: https://phabricator.services.mozilla.com/D146974
parent 90a01d79
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ nsPrintData::nsPrintData(ePrintDataType aType)
      mOnStartSent(false),
      mIsAborted(false),
      mPreparingForPrint(false),
      mShrinkToFit(false),
      mNumPrintablePages(0),
      mShrinkRatio(1.0) {}

+0 −1
Original line number Diff line number Diff line
@@ -63,7 +63,6 @@ class nsPrintData {
  bool mOnStartSent;
  bool mIsAborted;          // tells us the document is being aborted
  bool mPreparingForPrint;  // see comments above
  bool mShrinkToFit;
  int32_t mNumPrintablePages;
  float mShrinkRatio;

+4 −4
Original line number Diff line number Diff line
@@ -434,7 +434,7 @@ nsresult nsPrintJob::DoCommonPrint(bool aIsPrintPreview,
      !printData->mPrintObject->mDocument->GetRootElement())
    return NS_ERROR_GFX_PRINTER_STARTDOC;

  mPrintSettings->GetShrinkToFit(&printData->mShrinkToFit);
  mPrintSettings->GetShrinkToFit(&mShrinkToFit);

  bool printingViaParent =
      XRE_IsContentProcess() && StaticPrefs::print_print_via_parent();
@@ -831,7 +831,7 @@ nsresult nsPrintJob::SetupToPrintContent() {

  // Here is where we figure out if extra reflow for shrinking the content
  // is required.
  if (printData->mShrinkToFit) {
  if (mShrinkToFit) {
    printData->mShrinkRatio = printData->mPrintObject->mShrinkRatio;

    if (printData->mShrinkRatio < 0.998f) {
@@ -1136,7 +1136,7 @@ nsPrintJob::OnContentBlockingEvent(nsIWebProgress* aWebProgress,

void nsPrintJob::UpdateZoomRatio(nsPrintObject* aPO) {
  if (!aPO->mParent) {
    if (mPrt->mShrinkToFit) {
    if (mShrinkToFit) {
      aPO->mZoomRatio = mPrt->mShrinkRatio;
      // If we're actually going to scale (the factor is less than 1), we
      // reduce the scale factor slightly to avoid the possibility of floating
@@ -1183,7 +1183,7 @@ nsresult nsPrintJob::UpdateSelectionAndShrinkPrintObject(
  // Then we walk the frame tree and look for the "xmost" frame
  // this is the frame where the right-hand side of the frame extends
  // the furthest
  if (mPrt->mShrinkToFit && aDocumentIsTopLevel) {
  if (mShrinkToFit && aDocumentIsTopLevel) {
    nsPageSequenceFrame* pageSeqFrame = aPO->mPresShell->GetPageSequenceFrame();
    NS_ENSURE_STATE(pageSeqFrame);
    aPO->mShrinkRatio = pageSeqFrame->GetSTFPercent();
+1 −0
Original line number Diff line number Diff line
@@ -266,6 +266,7 @@ class nsPrintJob final : public nsIWebProgressListener,
  bool mIsCreatingPrintPreview = false;
  bool mIsDoingPrinting = false;
  bool mDidLoadDataForPrinting = false;
  bool mShrinkToFit = false;
  bool mDoingInitialReflow = false;
  bool mIsDestroying = false;
  bool mDisallowSelectionPrint = false;