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)) {