Bug 1305309, backout Bug 1214805, r=backout

--HG--
extra : rebase_source : d86f67ef53b26027d739725829a2ee736d71221e
This commit is contained in:
Olli Pettay 2016-09-27 01:03:24 +03:00
Родитель d4aabe37f6
Коммит bddafc48dd
7 изменённых файлов: 8 добавлений и 72 удалений

Просмотреть файл

@ -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,

Просмотреть файл

@ -2907,13 +2907,9 @@ nsObjectLoadingContent::CreateStaticClone(nsObjectLoadingContent* aDest) const
aDest->mPrintFrame = const_cast<nsObjectLoadingContent*>(this)->GetExistingFrame();
}
nsCOMPtr<nsIContent> content =
do_QueryInterface(static_cast<nsIImageLoadingContent*>(aDest));
if (aDest->mPrintFrame) {
content->OwnerDoc()->SetMayHavePluginFramesForPrinting();
}
if (mFrameLoader) {
nsCOMPtr<nsIContent> content =
do_QueryInterface(static_cast<nsIImageLoadingContent*>(aDest));
nsFrameLoader* fl = nsFrameLoader::Create(content->AsElement(), false);
if (fl) {
aDest->mFrameLoader = fl;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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

Просмотреть файл

@ -203,8 +203,6 @@ public:
mDisallowSelectionPrint = aDisallowSelectionPrint;
}
bool MayHavePluginFrames();
protected:
~nsPrintEngine();

Просмотреть файл

@ -111,8 +111,3 @@ nsPrintObject::DestroyPresentation()
mViewManager = nullptr;
}
bool
nsPrintObject::MayHavePluginFrames()
{
return mDocument && mDocument->MayHavePluginFramesForPrinting();
}

Просмотреть файл

@ -36,9 +36,6 @@ public:
bool aPrintPreview);
bool IsPrintable() { return !mDontPrint; }
bool MayHavePluginFrames();
void DestroyPresentation();
// Data Members