diff --git a/layout/printing/nsPrintJob.cpp b/layout/printing/nsPrintJob.cpp index 6563a7be6215..95a8f22fef60 100644 --- a/layout/printing/nsPrintJob.cpp +++ b/layout/printing/nsPrintJob.cpp @@ -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 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; } diff --git a/layout/printing/nsPrintJob.h b/layout/printing/nsPrintJob.h index 456e34516eb5..62bead2898b6 100644 --- a/layout/printing/nsPrintJob.h +++ b/layout/printing/nsPrintJob.h @@ -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);