diff --git a/dom/base/nsIDocument.h b/dom/base/nsIDocument.h index 0a5f750862f7..7f418d623f9b 100644 --- a/dom/base/nsIDocument.h +++ b/dom/base/nsIDocument.h @@ -2768,16 +2768,6 @@ public: return mHasScrollLinkedEffect; } - bool MayHavePluginFramesForPrinting() - { - return mMayHavePluginFramesForPrinting; - } - - void SetMayHavePluginFramesForPrinting() - { - mMayHavePluginFramesForPrinting = true; - } - protected: bool GetUseCounter(mozilla::UseCounter aUseCounter) { @@ -3074,10 +3064,6 @@ protected: // True is document has ever been in a foreground window. bool mEverInForeground : 1; - // True if this document is a static clone for printing and may - // have elements referring to plugins in the original document. - bool mMayHavePluginFramesForPrinting : 1; - enum Type { eUnknown, // should never be used eHTML, diff --git a/dom/base/nsObjectLoadingContent.cpp b/dom/base/nsObjectLoadingContent.cpp index 9456f89c3ec1..99ca67e375b1 100644 --- a/dom/base/nsObjectLoadingContent.cpp +++ b/dom/base/nsObjectLoadingContent.cpp @@ -2907,13 +2907,9 @@ nsObjectLoadingContent::CreateStaticClone(nsObjectLoadingContent* aDest) const aDest->mPrintFrame = const_cast(this)->GetExistingFrame(); } - nsCOMPtr content = - do_QueryInterface(static_cast(aDest)); - if (aDest->mPrintFrame) { - content->OwnerDoc()->SetMayHavePluginFramesForPrinting(); - } - if (mFrameLoader) { + nsCOMPtr content = + do_QueryInterface(static_cast(aDest)); nsFrameLoader* fl = nsFrameLoader::Create(content->AsElement(), false); if (fl) { aDest->mFrameLoader = fl; diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 145ebd69b366..e894eda303f2 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -3762,7 +3762,9 @@ nsDocumentViewer::Print(nsIPrintSettings* aPrintSettings, return rv; } } - + if (mPrintEngine->HasPrintCallbackCanvas()) { + mBeforeAndAfterPrint = beforeAndAfterPrint; + } dom::Element* root = mDocument->GetRootElement(); if (root && root->HasAttr(kNameSpaceID_None, nsGkAtoms::mozdisallowselectionprint)) { mPrintEngine->SetDisallowSelectionPrint(true); @@ -3770,18 +3772,7 @@ nsDocumentViewer::Print(nsIPrintSettings* aPrintSettings, rv = mPrintEngine->Print(aPrintSettings, aWebProgressListener); if (NS_FAILED(rv)) { OnDonePrinting(); - } else if (GetIsPrinting()) { - if (mPrintEngine->HasPrintCallbackCanvas() || - mPrintEngine->MayHavePluginFrames()) { - mBeforeAndAfterPrint = beforeAndAfterPrint; - } else { - // Since printing cloned the document and doesn't need plugin or canvas data - // from the original document, we can clear the print flag in the docshell - // tree early, before afterprint is dispatched. - SetIsPrinting(false); - } } - return rv; } @@ -3846,7 +3837,9 @@ nsDocumentViewer::PrintPreview(nsIPrintSettings* aPrintSettings, return rv; } } - + if (mPrintEngine->HasPrintCallbackCanvas()) { + mBeforeAndAfterPrint = beforeAndAfterPrint; + } dom::Element* root = doc->GetRootElement(); if (root && root->HasAttr(kNameSpaceID_None, nsGkAtoms::mozdisallowselectionprint)) { PR_PL(("PrintPreview: found mozdisallowselectionprint")); @@ -3856,16 +3849,7 @@ nsDocumentViewer::PrintPreview(nsIPrintSettings* aPrintSettings, mPrintPreviewZoomed = false; if (NS_FAILED(rv)) { OnDonePrinting(); - } else if (GetIsPrintPreview() && - (mPrintEngine->HasPrintCallbackCanvas() || - mPrintEngine->MayHavePluginFrames())) { - mBeforeAndAfterPrint = beforeAndAfterPrint; } - - // Unlike in printing case we don't explicitly call SetIsPrintPreview(false); - // here, since this ContentViewer is for the cloned document, not for the - // original document. - return rv; #else return NS_ERROR_FAILURE; diff --git a/layout/printing/nsPrintEngine.cpp b/layout/printing/nsPrintEngine.cpp index 739e7d2be32b..61c534ce5931 100644 --- a/layout/printing/nsPrintEngine.cpp +++ b/layout/printing/nsPrintEngine.cpp @@ -3560,26 +3560,6 @@ nsPrintEngine::FirePrintCompletionEvent() NS_WARNING("failed to dispatch print completion event"); } -bool -nsPrintEngine::MayHavePluginFrames() -{ - nsPrintData* prt = mPrt; - if (!mPrt) { - prt = mPrtPreview; - if (!prt) { - prt = mOldPrtPreview; - } - } - if (prt) { - for (uint32_t i = 0; i < prt->mPrintDocList.Length(); ++i) { - if (prt->mPrintDocList[i]->MayHavePluginFrames()) { - return true; - } - } - } - return false; -} - //--------------------------------------------------------------- //--------------------------------------------------------------- //-- Debug helper routines diff --git a/layout/printing/nsPrintEngine.h b/layout/printing/nsPrintEngine.h index 153e6de286a1..6457e306574d 100644 --- a/layout/printing/nsPrintEngine.h +++ b/layout/printing/nsPrintEngine.h @@ -203,8 +203,6 @@ public: mDisallowSelectionPrint = aDisallowSelectionPrint; } - bool MayHavePluginFrames(); - protected: ~nsPrintEngine(); diff --git a/layout/printing/nsPrintObject.cpp b/layout/printing/nsPrintObject.cpp index fd4377886b44..c1caf762f707 100644 --- a/layout/printing/nsPrintObject.cpp +++ b/layout/printing/nsPrintObject.cpp @@ -111,8 +111,3 @@ nsPrintObject::DestroyPresentation() mViewManager = nullptr; } -bool -nsPrintObject::MayHavePluginFrames() -{ - return mDocument && mDocument->MayHavePluginFramesForPrinting(); -} diff --git a/layout/printing/nsPrintObject.h b/layout/printing/nsPrintObject.h index 207d5bb05c88..5103224f049d 100644 --- a/layout/printing/nsPrintObject.h +++ b/layout/printing/nsPrintObject.h @@ -36,9 +36,6 @@ public: bool aPrintPreview); bool IsPrintable() { return !mDontPrint; } - - bool MayHavePluginFrames(); - void DestroyPresentation(); // Data Members