mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
Bug 1553081. Set nsPrintJob::mDisallowSelectionPrint during Initialize(). r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D31975 --HG-- extra : rebase_source : 57b72312d1c25b62b3c5ebd6818f2010eddfefec extra : amend_source : 9f8a0f0e30fefccd3a9296b6d91e74f7b6589676
This commit is contained in:
parent
e8b9c5bc5d
commit
a7b3640083
@ -3533,11 +3533,6 @@ nsDocumentViewer::Print(nsIPrintSettings* aPrintSettings,
|
||||
// callbacks have been called:
|
||||
mAutoBeforeAndAfterPrint = std::move(autoBeforeAndAfterPrint);
|
||||
}
|
||||
dom::Element* root = mDocument->GetRootElement();
|
||||
if (root &&
|
||||
root->HasAttr(kNameSpaceID_None, nsGkAtoms::mozdisallowselectionprint)) {
|
||||
printJob->SetDisallowSelectionPrint(true);
|
||||
}
|
||||
rv = printJob->Print(mDocument, aPrintSettings, aWebProgressListener);
|
||||
if (NS_FAILED(rv)) {
|
||||
OnDonePrinting();
|
||||
@ -3618,12 +3613,6 @@ nsDocumentViewer::PrintPreview(nsIPrintSettings* aPrintSettings,
|
||||
// callbacks have been called:
|
||||
mAutoBeforeAndAfterPrint = std::move(autoBeforeAndAfterPrint);
|
||||
}
|
||||
dom::Element* root = doc->GetRootElement();
|
||||
if (root &&
|
||||
root->HasAttr(kNameSpaceID_None, nsGkAtoms::mozdisallowselectionprint)) {
|
||||
PR_PL(("PrintPreview: found mozdisallowselectionprint"));
|
||||
printJob->SetDisallowSelectionPrint(true);
|
||||
}
|
||||
rv = printJob->PrintPreview(doc, aPrintSettings, aWebProgressListener);
|
||||
mPrintPreviewZoomed = false;
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -585,6 +585,11 @@ nsresult nsPrintJob::Initialize(nsIDocumentViewerPrint* aDocViewerPrint,
|
||||
// here, since the document that the user selected to print may mutate
|
||||
// across consecutive PrintPreview() calls.
|
||||
|
||||
Element* root = aOriginalDoc->GetRootElement();
|
||||
mDisallowSelectionPrint =
|
||||
root &&
|
||||
root->HasAttr(kNameSpaceID_None, nsGkAtoms::mozdisallowselectionprint);
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeOwner> owner;
|
||||
aDocShell->GetTreeOwner(getter_AddRefs(owner));
|
||||
nsCOMPtr<nsIWebBrowserChrome> browserChrome = do_GetInterface(owner);
|
||||
|
@ -233,10 +233,6 @@ class nsPrintJob final : public nsIObserver,
|
||||
bool GetIsPrintPreview() { return mIsDoingPrintPreview; }
|
||||
bool GetIsCreatingPrintPreview() { return mIsCreatingPrintPreview; }
|
||||
|
||||
void SetDisallowSelectionPrint(bool aDisallowSelectionPrint) {
|
||||
mDisallowSelectionPrint = aDisallowSelectionPrint;
|
||||
}
|
||||
|
||||
private:
|
||||
nsPrintJob& operator=(const nsPrintJob& aOther) = delete;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user