diff --git a/layout/printing/nsPrintEngine.cpp b/layout/printing/nsPrintEngine.cpp index 794291c7013..bd0d647e33f 100644 --- a/layout/printing/nsPrintEngine.cpp +++ b/layout/printing/nsPrintEngine.cpp @@ -75,6 +75,7 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro #include "nsISelectionController.h" // Misc +#include "mozilla/gfx/DrawEventRecorder.h" #include "mozilla/layout/RemotePrintJobChild.h" #include "nsISupportsUtils.h" #include "nsIScriptContext.h" @@ -91,6 +92,7 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro #include "nsWidgetsCID.h" #include "nsIDeviceContextSpec.h" +#include "nsDeviceContextSpecProxy.h" #include "nsViewManager.h" #include "nsView.h" #include "nsRenderingContext.h" @@ -569,9 +571,13 @@ nsPrintEngine::DoCommonPrint(bool aIsPrintPreview, mPrt->mPrintSettings->SetPrintOptions(nsIPrintSettings::kEnableSelectionRB, isSelection || mPrt->mIsIFrameSelected); - nsCOMPtr devspec - (do_CreateInstance("@mozilla.org/gfx/devicecontextspec;1", &rv)); - NS_ENSURE_SUCCESS(rv, rv); + nsCOMPtr devspec; + if (XRE_IsContentProcess() && Preferences::GetBool("print.print_via_parent")) { + devspec = new nsDeviceContextSpecProxy(); + } else { + devspec = do_CreateInstance("@mozilla.org/gfx/devicecontextspec;1", &rv); + NS_ENSURE_SUCCESS(rv, rv); + } nsScriptSuppressor scriptSuppressor(this); if (!aIsPrintPreview) { diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index d2d7d54fcaf..90cce286cfe 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -1004,6 +1004,9 @@ pref("print.print_edge_left", 0); pref("print.print_edge_right", 0); pref("print.print_edge_bottom", 0); +// Print via the parent process. This is only used when e10s is enabled. +pref("print.print_via_parent", false); + // Pref used by the spellchecker extension to control the // maximum number of misspelled words that will be underlined // in a document. diff --git a/widget/moz.build b/widget/moz.build index 1773b57135d..4b70a7768d9 100644 --- a/widget/moz.build +++ b/widget/moz.build @@ -95,6 +95,7 @@ EXPORTS += [ 'InputData.h', 'nsBaseScreen.h', 'nsBaseWidget.h', + 'nsDeviceContextSpecProxy.h', 'nsIDeviceContextSpec.h', 'nsIPluginWidget.h', 'nsIRollupListener.h',