Bug 1557983. Remove nsPrintJob::HasPrintCallbackCanvas.

After refactoring the 'beforeprint'/'afterprint' code, this method is not used
any more.

Differential Revision: https://phabricator.services.mozilla.com/D34281
This commit is contained in:
Jonathan Watt 2020-07-11 14:14:15 +00:00
Родитель eee2d4c223
Коммит bdfbfac7d5
2 изменённых файлов: 0 добавлений и 39 удалений

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

@ -401,37 +401,6 @@ static nsresult EnsureSettingsHasPrinterNameSet(
#endif
}
static bool DocHasPrintCallbackCanvas(Document& aDoc) {
Element* root = aDoc.GetRootElement();
if (!root) {
return false;
}
// FIXME(emilio): This doesn't account for shadow dom and it's unnecessarily
// inefficient. Though I guess it doesn't really matter.
RefPtr<nsContentList> canvases =
NS_GetContentList(root, kNameSpaceID_XHTML, u"canvas"_ns);
uint32_t canvasCount = canvases->Length(true);
for (uint32_t i = 0; i < canvasCount; ++i) {
auto* canvas = HTMLCanvasElement::FromNodeOrNull(canvases->Item(i, false));
if (canvas && canvas->GetMozPrintCallback()) {
return true;
}
}
bool result = false;
auto checkSubDoc = [&result](Document& aSubDoc) {
if (DocHasPrintCallbackCanvas(aSubDoc)) {
result = true;
return CallState::Stop;
}
return CallState::Continue;
};
aDoc.EnumerateSubDocuments(checkSubDoc);
return result;
}
//-------------------------------------------------------
NS_IMPL_ISUPPORTS(nsPrintJob, nsIWebProgressListener, nsISupportsWeakReference,
@ -501,8 +470,6 @@ nsresult nsPrintJob::Initialize(nsIDocumentViewerPrint* aDocViewerPrint,
}
}
mHasMozPrintCallback = DocHasPrintCallbackCanvas(*aOriginalDoc);
return NS_OK;
}

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

@ -131,12 +131,6 @@ class nsPrintJob final : public nsIObserver,
void TurnScriptingOn(bool aDoTurnOn);
/**
* Checks to see if the document this print engine is associated with has any
* canvases that have a mozPrintCallback.
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement#Properties
*/
bool HasPrintCallbackCanvas() { return mHasMozPrintCallback; }
bool PrePrintPage();
bool PrintPage(nsPrintObject* aPOect, bool& aInRange);
bool DonePrintingPages(nsPrintObject* aPO, nsresult aResult);