From fb1168ac2d339ed7f0500e9027a12a3ec386d6c6 Mon Sep 17 00:00:00 2001 From: Oskar Eisemuth Date: Fri, 24 Jan 2014 17:18:54 -0500 Subject: [PATCH] Bug 844473: Honor mozdisallowselectionprint and moznomarginboxes in print preview as well as print. r=roc --- layout/base/nsDocumentViewer.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 8d7aacb9132..4ea950fc9c3 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -3701,6 +3701,13 @@ nsDocumentViewer::PrintPreview(nsIPrintSettings* aPrintSettings, if (mPrintEngine->HasPrintCallbackCanvas()) { mBeforeAndAfterPrint = beforeAndAfterPrint; } + dom::Element* root = mDocument->GetRootElement(); + if (root && root->HasAttr(kNameSpaceID_None, nsGkAtoms::mozdisallowselectionprint)) { + mPrintEngine->SetDisallowSelectionPrint(true); + } + if (root && root->HasAttr(kNameSpaceID_None, nsGkAtoms::moznomarginboxes)) { + mPrintEngine->SetNoMarginBoxes(true); + } rv = mPrintEngine->PrintPreview(aPrintSettings, aChildDOMWin, aWebProgressListener); mPrintPreviewZoomed = false; if (NS_FAILED(rv)) {