mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 10:00:54 +00:00
Bug 830278 - Allow disabling of selecting printing with mozdisallowselectionprint on the document element. r=roc
This commit is contained in:
parent
6146dcbc98
commit
87fc6e7ab2
@ -37,6 +37,7 @@ GK_ATOM(mozframetype, "mozframetype")
|
||||
GK_ATOM(mozallowfullscreen, "mozallowfullscreen")
|
||||
GK_ATOM(moztype, "_moz-type")
|
||||
GK_ATOM(mozdirty, "_moz_dirty")
|
||||
GK_ATOM(mozdisallowselectionprint, "mozdisallowselectionprint")
|
||||
GK_ATOM(mozdonotsend, "moz-do-not-send")
|
||||
GK_ATOM(mozeditorbogusnode, "_moz_editor_bogus_node")
|
||||
GK_ATOM(mozgeneratedcontentbefore, "_moz_generated_content_before")
|
||||
|
@ -3656,6 +3656,10 @@ nsDocumentViewer::Print(nsIPrintSettings* aPrintSettings,
|
||||
if (mPrintEngine->HasPrintCallbackCanvas()) {
|
||||
mBeforeAndAfterPrint = beforeAndAfterPrint;
|
||||
}
|
||||
dom::Element* root = mDocument->GetRootElement();
|
||||
if (root && root->HasAttr(kNameSpaceID_None, nsGkAtoms::mozdisallowselectionprint)) {
|
||||
mPrintEngine->SetDisallowSelectionPrint(true);
|
||||
}
|
||||
rv = mPrintEngine->Print(aPrintSettings, aWebProgressListener);
|
||||
if (NS_FAILED(rv)) {
|
||||
OnDonePrinting();
|
||||
|
@ -236,7 +236,8 @@ nsPrintEngine::nsPrintEngine() :
|
||||
mDebugFile(nullptr),
|
||||
mLoadCounter(0),
|
||||
mDidLoadDataForPrinting(false),
|
||||
mIsDestroying(false)
|
||||
mIsDestroying(false),
|
||||
mDisallowSelectionPrint(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -559,7 +560,8 @@ nsPrintEngine::DoCommonPrint(bool aIsPrintPreview,
|
||||
mPrt->mPrintSettings->SetHowToEnableFrameUI(nsIPrintSettings::kFrameEnableNone);
|
||||
}
|
||||
// Now determine how to set up the Frame print UI
|
||||
mPrt->mPrintSettings->SetPrintOptions(nsIPrintSettings::kEnableSelectionRB, isSelection || mPrt->mIsIFrameSelected);
|
||||
mPrt->mPrintSettings->SetPrintOptions(nsIPrintSettings::kEnableSelectionRB,
|
||||
!mDisallowSelectionPrint && (isSelection || mPrt->mIsIFrameSelected));
|
||||
|
||||
nsCOMPtr<nsIDeviceContextSpec> devspec
|
||||
(do_CreateInstance("@mozilla.org/gfx/devicecontextspec;1", &rv));
|
||||
|
@ -204,6 +204,11 @@ public:
|
||||
return mIsCreatingPrintPreview;
|
||||
}
|
||||
|
||||
void SetDisallowSelectionPrint(bool aDisallowSelectionPrint)
|
||||
{
|
||||
mDisallowSelectionPrint = aDisallowSelectionPrint;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
nsresult CommonPrint(bool aIsPrintPreview, nsIPrintSettings* aPrintSettings,
|
||||
@ -281,6 +286,7 @@ protected:
|
||||
int32_t mLoadCounter;
|
||||
bool mDidLoadDataForPrinting;
|
||||
bool mIsDestroying;
|
||||
bool mDisallowSelectionPrint;
|
||||
|
||||
nsresult AfterNetworkPrint(bool aHandleError);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user