Bug 1699837 - Make sure that remote iframes honor print settings. r=mattwoodrow

This fixes it since we honor the print resolution properly now.

Differential Revision: https://phabricator.services.mozilla.com/D115263
This commit is contained in:
Emilio Cobos Álvarez 2021-06-13 09:16:53 +00:00
Родитель 077501b34c
Коммит 9db2aa0440
17 изменённых файлов: 224 добавлений и 46 удалений

Просмотреть файл

@ -202,6 +202,11 @@ interface nsIContentViewer : nsISupports
void setPageModeForTesting(in boolean aPageMode,
in nsIPrintSettings aPrintSettings);
/**
* Sets the print settings for print / print-previewing a subdocument.
*/
[can_run_script] void setPrintSettingsForSubdocument(in nsIPrintSettings aPrintSettings);
/**
* Get the history entry that this viewer will save itself into when
* destroyed. Can return null

Просмотреть файл

@ -12832,7 +12832,7 @@ static void CachePrintSelectionRanges(const Document& aSourceDoc,
already_AddRefed<Document> Document::CreateStaticClone(
nsIDocShell* aCloneContainer, nsIContentViewer* aViewer,
bool* aOutHasInProcessPrintCallbacks) {
nsIPrintSettings* aPrintSettings, bool* aOutHasInProcessPrintCallbacks) {
MOZ_ASSERT(!mCreatingStaticClone);
MOZ_ASSERT(!GetProperty(nsGkAtoms::adoptedsheetclones));
MOZ_DIAGNOSTIC_ASSERT(aViewer);
@ -12926,7 +12926,7 @@ already_AddRefed<Document> Document::CreateStaticClone(
clone.mElement->SetFrameLoader(frameLoader);
nsresult rv = frameLoader->FinishStaticClone(
clone.mStaticCloneOf, aOutHasInProcessPrintCallbacks);
clone.mStaticCloneOf, aPrintSettings, aOutHasInProcessPrintCallbacks);
Unused << NS_WARN_IF(NS_FAILED(rv));
}

Просмотреть файл

@ -2872,11 +2872,12 @@ class Document : public nsINode,
* @param aContentViewer The viewer for the clone document. Must be the viewer
* of aCloneContainer, but callers must have a reference
* to it already and ensure it's not null.
* @param aPrintSettings The print settings for this clone.
* @param aOutHasInProcessPrintCallbacks Self-descriptive.
*/
already_AddRefed<Document> CreateStaticClone(
nsIDocShell* aCloneContainer, nsIContentViewer* aContentViewer,
bool* aOutHasInProcessPrintCallbacks);
nsIPrintSettings* aPrintSettings, bool* aOutHasInProcessPrintCallbacks);
/**
* If this document is a static clone, this returns the original

Просмотреть файл

@ -18,6 +18,7 @@
#include "nsDocShell.h"
#include "nsIContentInlines.h"
#include "nsIContentViewer.h"
#include "nsIPrintSettings.h"
#include "nsIPrintSettingsService.h"
#include "mozilla/dom/Document.h"
#include "nsPIDOMWindow.h"
@ -2829,8 +2830,10 @@ void nsFrameLoader::ActivateFrameEvent(const nsAString& aType, bool aCapture,
}
}
nsresult nsFrameLoader::DoRemoteStaticClone(nsFrameLoader* aStaticCloneOf) {
nsresult nsFrameLoader::DoRemoteStaticClone(nsFrameLoader* aStaticCloneOf,
nsIPrintSettings* aPrintSettings) {
MOZ_ASSERT(aStaticCloneOf->IsRemoteFrame());
MOZ_ASSERT(aPrintSettings);
auto* cc = ContentChild::GetSingleton();
if (!cc) {
MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess());
@ -2843,12 +2846,25 @@ nsresult nsFrameLoader::DoRemoteStaticClone(nsFrameLoader* aStaticCloneOf) {
}
BrowsingContext* bc = GetBrowsingContext();
MOZ_DIAGNOSTIC_ASSERT(bc);
cc->SendCloneDocumentTreeInto(bcToClone, bc);
nsCOMPtr<nsIPrintSettingsService> printSettingsSvc =
do_GetService("@mozilla.org/gfx/printsettings-service;1");
if (NS_WARN_IF(!printSettingsSvc)) {
return NS_ERROR_UNEXPECTED;
}
embedding::PrintData printData;
nsresult rv =
printSettingsSvc->SerializeToPrintData(aPrintSettings, &printData);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
cc->SendCloneDocumentTreeInto(bcToClone, bc, printData);
return NS_OK;
}
nsresult nsFrameLoader::FinishStaticClone(
nsFrameLoader* aStaticCloneOf, bool* aOutHasInProcessPrintCallbacks) {
nsFrameLoader* aStaticCloneOf, nsIPrintSettings* aPrintSettings,
bool* aOutHasInProcessPrintCallbacks) {
MOZ_DIAGNOSTIC_ASSERT(
!nsContentUtils::IsSafeToRunScript(),
"A script blocker should be on the stack while FinishStaticClone is run");
@ -2866,7 +2882,7 @@ nsresult nsFrameLoader::FinishStaticClone(
}
if (aStaticCloneOf->IsRemoteFrame()) {
return DoRemoteStaticClone(aStaticCloneOf);
return DoRemoteStaticClone(aStaticCloneOf, aPrintSettings);
}
nsIDocShell* origDocShell = aStaticCloneOf->GetDocShell();
@ -2886,8 +2902,8 @@ nsresult nsFrameLoader::FinishStaticClone(
docShell->GetContentViewer(getter_AddRefs(viewer));
NS_ENSURE_STATE(viewer);
nsCOMPtr<Document> clonedDoc =
doc->CreateStaticClone(docShell, viewer, aOutHasInProcessPrintCallbacks);
nsCOMPtr<Document> clonedDoc = doc->CreateStaticClone(
docShell, viewer, aPrintSettings, aOutHasInProcessPrintCallbacks);
return NS_OK;
}

Просмотреть файл

@ -153,9 +153,11 @@ class nsFrameLoader final : public nsStubMutationObserver,
// created for the cloned iframe, and `FinishStaticClone` will be called on
// it, which will clone the inner document of the source nsFrameLoader.
nsresult FinishStaticClone(nsFrameLoader* aStaticCloneOf,
nsIPrintSettings* aPrintSettings,
bool* aOutHasInProcessPrintCallbacks);
nsresult DoRemoteStaticClone(nsFrameLoader* aStaticCloneOf);
nsresult DoRemoteStaticClone(nsFrameLoader* aStaticCloneOf,
nsIPrintSettings* aPrintSettings);
// WebIDL methods

Просмотреть файл

@ -5267,6 +5267,12 @@ Nullable<WindowProxyHolder> nsGlobalWindowOuter::Print(
return nullptr;
}
nsCOMPtr<nsIPrintSettings> ps = aPrintSettings;
if (!ps) {
printSettingsService->GetDefaultPrintSettingsForPrinting(
getter_AddRefs(ps));
}
RefPtr<Document> docToPrint = mDoc;
if (NS_WARN_IF(!docToPrint)) {
aError.ThrowNotSupportedError("Document is gone");
@ -5375,8 +5381,8 @@ Nullable<WindowProxyHolder> nsGlobalWindowOuter::Print(
AutoPrintEventDispatcher dispatcher(*docToPrint);
nsAutoScriptBlocker blockScripts;
RefPtr<Document> clone =
docToPrint->CreateStaticClone(cloneDocShell, cv, &hasPrintCallbacks);
RefPtr<Document> clone = docToPrint->CreateStaticClone(
cloneDocShell, cv, ps, &hasPrintCallbacks);
if (!clone) {
aError.ThrowNotSupportedError("Clone operation for printing failed");
return nullptr;
@ -5395,7 +5401,7 @@ Nullable<WindowProxyHolder> nsGlobalWindowOuter::Print(
// wasted work (and use probably-incorrect settings). So skip it, the
// preview UI will take care of calling PrintPreview again.
if (aForWindowDotPrint == IsForWindowDotPrint::No) {
aError = webBrowserPrint->PrintPreview(aPrintSettings, aListener,
aError = webBrowserPrint->PrintPreview(ps, aListener,
std::move(aPrintPreviewCallback));
if (aError.Failed()) {
return nullptr;
@ -5403,7 +5409,7 @@ Nullable<WindowProxyHolder> nsGlobalWindowOuter::Print(
}
} else {
// Historically we've eaten this error.
webBrowserPrint->Print(aPrintSettings, aListener);
webBrowserPrint->Print(ps, aListener);
}
// When using window.print() with the new UI, we usually want to block until

Просмотреть файл

@ -30,6 +30,8 @@
#include "VRManagerChild.h"
#include "ipc/nsGUIEventIPC.h"
#include "js/JSON.h"
#include "nsIDeviceContextSpec.h"
#include "nsDeviceContextSpecProxy.h"
#include "mozilla/Assertions.h"
#include "mozilla/AsyncEventDispatcher.h"
#include "mozilla/BasePrincipal.h"
@ -1043,7 +1045,8 @@ mozilla::ipc::IPCResult BrowserChild::RecvResumeLoad(
}
mozilla::ipc::IPCResult BrowserChild::RecvCloneDocumentTreeIntoSelf(
const MaybeDiscarded<BrowsingContext>& aSourceBC) {
const MaybeDiscarded<BrowsingContext>& aSourceBC,
const embedding::PrintData& aPrintData) {
if (NS_WARN_IF(aSourceBC.IsNullOrDiscarded())) {
return IPC_OK();
}
@ -1063,26 +1066,75 @@ mozilla::ipc::IPCResult BrowserChild::RecvCloneDocumentTreeIntoSelf(
return IPC_OK();
}
nsCOMPtr<nsIPrintSettingsService> printSettingsSvc =
do_GetService("@mozilla.org/gfx/printsettings-service;1");
if (NS_WARN_IF(!printSettingsSvc)) {
return IPC_OK();
}
nsCOMPtr<nsIPrintSettings> printSettings;
nsresult rv =
printSettingsSvc->GetNewPrintSettings(getter_AddRefs(printSettings));
if (NS_WARN_IF(NS_FAILED(rv))) {
return IPC_OK();
}
printSettingsSvc->DeserializeToPrintSettings(aPrintData, printSettings);
RefPtr<Document> clone;
{
AutoPrintEventDispatcher dispatcher(*sourceDocument);
nsAutoScriptBlocker scriptBlocker;
bool hasInProcessCallbacks = false;
clone = sourceDocument->CreateStaticClone(ourDocShell, cv,
clone = sourceDocument->CreateStaticClone(ourDocShell, cv, printSettings,
&hasInProcessCallbacks);
if (NS_WARN_IF(!clone)) {
return IPC_OK();
}
}
// Since the clone document is not parsed-created, we need to initialize
// layout manually. This is usually done in ReflowPrintObject for non-remote
// documents.
if (RefPtr<PresShell> ps = clone->GetPresShell()) {
if (!ps->DidInitialize()) {
nsresult rv = ps->Initialize();
Unused << NS_WARN_IF(NS_FAILED(rv));
}
rv = cv->SetPrintSettingsForSubdocument(printSettings);
if (NS_WARN_IF(NS_FAILED(rv))) {
return IPC_OK();
}
return IPC_OK();
}
mozilla::ipc::IPCResult BrowserChild::RecvUpdateRemotePrintSettings(
const embedding::PrintData& aPrintData) {
nsCOMPtr<nsIDocShell> ourDocShell = do_GetInterface(WebNavigation());
if (NS_WARN_IF(!ourDocShell)) {
return IPC_OK();
}
RefPtr<Document> doc = ourDocShell->GetExtantDocument();
if (NS_WARN_IF(!doc) || NS_WARN_IF(!doc->IsStaticDocument())) {
return IPC_OK();
}
nsCOMPtr<nsIContentViewer> cv;
ourDocShell->GetContentViewer(getter_AddRefs(cv));
if (NS_WARN_IF(!cv)) {
return IPC_OK();
}
nsCOMPtr<nsIPrintSettingsService> printSettingsSvc =
do_GetService("@mozilla.org/gfx/printsettings-service;1");
if (NS_WARN_IF(!printSettingsSvc)) {
return IPC_OK();
}
nsCOMPtr<nsIPrintSettings> printSettings;
nsresult rv =
printSettingsSvc->GetNewPrintSettings(getter_AddRefs(printSettings));
if (NS_WARN_IF(NS_FAILED(rv))) {
return IPC_OK();
}
printSettingsSvc->DeserializeToPrintSettings(aPrintData, printSettings);
rv = cv->SetPrintSettingsForSubdocument(printSettings);
if (NS_WARN_IF(NS_FAILED(rv))) {
return IPC_OK();
}
return IPC_OK();

Просмотреть файл

@ -270,8 +270,14 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
mozilla::ipc::IPCResult RecvResumeLoad(const uint64_t& aPendingSwitchID,
const ParentShowInfo&);
mozilla::ipc::IPCResult RecvCloneDocumentTreeIntoSelf(
const MaybeDiscarded<BrowsingContext>& aSourceBC);
MOZ_CAN_RUN_SCRIPT_BOUNDARY mozilla::ipc::IPCResult
RecvCloneDocumentTreeIntoSelf(
const MaybeDiscarded<BrowsingContext>& aSourceBC,
const embedding::PrintData& aPrintData);
MOZ_CAN_RUN_SCRIPT_BOUNDARY
mozilla::ipc::IPCResult RecvUpdateRemotePrintSettings(
const embedding::PrintData& aPrintData);
MOZ_CAN_RUN_SCRIPT_BOUNDARY
mozilla::ipc::IPCResult RecvShow(const ParentShowInfo&, const OwnerShowInfo&);

Просмотреть файл

@ -3810,7 +3810,7 @@ static bool CloneIsLegal(ContentParent* aCp, CanonicalBrowsingContext& aSource,
mozilla::ipc::IPCResult ContentParent::RecvCloneDocumentTreeInto(
const MaybeDiscarded<BrowsingContext>& aSource,
const MaybeDiscarded<BrowsingContext>& aTarget) {
const MaybeDiscarded<BrowsingContext>& aTarget, PrintData&& aPrintData) {
if (aSource.IsNullOrDiscarded() || aTarget.IsNullOrDiscarded()) {
return IPC_OK();
}
@ -3845,8 +3845,9 @@ mozilla::ipc::IPCResult ContentParent::RecvCloneDocumentTreeInto(
target->ChangeRemoteness(options, /* aPendingSwitchId = */ 0)
->Then(
GetMainThreadSerialEventTarget(), __func__,
[source = RefPtr{source}](BrowserParent* aBp) {
Unused << aBp->SendCloneDocumentTreeIntoSelf(source);
[source = RefPtr{source},
data = std::move(aPrintData)](BrowserParent* aBp) {
Unused << aBp->SendCloneDocumentTreeIntoSelf(source, data);
},
[](nsresult aRv) {
NS_WARNING(
@ -3856,6 +3857,22 @@ mozilla::ipc::IPCResult ContentParent::RecvCloneDocumentTreeInto(
return IPC_OK();
}
mozilla::ipc::IPCResult ContentParent::RecvUpdateRemotePrintSettings(
const MaybeDiscarded<BrowsingContext>& aTarget, PrintData&& aPrintData) {
if (aTarget.IsNullOrDiscarded()) {
return IPC_OK();
}
auto* target = aTarget.get_canonical();
auto* bp = target->GetBrowserParent();
if (NS_WARN_IF(!bp)) {
return IPC_OK();
}
Unused << bp->SendUpdateRemotePrintSettings(std::move(aPrintData));
return IPC_OK();
}
mozilla::ipc::IPCResult ContentParent::RecvConstructPopupBrowser(
ManagedEndpoint<PBrowserParent>&& aBrowserEp,
ManagedEndpoint<PWindowGlobalParent>&& aWindowEp, const TabId& aTabId,

Просмотреть файл

@ -932,7 +932,10 @@ class ContentParent final
mozilla::ipc::IPCResult RecvCloneDocumentTreeInto(
const MaybeDiscarded<BrowsingContext>& aSource,
const MaybeDiscarded<BrowsingContext>& aTarget);
const MaybeDiscarded<BrowsingContext>& aTarget, PrintData&& aPrintData);
mozilla::ipc::IPCResult RecvUpdateRemotePrintSettings(
const MaybeDiscarded<BrowsingContext>& aTarget, PrintData&& aPrintData);
mozilla::ipc::IPCResult RecvConstructPopupBrowser(
ManagedEndpoint<PBrowserParent>&& actor,

Просмотреть файл

@ -583,7 +583,8 @@ child:
async NativeSynthesisResponse(uint64_t aObserverId, nsCString aResponse);
async UpdateEpoch(uint32_t aEpoch);
async UpdateSHistory();
async CloneDocumentTreeIntoSelf(MaybeDiscardedBrowsingContext aBc);
async CloneDocumentTreeIntoSelf(MaybeDiscardedBrowsingContext aBc, PrintData aPrintData);
async UpdateRemotePrintSettings(PrintData aPrintData);
/**
* Parent informs the child to release all pointer capture.

Просмотреть файл

@ -49,6 +49,7 @@ include DOMTypes;
include WindowGlobalTypes;
include IPCBlob;
include IPCStream;
include PPrintingTypes;
include PTabContext;
include ProtocolTypes;
include PBackgroundSharedTypes;
@ -482,7 +483,11 @@ parent:
// Guess we'll see how we end up triggering the actual print, for preview
// this should be enough...
async CloneDocumentTreeInto(MaybeDiscardedBrowsingContext aSourceBc,
MaybeDiscardedBrowsingContext aTargetBc);
MaybeDiscardedBrowsingContext aTargetBc,
PrintData aPrintData);
async UpdateRemotePrintSettings(MaybeDiscardedBrowsingContext aBc,
PrintData aPrintData);
async PExtensions();

Просмотреть файл

@ -23,6 +23,7 @@
#include "nsIContentViewer.h"
#include "nsIDocumentViewerPrint.h"
#include "nsIScreen.h"
#include "nsDeviceContextSpecProxy.h"
#include "mozilla/dom/AutoSuppressEventHandlingAndSuspend.h"
#include "mozilla/dom/BrowsingContext.h"
#include "mozilla/dom/BeforeUnloadEvent.h"
@ -783,7 +784,9 @@ nsresult nsDocumentViewer::InitPresentationStuff(bool aDoInitialReflow) {
static nsPresContext* CreatePresContext(Document* aDocument,
nsPresContext::nsPresContextType aType,
nsView* aContainerView) {
if (aContainerView) return new nsPresContext(aDocument, aType);
if (aContainerView) {
return new nsPresContext(aDocument, aType);
}
return new nsRootPresContext(aDocument, aType);
}
@ -2037,7 +2040,7 @@ nsDocumentViewer::Move(int32_t aX, int32_t aY) {
}
NS_IMETHODIMP
nsDocumentViewer::Show(void) {
nsDocumentViewer::Show() {
NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
// We don't need the previous viewer anymore since we're not
@ -2151,7 +2154,7 @@ nsDocumentViewer::Show(void) {
}
NS_IMETHODIMP
nsDocumentViewer::Hide(void) {
nsDocumentViewer::Hide() {
if (!mAttachedToParent && mWindow) {
mWindow->Show(false);
}
@ -2238,7 +2241,9 @@ nsDocumentViewer::ClearHistoryEntry() {
nsresult nsDocumentViewer::MakeWindow(const nsSize& aSize,
nsView* aContainerView) {
if (GetIsPrintPreview()) return NS_OK;
if (GetIsPrintPreview()) {
return NS_OK;
}
bool shouldAttach = ShouldAttachToTopLevel();
@ -3489,6 +3494,52 @@ void nsDocumentViewer::OnDonePrinting() {
#endif // NS_PRINTING && NS_PRINT_PREVIEW
}
NS_IMETHODIMP nsDocumentViewer::SetPrintSettingsForSubdocument(
nsIPrintSettings* aPrintSettings) {
{
nsAutoScriptBlocker scriptBlocker;
if (mPresShell) {
DestroyPresShell();
}
if (mPresContext) {
DestroyPresContext();
}
MOZ_ASSERT(!mPresContext);
MOZ_ASSERT(!mPresShell);
RefPtr<nsIDeviceContextSpec> devspec = new nsDeviceContextSpecProxy();
nsresult rv =
devspec->Init(nullptr, aPrintSettings, /* aIsPrintPreview = */ true);
NS_ENSURE_SUCCESS(rv, rv);
mDeviceContext = new nsDeviceContext();
rv = mDeviceContext->InitForPrinting(devspec);
NS_ENSURE_SUCCESS(rv, rv);
mPresContext = CreatePresContext(
mDocument, nsPresContext::eContext_PrintPreview, FindContainerView());
mPresContext->SetPrintSettings(aPrintSettings);
rv = mPresContext->Init(mDeviceContext);
NS_ENSURE_SUCCESS(rv, rv);
rv = MakeWindow(nsSize(mPresContext->DevPixelsToAppUnits(mBounds.width),
mPresContext->DevPixelsToAppUnits(mBounds.height)),
FindContainerView());
NS_ENSURE_SUCCESS(rv, rv);
MOZ_TRY(InitPresentationStuff(true));
}
RefPtr<PresShell> shell = mPresShell;
shell->FlushPendingNotifications(FlushType::Layout);
return NS_OK;
}
NS_IMETHODIMP nsDocumentViewer::SetPageModeForTesting(
bool aPageMode, nsIPrintSettings* aPrintSettings) {
// XXX Page mode is only partially working; it's currently used for

Просмотреть файл

@ -1688,7 +1688,7 @@ void nsPresContext::SetPrintSettings(nsIPrintSettings* aPrintSettings) {
return;
}
// set the presentation context to the value in the print settings
// Set the presentation context to the value in the print settings.
mDrawColorBackground = mPrintSettings->GetPrintBGColors();
mDrawImageBackground = mPrintSettings->GetPrintBGImages();

Просмотреть файл

@ -19,6 +19,7 @@
#include "mozilla/dom/PBrowser.h"
#include "mozilla/dom/Selection.h"
#include "mozilla/dom/CustomEvent.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/HTMLCanvasElement.h"
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/StaticPrefs_print.h"
@ -252,6 +253,14 @@ static void BuildNestedPrintObjects(const UniquePtr<nsPrintObject>& aParentPO,
for (auto& bc : aParentPO->mDocShell->GetBrowsingContext()->Children()) {
nsCOMPtr<nsIDocShell> docShell = bc->GetDocShell();
if (!docShell) {
if (auto* cc = dom::ContentChild::GetSingleton()) {
nsCOMPtr<nsIPrintSettingsService> printSettingsService =
do_GetService(sPrintSettingsServiceContractID);
embedding::PrintData printData;
printSettingsService->SerializeToPrintData(aPrintData->mPrintSettings,
&printData);
Unused << cc->SendUpdateRemotePrintSettings(bc, printData);
}
continue;
}
@ -542,6 +551,12 @@ nsresult nsPrintJob::DoCommonPrint(bool aIsPrintPreview,
nsCOMPtr<nsIDocShell> docShell(do_QueryReferent(mDocShell, &rv));
NS_ENSURE_SUCCESS(rv, rv);
// if they don't pass in a PrintSettings, then get the Global PS
printData->mPrintSettings = aPrintSettings;
if (!printData->mPrintSettings) {
MOZ_TRY(GetDefaultPrintSettings(getter_AddRefs(printData->mPrintSettings)));
}
{
nsAutoScriptBlocker scriptBlocker;
printData->mPrintObject = MakeUnique<nsPrintObject>();
@ -571,12 +586,6 @@ nsresult nsPrintJob::DoCommonPrint(bool aIsPrintPreview,
!printData->mPrintObject->mDocument->GetRootElement())
return NS_ERROR_GFX_PRINTER_STARTDOC;
// if they don't pass in a PrintSettings, then get the Global PS
printData->mPrintSettings = aPrintSettings;
if (!printData->mPrintSettings) {
MOZ_TRY(GetDefaultPrintSettings(getter_AddRefs(printData->mPrintSettings)));
}
MOZ_TRY(EnsureSettingsHasPrinterNameSet(printData->mPrintSettings));
printData->mPrintSettings->SetIsCancelled(false);
@ -775,8 +784,7 @@ nsresult nsPrintJob::DoCommonPrint(bool aIsPrintPreview,
[self](nsresult aResult) { self->PageDone(aResult); });
}
if (!mozilla::StaticPrefs::print_tab_modal_enabled() &&
mIsCreatingPrintPreview) {
if (!StaticPrefs::print_tab_modal_enabled() && mIsCreatingPrintPreview) {
// In legacy print-preview mode, override any UI that wants to PrintPreview
// any selection or page range. The legacy print-preview intends to view
// every page in PrintPreview each time.

Просмотреть файл

@ -27,6 +27,9 @@ using namespace mozilla::gfx;
NS_IMPL_ISUPPORTS(nsDeviceContextSpecProxy, nsIDeviceContextSpec)
nsDeviceContextSpecProxy::nsDeviceContextSpecProxy() = default;
nsDeviceContextSpecProxy::~nsDeviceContextSpecProxy() = default;
NS_IMETHODIMP
nsDeviceContextSpecProxy::Init(nsIWidget* aWidget,
nsIPrintSettings* aPrintSettings,

Просмотреть файл

@ -52,8 +52,10 @@ class nsDeviceContextSpecProxy final : public nsIDeviceContextSpec {
NS_IMETHOD EndPage() final;
nsDeviceContextSpecProxy();
private:
~nsDeviceContextSpecProxy() = default;
~nsDeviceContextSpecProxy();
nsCOMPtr<nsIPrintSettings> mPrintSettings;
nsCOMPtr<nsIPrintSession> mPrintSession;