зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1770211 p5 - Stop creating platform specific nsIDeviceContextSpec objects in content processes. r=bobowen
Depends on D146860 Differential Revision: https://phabricator.services.mozilla.com/D146861
This commit is contained in:
Родитель
756524dcd0
Коммит
1ebe0b7bcb
|
@ -131,7 +131,8 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
|
|||
mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{&kNS_SCREENMANAGER_CID, false, NULL, ScreenManagerConstructor,
|
||||
mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{&kNS_DEVICE_CONTEXT_SPEC_CID, false, NULL, nsDeviceContextSpecXConstructor},
|
||||
{&kNS_DEVICE_CONTEXT_SPEC_CID, false, NULL, nsDeviceContextSpecXConstructor,
|
||||
mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{&kNS_PRINTER_LIST_CID, false, NULL, nsPrinterListCUPSConstructor,
|
||||
mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{&kNS_PRINTSETTINGSSERVICE_CID, false, NULL, nsPrintSettingsServiceXConstructor},
|
||||
|
@ -161,7 +162,8 @@ static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
|
|||
{"@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID, mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{"@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID,
|
||||
mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{"@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID},
|
||||
{"@mozilla.org/gfx/devicecontextspec;1", &kNS_DEVICE_CONTEXT_SPEC_CID,
|
||||
mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{"@mozilla.org/gfx/printerlist;1", &kNS_PRINTER_LIST_CID, mozilla::Module::MAIN_PROCESS_ONLY},
|
||||
{"@mozilla.org/gfx/printsettings-service;1", &kNS_PRINTSETTINGSSERVICE_CID},
|
||||
{NS_PRINTDIALOGSERVICE_CONTRACTID, &kNS_PRINTDIALOGSERVICE_CID,
|
||||
|
|
|
@ -126,6 +126,7 @@ if defined('NS_PRINTING'):
|
|||
'contract_ids': ['@mozilla.org/gfx/devicecontextspec;1'],
|
||||
'type': 'nsDeviceContextSpecGTK',
|
||||
'headers': ['/widget/gtk/nsDeviceContextSpecG.h'],
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
},
|
||||
{
|
||||
'cid': '{06beec76-a183-4d9f-85dd-085f26da565a}',
|
||||
|
|
|
@ -35,19 +35,6 @@ NS_IMETHODIMP
|
|||
nsDeviceContextSpecProxy::Init(nsIWidget* aWidget,
|
||||
nsIPrintSettings* aPrintSettings,
|
||||
bool aIsPrintPreview) {
|
||||
nsresult rv;
|
||||
mRealDeviceContextSpec =
|
||||
do_CreateInstance("@mozilla.org/gfx/devicecontextspec;1", &rv);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
mRealDeviceContextSpec->Init(nullptr, aPrintSettings, aIsPrintPreview);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
mRealDeviceContextSpec = nullptr;
|
||||
return rv;
|
||||
}
|
||||
|
||||
mPrintSettings = aPrintSettings;
|
||||
|
||||
if (aIsPrintPreview) {
|
||||
|
@ -63,8 +50,6 @@ nsDeviceContextSpecProxy::Init(nsIWidget* aWidget,
|
|||
}
|
||||
|
||||
already_AddRefed<PrintTarget> nsDeviceContextSpecProxy::MakePrintTarget() {
|
||||
MOZ_ASSERT(mRealDeviceContextSpec);
|
||||
|
||||
double width, height;
|
||||
mPrintSettings->GetEffectiveSheetSize(&width, &height);
|
||||
if (width <= 0 || height <= 0) {
|
||||
|
@ -109,24 +94,6 @@ nsDeviceContextSpecProxy::GetDrawEventRecorder(
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
float nsDeviceContextSpecProxy::GetDPI() {
|
||||
MOZ_ASSERT(mRealDeviceContextSpec);
|
||||
|
||||
return mRealDeviceContextSpec->GetDPI();
|
||||
}
|
||||
|
||||
float nsDeviceContextSpecProxy::GetPrintingScale() {
|
||||
MOZ_ASSERT(mRealDeviceContextSpec);
|
||||
|
||||
return mRealDeviceContextSpec->GetPrintingScale();
|
||||
}
|
||||
|
||||
gfxPoint nsDeviceContextSpecProxy::GetPrintingTranslate() {
|
||||
MOZ_ASSERT(mRealDeviceContextSpec);
|
||||
|
||||
return mRealDeviceContextSpec->GetPrintingTranslate();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDeviceContextSpecProxy::BeginDocument(const nsAString& aTitle,
|
||||
const nsAString& aPrintToFileName,
|
||||
|
|
|
@ -37,12 +37,6 @@ class nsDeviceContextSpecProxy final : public nsIDeviceContextSpec {
|
|||
NS_IMETHOD GetDrawEventRecorder(
|
||||
mozilla::gfx::DrawEventRecorder** aDrawEventRecorder) final;
|
||||
|
||||
float GetDPI() final;
|
||||
|
||||
float GetPrintingScale() final;
|
||||
|
||||
gfxPoint GetPrintingTranslate() final;
|
||||
|
||||
NS_IMETHOD BeginDocument(const nsAString& aTitle,
|
||||
const nsAString& aPrintToFileName,
|
||||
int32_t aStartPage, int32_t aEndPage) final;
|
||||
|
@ -58,7 +52,6 @@ class nsDeviceContextSpecProxy final : public nsIDeviceContextSpec {
|
|||
private:
|
||||
~nsDeviceContextSpecProxy();
|
||||
|
||||
nsCOMPtr<nsIDeviceContextSpec> mRealDeviceContextSpec;
|
||||
RefPtr<RemotePrintJobChild> mRemotePrintJob;
|
||||
RefPtr<mozilla::layout::DrawEventRecorderPRFileDesc> mRecorder;
|
||||
};
|
||||
|
|
|
@ -59,25 +59,19 @@ class nsIDeviceContextSpec : public nsISupports {
|
|||
}
|
||||
|
||||
/**
|
||||
* Override to return something other than the default.
|
||||
*
|
||||
* @return DPI for printing.
|
||||
*/
|
||||
virtual float GetDPI() { return mozilla::StaticPrefs::print_default_dpi(); }
|
||||
float GetDPI() { return mozilla::StaticPrefs::print_default_dpi(); }
|
||||
|
||||
/**
|
||||
* Override to return something other than the default.
|
||||
*
|
||||
* @return the printing scale to be applied to the context for printing.
|
||||
*/
|
||||
virtual float GetPrintingScale();
|
||||
float GetPrintingScale();
|
||||
|
||||
/**
|
||||
* Override to return something other than the default.
|
||||
*
|
||||
* @return the point to translate the context to for printing.
|
||||
*/
|
||||
virtual gfxPoint GetPrintingTranslate();
|
||||
gfxPoint GetPrintingTranslate();
|
||||
|
||||
NS_IMETHOD BeginDocument(const nsAString& aTitle,
|
||||
const nsAString& aPrintToFileName,
|
||||
|
|
|
@ -188,6 +188,7 @@ if defined('NS_PRINTING'):
|
|||
'contract_ids': ['@mozilla.org/gfx/devicecontextspec;1'],
|
||||
'type': 'nsDeviceContextSpecWin',
|
||||
'headers': ['/widget/windows/nsDeviceContextSpecWin.h'],
|
||||
'processes': ProcessSelector.MAIN_PROCESS_ONLY,
|
||||
},
|
||||
{
|
||||
'cid': '{06beec76-a183-4d9f-85dd-085f26da565a}',
|
||||
|
|
Загрузка…
Ссылка в новой задаче