Commit Graph
128 Commits
Author SHA1 Message Date
Jonathan Kew 4deacd9237 Bug 1845837 - Sort Windows printer list alphabetically. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D184807
2023-07-28 15:35:29 +00:00
Emilio Cobos Álvarez dc7d643bc2 Bug 1810291 - Use fallible allocation in GetPrinterInfo4. r=bobowen
While such massive sizes are probably a bug in windows, we're already
dealing with failure gracefully, so no need to crash the parent process.

Differential Revision: https://phabricator.services.mozilla.com/D167931
2023-01-26 19:37:24 +00:00
David Shin 6bb4dad73b Bug 1785046 - Part 4: Use async move on printing to file on Windows. r=nika,emilio
Differential Revision: https://phabricator.services.mozilla.com/D163509
2022-12-19 15:42:49 +00:00
David Shin 1a90bf740e Bug 1785046 - Part 3: Let nsIDeviceContextSpec::EndDocument & nsDeviceContext::EndDocument return MozPromise. r=nika,emilio,geckoview-reviewers,m_kato
All implementors currently simply resolve the promise right away, using
crutch code. Asynchronous usage will be added in the changeset that follows.

Differential Revision: https://phabricator.services.mozilla.com/D163508
2022-12-19 15:42:48 +00:00
David Shin ea867453db Bug 1785046 - Part 1: Change Windows print file output to write to a temp file first, then move it. r=emilio,nika
Compared to other platforms, on "printing" PDF files, Windows writes straight
to the destination path. This causes the mainthread to become less responsive
if the path is slow (e.g. Network drive over VPN).

This still causes a mainthread block at the time the file is moved, but:
- Brings Windows' behaviour in line with other platforms
- Avoids `PrintTargetPDF` becoming async, which is less meaningful on
  other platforms
- Reduces the async site to one (i.e. moving to destination path)

Differential Revision: https://phabricator.services.mozilla.com/D163506
2022-12-19 15:42:46 +00:00
Emilio Cobos Álvarez 4ceef589a3 Bug 1800684 - Remove print_via_parent. r=dshin
For a while it was true everywhere but android, but it's been true
unconditionally since forever.

Differential Revision: https://phabricator.services.mozilla.com/D162116
2022-11-15 16:19:30 +00:00
Dmitrij Feller 26d5b8b017 Bug 370035 - Remove the aWidget parameter from nsIDeviceContextSpec::Init.r=spohl
Differential Revision: https://phabricator.services.mozilla.com/D145841
2022-05-23 19:34:40 +00:00
Jonathan Watt 4987b795d1 Bug 1770211 p4 - Move platform specific nsIDeviceContextSpec::GetPrintingScale/GetPrintingTranslate implementations up. r=bobowen
Depends on D146859

Differential Revision: https://phabricator.services.mozilla.com/D146860
2022-05-20 17:33:22 +00:00
Jonathan Watt f9ef36bae7 Bug 1770211 p3 - Move mPrintViaSkPDF up from nsIDeviceContextSpec's subclasses. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D146859
2022-05-20 17:33:22 +00:00
Jonathan Watt 3f54934df4 Bug 1770199 - Remove the nsDeviceContextSpecWin::GetDPI override. r=bobowen
The default value for the pref print.default_dpi in StaticPrefList.yaml is
already 144. Having this override simply prevents that pref from working on
Windows.

Differential Revision: https://phabricator.services.mozilla.com/D146828
2022-05-19 16:52:29 +00:00
Mike Hommey 23680a25fd Bug 1766561 - Add missing l modifier for long formatting. r=Jamie,media-playback-reviewers,gfx-reviewers,nika,necko-reviewers,mhowell,rkraesig,gerald,application-update-reviewers,bytesized,alwu,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D144917
2022-05-03 20:49:08 +00:00
Mike Hommey 45b9f403ab Bug 1766561 - Use %lu for Windows Error types (DWORD). r=rkraesig,xpcom-reviewers,application-update-reviewers,mhowell,bobowen,necko-reviewers,keeler,media-playback-reviewers,bytesized,barret,alwu,kershaw
Differential Revision: https://phabricator.services.mozilla.com/D144914
2022-05-03 20:49:07 +00:00
Emilio Cobos Álvarez 202fcd0999 Bug 1760836 - Support printing to an nsIOutputStream. r=jfkthame,jrmuizel,webdriver-reviewers,geckoview-reviewers,agi
The trickiest bits are the PrintTargetCG ones, the rest is just plumbing
and cleanups and tests, but let me know if you want those to be split
out, can do.

The GTK change to nsPrintSettingsGTK::GetResolution is a no-op (we only
read resolution on windows), but I did that because we assume that it
doesn't fail and GTK returns a sane default anyways.

Differential Revision: https://phabricator.services.mozilla.com/D142199
2022-03-30 18:51:58 +00:00
Iulian Moraru 7106f0368c Backed out changeset d42d7505c9cf (bug 1760836) for causing mochitest failures on browser_print_stream.js. CLOSED TREE 2022-03-29 23:32:39 +03:00
Emilio Cobos Álvarez 2ee3ba7653 Bug 1760836 - Support printing to an nsIOutputStream. r=jfkthame,jrmuizel,webdriver-reviewers,geckoview-reviewers,agi
The trickiest bits are the PrintTargetCG ones, the rest is just plumbing
and cleanups and tests, but let me know if you want those to be split
out, can do.

The GTK change to nsPrintSettingsGTK::GetResolution is a no-op (we only
read resolution on windows), but I did that because we assume that it
doesn't fail and GTK returns a sane default anyways.

Differential Revision: https://phabricator.services.mozilla.com/D142199
2022-03-29 17:50:58 +00:00
Emilio Cobos Álvarez 518c095aeb Bug 1712130 - Make print.print_via_parent a static pref. r=layout-reviewers,jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D115612
2021-05-20 17:05:33 +00:00
Daniel Holbert a4a44f58a3 Bug 1699343: Adjust nsPrinterListWin::SystemDefaultPrinterName to make it infallible, like its CUPS-backed eqivalent. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D109172
2021-03-20 04:41:58 +00:00
Mats Palmgren 925174e044 Bug 1689789 part 2 - Use Ceil instead of Truncate the ensure the print surface is large enough for the requested paper size. r=jfkthame
Also, for GTK, request the paper size in millimeter for
millimeter based paper units to avoid depending on GTK's
rounding behavior.

Differential Revision: https://phabricator.services.mozilla.com/D103609
2021-02-06 00:28:29 +00:00
Daniel Holbert f190e410a2 Bug 1669905 part 2: Add nsIPrintSettings APIs to handle the possibility that pages and sheets may have orthogonal orientation, in pages-per-sheet printouts. r=jfkthame
This patch does three things, all centered around these new APIs:

 (1) Add the APIs themselves -- some nsIPrintSettings methods to reason about
the sheet-orientation being potentially flipped to accomodate 2 and 6
pages-per-sheet.

 (2) Use these new APIs, where appropriate, in places where we previously used
the page-orientation to set up the platform-native print-settings objects and
print-target. Now, we'll use the *sheet* orientation instead of the page
orientation, to be sure we produce the appropriately-oriented platform-native
surfaces.  Also, for symmetry, this patch adds similar logic to the reverse
codepaths, where we update an existing nsIPrintSettings object based on a
platform-native print-settings object.

 (3) Update nsPrintJob's code that informs nsPresContext about the page-size.
This patch makes sure that this code uses the *page* size, rather than the
*sheet* size, in cases where they differ.  (The code that consumes this
nsPresContext::GetPageSize API, e.g. our CSS media-query code, really does want
the page size, not the sheet size.)

Differential Revision: https://phabricator.services.mozilla.com/D100372
2021-01-05 02:24:00 +00:00
Simon Giesecke 46908cfb51 Bug 1660470 - Add missing include directives/forward declarations. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D87865
2020-11-23 16:21:38 +00:00
Emily McDonough dbbdfe5709 Bug 1667486 part 2 - Use our own localization for nsPrinterCUPS paper sizes when possible r=emilio
This should be able to avoid creating a printer-specific HTTP connection in
nsPrinterCUPS::DefaultSettings when the paper size is a PWG-recognized size.

The current maximum error when comparing paper sizes is 4 points. This may need
to be revised later.

Differential Revision: https://phabricator.services.mozilla.com/D91497
2020-10-13 21:52:04 +00:00
Jonathan Watt 0eb06c9ddf Bug 1668301. Merge the 'printing-widget' NSPR module into the 'printing' module. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D91949
2020-09-30 16:36:29 +00:00
Simon Giesecke ab6f0a7137 Bug 1650145 - Replace all value uses of Empty[C]String by 0-length _ns literals. r=froydnj,geckoview-reviewers,agi
Differential Revision: https://phabricator.services.mozilla.com/D82325
2020-09-23 15:17:15 +00:00
Jonathan Kew 84ae2b3405 Bug 1665272 - Don't attempt to call OpenPrinter on network printers when collecting the printer list. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D90858
2020-09-21 13:51:10 +00:00
Emily McDonough 8a4720bb6e Bug 1659807 - Add nsIPrinter.systemName and nsIPrinterList.getPrinterBySystemName r=emilio
This also renames nsIPrinterList.getNamedPrinter to nsIPrinter.getPrinterByName
for consistency.

This is cheaper to lookup on platforms that use CUPS and do not show the Unix
name for printers. This only applies to OS X at the present.

Differential Revision: https://phabricator.services.mozilla.com/D90201
2020-09-15 21:23:27 +00:00
Bob Owen 84875a0900 Bug 1665007: Double the memory we allow for DeviceCapabilities arrays for safety. r=jfkthame
This also doubles the memory we allocate for DEVMODEs, when that value has been
returned from the other uses of DocumentProperties, because apparently some
drivers do not return the correct size.

Differential Revision: https://phabricator.services.mozilla.com/D90251
2020-09-15 15:05:52 +00:00
Jonathan Kew 4b201d2c45 Bug 1663494 - Filter out inaccessible printers from the printer list on Windows. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D90091
2020-09-14 16:14:21 +00:00
Emilio Cobos Álvarez 4e708655d7 Bug 1664258 - Increase the default PDF resolution for non-windows platforms. r=jwatt
I've tested both webpage printing and pdf printing, in both the new UI
and the system dialog, and this gives consistently better results,
specially when images are involved.

I've put the exact DPI value on a pref because I think that's the
sensible thing to do, and allows us to test higher resolutions too.

Differential Revision: https://phabricator.services.mozilla.com/D89805
2020-09-11 11:37:40 +00:00
Emilio Cobos Alvarez 64a72a1f7b Bug 1659470 - Handle printing with an empty file name in nsDeviceContextSpecWin. r=jwatt
Ideally print preview and co. shouldn't need a PrintTarget at all, I'd think...
Though that's a bigger refactoring.

Differential Revision: https://phabricator.services.mozilla.com/D89452
2020-09-10 17:25:21 +00:00
Jonathan Kew 675b38f307 Bug 1659527 - Correct scaling for Save to PDF output on Windows to reflect DPI setting. r=jwatt,emilio
Differential Revision: https://phabricator.services.mozilla.com/D89605
2020-09-09 14:12:58 +00:00
Jonathan Kew 6d57b8a36a Bug 1662820 - Use a higher nominal DPI for the device context when generating PDF, to reduce unwanted device-pixel-snapping effects. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D89286
2020-09-04 15:21:24 +00:00
Jonathan Kew a666c43683 Bug 1658300 - Implement NamedPrinter() for nsPrinterListWin, and remove the base implementation. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D87450
2020-08-20 11:21:34 +00:00
Emily McDonoughandJonathan Kew 3b7d4b07a4 Bug 1658300 - Implement a promise-based nsIPrinterList::getNamedOrDefaultPrinter. r=jwatt,emilio
This only works for CUPS, and will do nothing on Windows yet.

Co-Authored-By: Jonathan Kew <[email protected]>

Differential Revision: https://phabricator.services.mozilla.com/D86851
2020-08-20 11:59:46 +00:00
Emilio Cobos Álvarez 6a46071a1a Bug 1658220 - Workaround old gcc which bogusly warns about hiding overloaded functions with different arguments by renaming a function.
MANUAL PUSH: Fix base toolchain build on a CLOSED TREE.
2020-08-10 01:34:04 +02:00
Emilio Cobos Álvarez f88dd96efe Bug 1657363 - Make nsIPrinterList.printers return a promise. r=jwatt
I intentionally removed the "move the default printer to the front" in
windows because that's not a guarantee that we provide in CUPS, but lmk
if you want it back.

I have zero idea about why the GlobalPrinters code was so ridiculously
complex.

Depends on D86396

Differential Revision: https://phabricator.services.mozilla.com/D86397
2020-08-09 22:05:57 +00:00
Jonathan Kew de35faa951 Bug 1656733 - Reimplement EnumerateNativePrinters (and GetDefaultPrinterName) in widget/windows code to use proper Win32 APIs. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D86019
2020-08-07 14:33:41 +00:00
Emilio Cobos Álvarez eb8c32b90c Bug 1657874 - Unify printer list implementations between Mac and GTK, and add nsPrinterListBase. r=jwatt
nsPrinterListBase is where the CC setup and promises and such will be, I
think.

Differential Revision: https://phabricator.services.mozilla.com/D86336
2020-08-07 12:04:26 +00:00
Emilio Cobos ÁlvarezandJonathan Watt 4c9ac50688 Bug 1656146 - Introduce nsPrinterBase, and add facilities for async attributes queried in a background thread. r=heycam
While at it, properly CC the printer classes, as they're going to hold
promises and it's very easy to introduce leaks otherwise.

Co-Authored-By: Jonathan Watt <[email protected]>

Differential Revision: https://phabricator.services.mozilla.com/D85791
2020-08-04 12:06:37 +00:00
Bob Owen 31d497432c Bug 1631465 part 4: Add unwritable margin information for Windows. r=jwatt
This includes adding nsPrinterWin and nsPaperWin, so that we can retrieve
information from the printer device lazily.

Differential Revision: https://phabricator.services.mozilla.com/D84009
2020-07-22 15:12:02 +00:00
Emily McDonough 3a3856deda Bug 1631465 part 1 - Add unwritable margin information to nsIPaper r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D83387
2020-07-15 18:38:08 +00:00
Bob Owen 44efdff056 Bug 1650886 Part 4: Expose Paper Sizes for Windows. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D83503
2020-07-14 18:40:23 +00:00
Erik Nordin dac38231ca Bug 1650886 - Part 1 nsIPaper Base Implementation r=jwatt
- Add `nsIPaper` interface.
- Add `nsIPaper` implementaiton.

Differential Revision: https://phabricator.services.mozilla.com/D82461
2020-07-13 19:59:26 +00:00
Butkovits Atila 7cbb4dd891 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)
2020-07-13 22:15:01 +03:00
Erik Nordin e20aba6c81 Bug 1650886 - Part 1 nsIPaper Base Implementation r=jwatt
- Add `nsIPaper` interface.
- Add `nsIPaper` implementaiton.

Differential Revision: https://phabricator.services.mozilla.com/D82461
2020-07-13 17:17:29 +00:00
Razvan Maries d2763faf8e Backed out 2 changesets (bug 1650886) for leakcheck failures.
Backed out changeset e2485d1bb142 (bug 1650886)
Backed out changeset ed8db2a54c61 (bug 1650886)
2020-07-12 00:01:04 +03:00
Erik Nordin fc68d5666a Bug 1650886 - Part 1 nsIPaper Base Implementation r=jwatt
- Add `nsIPaper` interface.
- Add `nsIPaper` implementaiton.

Differential Revision: https://phabricator.services.mozilla.com/D82461
2020-07-11 18:18:18 +00:00
Erik Nordin 1207b88682 Bug 1651532 - Change systemDefaultPrinter to systemDefaultPrinterName r=jwatt
The `systemDefaultPrinter` attribute in `nsIPrinterList` currently has
only one usage: to retrieve the printer's name. This patch changes the
attribute to be the name instead of the whole printer until such
funcationality is needed.

Differential Revision: https://phabricator.services.mozilla.com/D82951
2020-07-10 19:00:17 +00:00
Erik Nordin b2475426fd Bug 1647480 - Refactor Printer Enumeration to Use nsIPrinter r=jwatt
- Add new interface for `nsIPrinter`.
- Add readonly attribute for printer name.
- Add implementation of interface: `nsPrinter`.
- Rename `nsIPrinterEnumerator` to `nsIPrinterList`.
- Refactor `nsIPrinterList` to use `nsIPrinter`.

Differential Revision: https://phabricator.services.mozilla.com/D81414
2020-07-05 19:00:43 +00:00
Simon Giesecke a69d79b6db Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING macros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80860
2020-07-01 08:29:29 +00:00
Jonathan Watt a3e3733708 Bug 1646093. Modify printing telemetry to add a PDF-catch-all for possible unknown PDF printers. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D79853
2020-06-17 00:09:05 +00:00