зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1650886) for causing bustage at Unified_cpp_widget_windows1.obj. CLOSED TREE
Backed out changeset de485a27b337 (bug 1650886) Backed out changeset f65d2491cbb4 (bug 1650886)
This commit is contained in:
Родитель
7dfca9db55
Коммит
fa8b334372
|
@ -72,7 +72,6 @@ skip-if = (verify && (os == 'win'))
|
|||
[test_scrolling_repaints.html]
|
||||
[test_will_change.html]
|
||||
skip-if = webrender
|
||||
[test_get_printer_paper_sizes.html]
|
||||
[test_getClientRectsAndTexts.html]
|
||||
[test_css_visibility_propagation.xhtml]
|
||||
support-files =
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
</head>
|
||||
<body onload="run()">
|
||||
<script type="application/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function run() {
|
||||
try {
|
||||
let printerList = Cc["@mozilla.org/gfx/printerlist;1"].getService(
|
||||
Ci.nsIPrinterList
|
||||
);
|
||||
if (printerList.printers.length == 0) {
|
||||
ok(true, "There were no printers to iterate through.");
|
||||
}
|
||||
printerList.printers.forEach(printer => {
|
||||
isnot(printer.name, null, "Printer name should never be null.");
|
||||
isnot(printer.name, "", "Printer name should never be empty.");
|
||||
printer.paperList.forEach(paper => {
|
||||
isnot(paper.name, null, "Paper name should never be null.");
|
||||
isnot(paper.name, "", "Paper name should never be empty.");
|
||||
|
||||
isnot(paper.width, null, "Paper width should never be null.");
|
||||
ok(paper.width > 0.0, "Paper width should be greater than zero.");
|
||||
|
||||
isnot(paper.height, null, "Paper height should never be null.");
|
||||
ok(paper.height > 0.0, "Paper height should be greater than zero.");
|
||||
});
|
||||
})
|
||||
} catch (e) {
|
||||
Cu.reportError(e);
|
||||
}
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -22,7 +22,6 @@
|
|||
#include "nsCRT.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsILocalFileMac.h"
|
||||
#include "nsPaper.h"
|
||||
#include "nsPrinter.h"
|
||||
#include "nsPrintSettingsX.h"
|
||||
#include "nsQueryObject.h"
|
||||
|
@ -42,65 +41,6 @@ using mozilla::gfx::SurfaceFormat;
|
|||
|
||||
static LazyLogModule sDeviceContextSpecXLog("DeviceContextSpecX");
|
||||
|
||||
/**
|
||||
* Retrieves the list of available paper options for a given printer name.
|
||||
*/
|
||||
static nsresult FillPaperListForPrinter(PMPrinter aPrinter,
|
||||
nsTArray<RefPtr<nsIPaper>>& aPaperList) {
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
CFArrayRef pmPaperList;
|
||||
aPaperList.ClearAndRetainStorage();
|
||||
OSStatus status = PMPrinterGetPaperList(aPrinter, &pmPaperList);
|
||||
if (status != noErr || !pmPaperList) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
CFIndex paperCount = CFArrayGetCount(pmPaperList);
|
||||
aPaperList.SetCapacity(paperCount);
|
||||
|
||||
for (auto i = 0; i < paperCount; ++i) {
|
||||
PMPaper pmPaper =
|
||||
static_cast<PMPaper>(const_cast<void*>(CFArrayGetValueAtIndex(pmPaperList, i)));
|
||||
|
||||
// The units for width and height are points.
|
||||
double width = 0.0;
|
||||
double height = 0.0;
|
||||
CFStringRef pmPaperName;
|
||||
if (PMPaperGetWidth(pmPaper, &width) != noErr || PMPaperGetHeight(pmPaper, &height) != noErr ||
|
||||
PMPaperCreateLocalizedName(pmPaper, aPrinter, &pmPaperName) != noErr) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
nsAutoString name;
|
||||
nsCocoaUtils::GetStringForNSString(static_cast<NSString*>(pmPaperName), name);
|
||||
|
||||
aPaperList.AppendElement(new nsPaper(name, width, height));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
|
||||
}
|
||||
|
||||
nsresult CreatePrinter(PMPrinter aPMPrinter, nsIPrinter** aPrinter) {
|
||||
NS_ENSURE_ARG_POINTER(aPrinter);
|
||||
*aPrinter = nullptr;
|
||||
|
||||
nsAutoString printerName;
|
||||
NSString* name = static_cast<NSString*>(PMPrinterGetName(aPMPrinter));
|
||||
nsCocoaUtils::GetStringForNSString(name, printerName);
|
||||
|
||||
nsTArray<RefPtr<nsIPaper>> paperList;
|
||||
nsresult rv = FillPaperListForPrinter(aPMPrinter, paperList);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
*aPrinter = new nsPrinter(printerName, paperList);
|
||||
NS_ADDREF(*aPrinter);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// nsPrinterListX
|
||||
|
||||
|
@ -128,17 +68,13 @@ nsPrinterListX::GetPrinters(nsTArray<RefPtr<nsIPrinter>>& aPrinters) {
|
|||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
aPrinters.Clear();
|
||||
CFArrayRef pmPrinterList;
|
||||
OSStatus status = PMServerCreatePrinterList(kPMServerLocal, &pmPrinterList);
|
||||
NS_ENSURE_TRUE(status == noErr && pmPrinterList, NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE);
|
||||
|
||||
const CFIndex printerCount = CFArrayGetCount(pmPrinterList);
|
||||
for (auto i = 0; i < printerCount; ++i) {
|
||||
PMPrinter pmPrinter =
|
||||
static_cast<PMPrinter>(const_cast<void*>(CFArrayGetValueAtIndex(pmPrinterList, i)));
|
||||
RefPtr<nsIPrinter> printer;
|
||||
nsresult rv = CreatePrinter(pmPrinter, getter_AddRefs(printer));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NSArray<NSString*>* printerNames = [NSPrinter printerNames];
|
||||
size_t printerCount = [printerNames count];
|
||||
for (size_t i = 0; i < printerCount; ++i) {
|
||||
NSString* name = [printerNames objectAtIndex:i];
|
||||
nsAutoString printerName;
|
||||
nsCocoaUtils::GetStringForNSString(name, printerName);
|
||||
RefPtr<nsIPrinter> printer = new nsPrinter(printerName);
|
||||
aPrinters.AppendElement(std::move(printer));
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "nsReadableUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
#include "nsPaper.h"
|
||||
#include "nsPrinter.h"
|
||||
#include "nsPSPrinters.h"
|
||||
|
||||
|
@ -364,8 +363,8 @@ nsPrinterListGTK::GetPrinters(nsTArray<RefPtr<nsIPrinter>>& aPrinters) {
|
|||
uint32_t numPrinters = GlobalPrinters::GetInstance()->GetNumPrinters();
|
||||
for (uint32_t i = 0; i < numPrinters; ++i) {
|
||||
nsString* name = GlobalPrinters::GetInstance()->GetStringAt(i);
|
||||
nsTArray<RefPtr<nsIPaper>> paperList;
|
||||
aPrinters.AppendElement(new nsPrinter(*name, paperList));
|
||||
RefPtr<nsIPrinter> printer = new nsPrinter(*name);
|
||||
aPrinters.AppendElement(std::move(printer));
|
||||
}
|
||||
GlobalPrinters::GetInstance()->FreeGlobalPrinters();
|
||||
|
||||
|
|
|
@ -111,7 +111,6 @@ XPIDL_SOURCES += [
|
|||
'nsIGfxInfoDebug.idl',
|
||||
'nsIIdleService.idl',
|
||||
'nsIIdleServiceInternal.idl',
|
||||
'nsIPaper.idl',
|
||||
'nsIPrinter.idl',
|
||||
'nsIPrinterList.idl',
|
||||
'nsIPrintSession.idl',
|
||||
|
@ -144,7 +143,6 @@ EXPORTS += [
|
|||
'nsIRollupListener.h',
|
||||
'nsIWidget.h',
|
||||
'nsIWidgetListener.h',
|
||||
'nsPaper.h',
|
||||
'nsPrinter.h',
|
||||
'nsWidgetInitData.h',
|
||||
'nsWidgetsCID.h',
|
||||
|
@ -208,7 +206,6 @@ UNIFIED_SOURCES += [
|
|||
'nsIdleService.cpp',
|
||||
'nsIWidgetListener.cpp',
|
||||
'nsNativeBasicTheme.cpp',
|
||||
'nsPaper.cpp',
|
||||
'nsPrimitiveHelpers.cpp',
|
||||
'nsPrinter.cpp',
|
||||
'nsPrintSettingsImpl.cpp',
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(a4dd9675-6311-45a9-a547-44e0127304a6)]
|
||||
interface nsIPaper : nsISupports
|
||||
{
|
||||
/**
|
||||
* The name of the paper.
|
||||
*/
|
||||
readonly attribute AString name;
|
||||
|
||||
/**
|
||||
* The width of the paper in points.
|
||||
*/
|
||||
readonly attribute double width;
|
||||
|
||||
/**
|
||||
* The height of the paper in points.
|
||||
*/
|
||||
readonly attribute double height;
|
||||
};
|
|
@ -3,7 +3,6 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsIPaper.idl"
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(d2dde9bb-df86-469c-bfcc-fd95a44b1db8)]
|
||||
|
@ -13,9 +12,4 @@ interface nsIPrinter : nsISupports
|
|||
* The name of the printer.
|
||||
*/
|
||||
readonly attribute AString name;
|
||||
|
||||
/**
|
||||
* The list of available paper sizes.
|
||||
*/
|
||||
readonly attribute Array<nsIPaper> paperList;
|
||||
};
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsPaper.h"
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsPaper, nsIPaper);
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPaper::GetName(nsAString& aName) {
|
||||
aName = mName;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPaper::GetWidth(double* aWidth) {
|
||||
NS_ENSURE_ARG_POINTER(aWidth);
|
||||
*aWidth = mWidth;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPaper::GetHeight(double* aHeight) {
|
||||
NS_ENSURE_ARG_POINTER(aHeight);
|
||||
*aHeight = mHeight;
|
||||
return NS_OK;
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsPaper_h__
|
||||
#define nsPaper_h__
|
||||
|
||||
#include "nsIPaper.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsPaper final : public nsIPaper {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPAPER
|
||||
nsPaper() = delete;
|
||||
nsPaper(const nsAString& aName, double aWidth, double aHeight)
|
||||
: mName(aName), mWidth(aWidth), mHeight(aHeight) {}
|
||||
|
||||
private:
|
||||
~nsPaper() = default;
|
||||
|
||||
nsString mName;
|
||||
double mWidth;
|
||||
double mHeight;
|
||||
};
|
||||
|
||||
#endif /* nsPaper_h__ */
|
|
@ -5,10 +5,6 @@
|
|||
|
||||
#include "nsPrinter.h"
|
||||
|
||||
nsPrinter::nsPrinter(const nsAString& aName,
|
||||
const nsTArray<RefPtr<nsIPaper>>& aPaperList)
|
||||
: mName(aName), mPaperList(aPaperList.Clone()) {}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsPrinter, nsIPrinter);
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -16,9 +12,3 @@ nsPrinter::GetName(nsAString& aName) {
|
|||
aName = mName;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPrinter::GetPaperList(nsTArray<RefPtr<nsIPaper>>& aPaperList) {
|
||||
aPaperList.Assign(mPaperList);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -6,24 +6,19 @@
|
|||
#ifndef nsPrinter_h__
|
||||
#define nsPrinter_h__
|
||||
|
||||
#include "nsIPaper.h"
|
||||
#include "nsIPrinter.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsPrinter final : public nsIPrinter {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPRINTER
|
||||
nsPrinter() = delete;
|
||||
nsPrinter(const nsAString& aName,
|
||||
const nsTArray<RefPtr<nsIPaper>>& aPaperList);
|
||||
explicit nsPrinter(nsAString& aName) : mName(aName) {}
|
||||
|
||||
private:
|
||||
~nsPrinter() = default;
|
||||
|
||||
nsString mName;
|
||||
nsTArray<RefPtr<nsIPaper>> mPaperList;
|
||||
~nsPrinter() = default;
|
||||
};
|
||||
|
||||
#endif /* nsPrinter_h__ */
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
#include "nsTArray.h"
|
||||
#include "nsIPrintSettingsWin.h"
|
||||
|
||||
#include "nsPaper.h"
|
||||
#include "nsPrinter.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsString.h"
|
||||
|
@ -512,10 +511,6 @@ nsresult nsDeviceContextSpecWin::GetDataFromPrinter(const nsAString& aName,
|
|||
// Printer List
|
||||
//***********************************************************
|
||||
|
||||
nsPrinterListWin::~nsPrinterListWin() {
|
||||
GlobalPrinters::GetInstance()->FreeGlobalPrinters();
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsPrinterListWin, nsIPrinterList)
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -600,14 +595,17 @@ nsPrinterListWin::GetPrinters(nsTArray<RefPtr<nsIPrinter>>& aPrinters) {
|
|||
}
|
||||
|
||||
uint32_t numPrinters = GlobalPrinters::GetInstance()->GetNumPrinters();
|
||||
nsTArray<nsString>* printers = new nsTArray<nsString>(numPrinters);
|
||||
if (!printers) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
for (uint32_t printerInx = 0; printerInx < numPrinters; ++printerInx) {
|
||||
LPWSTR name = GlobalPrinters::GetInstance()->GetItemFromList(printerInx);
|
||||
// wchar_t (used in LPWSTR) is 16 bits on Windows.
|
||||
// https://docs.microsoft.com/en-us/cpp/cpp/char-wchar-t-char16-t-char32-t?view=vs-2019
|
||||
LPWSTR name = GlobalPrinters::GetInstance()->GetItemFromList(printerInx);
|
||||
nsAutoString printerName;
|
||||
printerName.Assign(name);
|
||||
nsTArray<RefPtr<nsIPaper>> paperList;
|
||||
aPrinters.AppendElement(new nsPrinter(printerName, paperList));
|
||||
RefPtr<nsIPrinter> printer = new nsPrinter(printerName);
|
||||
aPrinters.AppendElement(std::move(printer));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -88,6 +88,9 @@ class nsPrinterListWin final : public nsIPrinterList {
|
|||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPRINTERLIST
|
||||
nsPrinterListWin() = default;
|
||||
|
||||
private:
|
||||
~nsPrinterListWin() = default;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче