зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1509972 part 4: Use UniquePtr (not nsAutoPtr) to store nsDocumentViewer member mAutoBeforeAndAfterPrint. r=TYLin
Depends on D12995 Differential Revision: https://phabricator.services.mozilla.com/D12996 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
c9b8c15108
Коммит
9f6e171c2f
|
@ -9,7 +9,6 @@
|
|||
#include "gfxContext.h"
|
||||
#include "mozilla/RestyleManager.h"
|
||||
#include "mozilla/ServoStyleSet.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nscore.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCRT.h"
|
||||
|
@ -484,7 +483,7 @@ protected:
|
|||
RefPtr<nsPrintJob> mPrintJob;
|
||||
float mOriginalPrintPreviewScale;
|
||||
float mPrintPreviewZoom;
|
||||
nsAutoPtr<AutoPrintEventDispatcher> mAutoBeforeAndAfterPrint;
|
||||
UniquePtr<AutoPrintEventDispatcher> mAutoBeforeAndAfterPrint;
|
||||
#endif // NS_PRINT_PREVIEW
|
||||
|
||||
#endif // NS_PRINTING
|
||||
|
@ -3869,8 +3868,8 @@ nsDocumentViewer::Print(nsIPrintSettings* aPrintSettings,
|
|||
// Dispatch 'beforeprint' event and ensure 'afterprint' will be dispatched:
|
||||
MOZ_ASSERT(!mAutoBeforeAndAfterPrint,
|
||||
"We don't want to dispatch nested beforeprint/afterprint");
|
||||
nsAutoPtr<AutoPrintEventDispatcher> autoBeforeAndAfterPrint(
|
||||
new AutoPrintEventDispatcher(mDocument));
|
||||
auto autoBeforeAndAfterPrint =
|
||||
MakeUnique<AutoPrintEventDispatcher>(mDocument);
|
||||
NS_ENSURE_STATE(!GetIsPrinting());
|
||||
// If we are hosting a full-page plugin, tell it to print
|
||||
// first. It shows its own native print UI.
|
||||
|
@ -3899,7 +3898,7 @@ nsDocumentViewer::Print(nsIPrintSettings* aPrintSettings,
|
|||
if (printJob->HasPrintCallbackCanvas()) {
|
||||
// Postpone the 'afterprint' event until after the mozPrintCallback
|
||||
// callbacks have been called:
|
||||
mAutoBeforeAndAfterPrint = autoBeforeAndAfterPrint;
|
||||
mAutoBeforeAndAfterPrint = std::move(autoBeforeAndAfterPrint);
|
||||
}
|
||||
dom::Element* root = mDocument->GetRootElement();
|
||||
if (root && root->HasAttr(kNameSpaceID_None, nsGkAtoms::mozdisallowselectionprint)) {
|
||||
|
@ -3954,9 +3953,9 @@ nsDocumentViewer::PrintPreview(nsIPrintSettings* aPrintSettings,
|
|||
// must avoid creating a new AutoPrintEventDispatcher object here if we
|
||||
// already have one saved in mAutoBeforeAndAfterPrint.
|
||||
// [1] Until PDF.js is removed (though, maybe after that as well).
|
||||
nsAutoPtr<AutoPrintEventDispatcher> autoBeforeAndAfterPrint;
|
||||
UniquePtr<AutoPrintEventDispatcher> autoBeforeAndAfterPrint;
|
||||
if (!mAutoBeforeAndAfterPrint) {
|
||||
autoBeforeAndAfterPrint = new AutoPrintEventDispatcher(doc);
|
||||
autoBeforeAndAfterPrint = MakeUnique<AutoPrintEventDispatcher>(doc);
|
||||
}
|
||||
NS_ENSURE_STATE(!GetIsPrinting());
|
||||
// beforeprint event may have caused ContentViewer to be shutdown.
|
||||
|
@ -3984,7 +3983,7 @@ nsDocumentViewer::PrintPreview(nsIPrintSettings* aPrintSettings,
|
|||
printJob->HasPrintCallbackCanvas()) {
|
||||
// Postpone the 'afterprint' event until after the mozPrintCallback
|
||||
// callbacks have been called:
|
||||
mAutoBeforeAndAfterPrint = autoBeforeAndAfterPrint;
|
||||
mAutoBeforeAndAfterPrint = std::move(autoBeforeAndAfterPrint);
|
||||
}
|
||||
dom::Element* root = doc->GetRootElement();
|
||||
if (root && root->HasAttr(kNameSpaceID_None, nsGkAtoms::mozdisallowselectionprint)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче