зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 43a82597dade (bug 1699837) for Crashtest in layout/printing/crashtests/1671503.html. CLOSED TREE
This commit is contained in:
Родитель
051b42edec
Коммит
71abb3ab93
|
@ -202,11 +202,6 @@ 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,
|
||||
nsIPrintSettings* aPrintSettings, bool* aOutHasInProcessPrintCallbacks) {
|
||||
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, aPrintSettings, aOutHasInProcessPrintCallbacks);
|
||||
clone.mStaticCloneOf, aOutHasInProcessPrintCallbacks);
|
||||
Unused << NS_WARN_IF(NS_FAILED(rv));
|
||||
}
|
||||
|
||||
|
|
|
@ -2872,12 +2872,11 @@ 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,
|
||||
nsIPrintSettings* aPrintSettings, bool* aOutHasInProcessPrintCallbacks);
|
||||
bool* aOutHasInProcessPrintCallbacks);
|
||||
|
||||
/**
|
||||
* If this document is a static clone, this returns the original
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "nsDocShell.h"
|
||||
#include "nsIContentInlines.h"
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsIPrintSettings.h"
|
||||
#include "nsIPrintSettingsService.h"
|
||||
#include "mozilla/dom/Document.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
@ -2830,8 +2829,7 @@ void nsFrameLoader::ActivateFrameEvent(const nsAString& aType, bool aCapture,
|
|||
}
|
||||
}
|
||||
|
||||
nsresult nsFrameLoader::DoRemoteStaticClone(nsFrameLoader* aStaticCloneOf,
|
||||
nsIPrintSettings* aPrintSettings) {
|
||||
nsresult nsFrameLoader::DoRemoteStaticClone(nsFrameLoader* aStaticCloneOf) {
|
||||
MOZ_ASSERT(aStaticCloneOf->IsRemoteFrame());
|
||||
auto* cc = ContentChild::GetSingleton();
|
||||
if (!cc) {
|
||||
|
@ -2845,25 +2843,12 @@ nsresult nsFrameLoader::DoRemoteStaticClone(nsFrameLoader* aStaticCloneOf,
|
|||
}
|
||||
BrowsingContext* bc = GetBrowsingContext();
|
||||
MOZ_DIAGNOSTIC_ASSERT(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);
|
||||
cc->SendCloneDocumentTreeInto(bcToClone, bc);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsFrameLoader::FinishStaticClone(
|
||||
nsFrameLoader* aStaticCloneOf, nsIPrintSettings* aPrintSettings,
|
||||
bool* aOutHasInProcessPrintCallbacks) {
|
||||
nsFrameLoader* aStaticCloneOf, bool* aOutHasInProcessPrintCallbacks) {
|
||||
MOZ_DIAGNOSTIC_ASSERT(
|
||||
!nsContentUtils::IsSafeToRunScript(),
|
||||
"A script blocker should be on the stack while FinishStaticClone is run");
|
||||
|
@ -2881,7 +2866,7 @@ nsresult nsFrameLoader::FinishStaticClone(
|
|||
}
|
||||
|
||||
if (aStaticCloneOf->IsRemoteFrame()) {
|
||||
return DoRemoteStaticClone(aStaticCloneOf, aPrintSettings);
|
||||
return DoRemoteStaticClone(aStaticCloneOf);
|
||||
}
|
||||
|
||||
nsIDocShell* origDocShell = aStaticCloneOf->GetDocShell();
|
||||
|
@ -2901,8 +2886,8 @@ nsresult nsFrameLoader::FinishStaticClone(
|
|||
docShell->GetContentViewer(getter_AddRefs(viewer));
|
||||
NS_ENSURE_STATE(viewer);
|
||||
|
||||
nsCOMPtr<Document> clonedDoc = doc->CreateStaticClone(
|
||||
docShell, viewer, aPrintSettings, aOutHasInProcessPrintCallbacks);
|
||||
nsCOMPtr<Document> clonedDoc =
|
||||
doc->CreateStaticClone(docShell, viewer, aOutHasInProcessPrintCallbacks);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -153,11 +153,9 @@ 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,
|
||||
nsIPrintSettings* aPrintSettings);
|
||||
nsresult DoRemoteStaticClone(nsFrameLoader* aStaticCloneOf);
|
||||
|
||||
// WebIDL methods
|
||||
|
||||
|
|
|
@ -5375,8 +5375,8 @@ Nullable<WindowProxyHolder> nsGlobalWindowOuter::Print(
|
|||
AutoPrintEventDispatcher dispatcher(*docToPrint);
|
||||
|
||||
nsAutoScriptBlocker blockScripts;
|
||||
RefPtr<Document> clone = docToPrint->CreateStaticClone(
|
||||
cloneDocShell, cv, aPrintSettings, &hasPrintCallbacks);
|
||||
RefPtr<Document> clone =
|
||||
docToPrint->CreateStaticClone(cloneDocShell, cv, &hasPrintCallbacks);
|
||||
if (!clone) {
|
||||
aError.ThrowNotSupportedError("Clone operation for printing failed");
|
||||
return nullptr;
|
||||
|
|
|
@ -30,8 +30,6 @@
|
|||
#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"
|
||||
|
@ -1045,8 +1043,7 @@ mozilla::ipc::IPCResult BrowserChild::RecvResumeLoad(
|
|||
}
|
||||
|
||||
mozilla::ipc::IPCResult BrowserChild::RecvCloneDocumentTreeIntoSelf(
|
||||
const MaybeDiscarded<BrowsingContext>& aSourceBC,
|
||||
const embedding::PrintData& aPrintData) {
|
||||
const MaybeDiscarded<BrowsingContext>& aSourceBC) {
|
||||
if (NS_WARN_IF(aSourceBC.IsNullOrDiscarded())) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
@ -1066,75 +1063,26 @@ 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, printSettings,
|
||||
clone = sourceDocument->CreateStaticClone(ourDocShell, cv,
|
||||
&hasInProcessCallbacks);
|
||||
if (NS_WARN_IF(!clone)) {
|
||||
return IPC_OK();
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
// 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));
|
||||
}
|
||||
}
|
||||
|
||||
return IPC_OK();
|
||||
|
|
|
@ -270,14 +270,8 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
|
|||
mozilla::ipc::IPCResult RecvResumeLoad(const uint64_t& aPendingSwitchID,
|
||||
const ParentShowInfo&);
|
||||
|
||||
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);
|
||||
mozilla::ipc::IPCResult RecvCloneDocumentTreeIntoSelf(
|
||||
const MaybeDiscarded<BrowsingContext>& aSourceBC);
|
||||
|
||||
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, PrintData&& aPrintData) {
|
||||
const MaybeDiscarded<BrowsingContext>& aTarget) {
|
||||
if (aSource.IsNullOrDiscarded() || aTarget.IsNullOrDiscarded()) {
|
||||
return IPC_OK();
|
||||
}
|
||||
|
@ -3845,9 +3845,8 @@ mozilla::ipc::IPCResult ContentParent::RecvCloneDocumentTreeInto(
|
|||
target->ChangeRemoteness(options, /* aPendingSwitchId = */ 0)
|
||||
->Then(
|
||||
GetMainThreadSerialEventTarget(), __func__,
|
||||
[source = RefPtr{source},
|
||||
data = std::move(aPrintData)](BrowserParent* aBp) {
|
||||
Unused << aBp->SendCloneDocumentTreeIntoSelf(source, data);
|
||||
[source = RefPtr{source}](BrowserParent* aBp) {
|
||||
Unused << aBp->SendCloneDocumentTreeIntoSelf(source);
|
||||
},
|
||||
[](nsresult aRv) {
|
||||
NS_WARNING(
|
||||
|
@ -3857,22 +3856,6 @@ 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,10 +932,7 @@ class ContentParent final
|
|||
|
||||
mozilla::ipc::IPCResult RecvCloneDocumentTreeInto(
|
||||
const MaybeDiscarded<BrowsingContext>& aSource,
|
||||
const MaybeDiscarded<BrowsingContext>& aTarget, PrintData&& aPrintData);
|
||||
|
||||
mozilla::ipc::IPCResult RecvUpdateRemotePrintSettings(
|
||||
const MaybeDiscarded<BrowsingContext>& aTarget, PrintData&& aPrintData);
|
||||
const MaybeDiscarded<BrowsingContext>& aTarget);
|
||||
|
||||
mozilla::ipc::IPCResult RecvConstructPopupBrowser(
|
||||
ManagedEndpoint<PBrowserParent>&& actor,
|
||||
|
|
|
@ -583,8 +583,7 @@ child:
|
|||
async NativeSynthesisResponse(uint64_t aObserverId, nsCString aResponse);
|
||||
async UpdateEpoch(uint32_t aEpoch);
|
||||
async UpdateSHistory();
|
||||
async CloneDocumentTreeIntoSelf(MaybeDiscardedBrowsingContext aBc, PrintData aPrintData);
|
||||
async UpdateRemotePrintSettings(PrintData aPrintData);
|
||||
async CloneDocumentTreeIntoSelf(MaybeDiscardedBrowsingContext aBc);
|
||||
|
||||
/**
|
||||
* Parent informs the child to release all pointer capture.
|
||||
|
|
|
@ -49,7 +49,6 @@ include DOMTypes;
|
|||
include WindowGlobalTypes;
|
||||
include IPCBlob;
|
||||
include IPCStream;
|
||||
include PPrintingTypes;
|
||||
include PTabContext;
|
||||
include ProtocolTypes;
|
||||
include PBackgroundSharedTypes;
|
||||
|
@ -483,11 +482,7 @@ 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,
|
||||
PrintData aPrintData);
|
||||
|
||||
async UpdateRemotePrintSettings(MaybeDiscardedBrowsingContext aBc,
|
||||
PrintData aPrintData);
|
||||
MaybeDiscardedBrowsingContext aTargetBc);
|
||||
|
||||
async PExtensions();
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
#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"
|
||||
|
@ -784,9 +783,7 @@ 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);
|
||||
}
|
||||
|
||||
|
@ -2040,7 +2037,7 @@ nsDocumentViewer::Move(int32_t aX, int32_t aY) {
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocumentViewer::Show() {
|
||||
nsDocumentViewer::Show(void) {
|
||||
NS_ENSURE_TRUE(mDocument, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
// We don't need the previous viewer anymore since we're not
|
||||
|
@ -2154,7 +2151,7 @@ nsDocumentViewer::Show() {
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocumentViewer::Hide() {
|
||||
nsDocumentViewer::Hide(void) {
|
||||
if (!mAttachedToParent && mWindow) {
|
||||
mWindow->Show(false);
|
||||
}
|
||||
|
@ -2241,9 +2238,7 @@ nsDocumentViewer::ClearHistoryEntry() {
|
|||
|
||||
nsresult nsDocumentViewer::MakeWindow(const nsSize& aSize,
|
||||
nsView* aContainerView) {
|
||||
if (GetIsPrintPreview()) {
|
||||
return NS_OK;
|
||||
}
|
||||
if (GetIsPrintPreview()) return NS_OK;
|
||||
|
||||
bool shouldAttach = ShouldAttachToTopLevel();
|
||||
|
||||
|
@ -3494,52 +3489,6 @@ 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,7 +19,6 @@
|
|||
#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"
|
||||
|
@ -253,14 +252,6 @@ 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;
|
||||
}
|
||||
|
||||
|
@ -551,12 +542,6 @@ 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>();
|
||||
|
@ -586,6 +571,12 @@ 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);
|
||||
|
@ -784,7 +775,8 @@ nsresult nsPrintJob::DoCommonPrint(bool aIsPrintPreview,
|
|||
[self](nsresult aResult) { self->PageDone(aResult); });
|
||||
}
|
||||
|
||||
if (!StaticPrefs::print_tab_modal_enabled() && mIsCreatingPrintPreview) {
|
||||
if (!mozilla::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,9 +27,6 @@ using namespace mozilla::gfx;
|
|||
|
||||
NS_IMPL_ISUPPORTS(nsDeviceContextSpecProxy, nsIDeviceContextSpec)
|
||||
|
||||
nsDeviceContextSpecProxy::nsDeviceContextSpecProxy() = default;
|
||||
nsDeviceContextSpecProxy::~nsDeviceContextSpecProxy() = default;
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDeviceContextSpecProxy::Init(nsIWidget* aWidget,
|
||||
nsIPrintSettings* aPrintSettings,
|
||||
|
|
|
@ -52,10 +52,8 @@ class nsDeviceContextSpecProxy final : public nsIDeviceContextSpec {
|
|||
|
||||
NS_IMETHOD EndPage() final;
|
||||
|
||||
nsDeviceContextSpecProxy();
|
||||
|
||||
private:
|
||||
~nsDeviceContextSpecProxy();
|
||||
~nsDeviceContextSpecProxy() = default;
|
||||
|
||||
nsCOMPtr<nsIPrintSettings> mPrintSettings;
|
||||
nsCOMPtr<nsIPrintSession> mPrintSession;
|
||||
|
|
Загрузка…
Ссылка в новой задаче