author | Jonathan Watt <jwatt@jwatt.org> |
Sun, 22 May 2022 09:37:56 +0000 | |
changeset 618494 | 5cd20e839a7322ad075dcc6d88585a28d36db87d |
parent 618493 | f6e9ace877bde122f61baa5d298aea48ad26f8b6 |
child 618495 | f946921b9173529d6ceec8200469747446c98a6a |
push id | 163296 |
push user | jwatt@jwatt.org |
push date | Sun, 22 May 2022 09:41:02 +0000 |
treeherder | autoland@d0bb4f6201a0 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | emilio |
bugs | 1770539 |
milestone | 102.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/layout/printing/nsPrintData.cpp +++ b/layout/printing/nsPrintData.cpp @@ -24,17 +24,16 @@ extern mozilla::LazyLogModule gPrintingL //-- nsPrintData Class Impl //--------------------------------------------------- nsPrintData::nsPrintData(ePrintDataType aType) : mType(aType), mPrintDocList(0), mOnStartSent(false), mIsAborted(false), mPreparingForPrint(false), - mShrinkToFit(false), mNumPrintablePages(0), mShrinkRatio(1.0) {} nsPrintData::~nsPrintData() { // Only Send an OnEndPrinting if we have started printing if (mOnStartSent && mType != eIsPrintPreview) { OnEndPrinting(); }
--- a/layout/printing/nsPrintData.h +++ b/layout/printing/nsPrintData.h @@ -58,17 +58,16 @@ class nsPrintData { // Array of non-owning pointers to all the nsPrintObjects owned by this // nsPrintData. This includes this->mPrintObject, as well as all of its // mKids (and their mKids, etc.) nsTArray<nsPrintObject*> mPrintDocList; bool mOnStartSent; bool mIsAborted; // tells us the document is being aborted bool mPreparingForPrint; // see comments above - bool mShrinkToFit; int32_t mNumPrintablePages; float mShrinkRatio; private: nsPrintData() = delete; nsPrintData& operator=(const nsPrintData& aOther) = delete; ~nsPrintData(); // non-virtual
--- a/layout/printing/nsPrintJob.cpp +++ b/layout/printing/nsPrintJob.cpp @@ -429,17 +429,17 @@ nsresult nsPrintJob::DoCommonPrint(bool return NS_ERROR_FAILURE; } // XXX This isn't really correct... if (!printData->mPrintObject->mDocument || !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(); nsCOMPtr<nsIDeviceContextSpec> devspec; if (printingViaParent) { devspec = new nsDeviceContextSpecProxy(mRemotePrintJob); } else { devspec = do_CreateInstance("@mozilla.org/gfx/devicecontextspec;1", &rv); @@ -826,17 +826,17 @@ nsresult nsPrintJob::SetupToPrintContent if (NS_WARN_IF(mPrt != printData)) { return NS_ERROR_FAILURE; } didReconstruction = true; } // 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) { nsresult rv = ReconstructAndReflow(); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } // If the printing was canceled or restarted with different data, @@ -1131,17 +1131,17 @@ nsPrintJob::OnContentBlockingEvent(nsIWe MOZ_ASSERT_UNREACHABLE("notification excluded in AddProgressListener(...)"); return NS_OK; } //------------------------------------------------------- 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 // point rounding error causing slight clipping of the longest lines. if (aPO->mZoomRatio != 1.0f) { aPO->mZoomRatio -= 0.005f; } } else { @@ -1178,17 +1178,17 @@ nsresult nsPrintJob::UpdateSelectionAndS } } // If we are trying to shrink the contents to fit on the page // we must first locate the "pageContent" frame // 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(); // Limit the shrink-to-fit scaling for some text-ish type of documents. nsAutoString contentType; aPO->mPresShell->GetDocument()->GetContentType(contentType); if (contentType.EqualsLiteral("application/xhtml+xml") || StringBeginsWith(contentType, u"text/"_ns)) {
--- a/layout/printing/nsPrintJob.h +++ b/layout/printing/nsPrintJob.h @@ -261,15 +261,16 @@ class nsPrintJob final : public nsIWebPr PrintPreviewResolver mPrintPreviewCallback; float mScreenDPI = 115.0f; bool mCreatedForPrintPreview = false; bool mIsCreatingPrintPreview = false; bool mIsDoingPrinting = false; bool mDidLoadDataForPrinting = false; + bool mShrinkToFit = false; bool mDoingInitialReflow = false; bool mIsDestroying = false; bool mDisallowSelectionPrint = false; bool mIsForModalWindow = false; }; #endif // nsPrintJob_h