Commit Graph

104 Commits

Author SHA1 Message Date
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 McDonough
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 <jkew@mozilla.com>

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 Álvarez
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 <jwatt@jwatt.org>

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
Narcis Beleuzu
5dec750969 Backed out changeset c456cb4b4047 (bug 1646093) for bustages on nsDeviceContextSpecWin.cpp . CLOSED TREE 2020-06-16 20:49:32 +03:00
Jonathan Watt
fdb740ea86 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-16 16:58:10 +00:00
Jonathan Watt
13380a63be Bug 1600623. Add telemetry probes for print dialog/preview opens/cancels and print target type. r=bobowen,mbalfanz
The probes collect counts for:

 - print preview open, and exit without print
 - print dialog opened from print preview, and cancelled
 - print dialog opened without print preview, and cancelled
 - silent prints
 - print target
   - PDF file
   - XPS file
   - other (probably print to physical printer, but we can never be sure)

There is some overlap with the existing PRINT_* probes, but I think we should
keep those in place temporarily until we confirm that the new probes produce
numbers that are consistent with the old probes.

This patch only adds 'print target' probes for Windows and macOS.

I use nsDeviceContextSpec*::Init() to collect the 'print target' telemetry
because the way we initialize settings from prefs (and the way macOS works in
particular) make it difficult to reliably determine the target type earlier in
the print process for all possible entry points into the printing code.

Differential Revision: https://phabricator.services.mozilla.com/D78033
2020-06-03 21:21:14 +00:00
Bob Owen
90b6b2bb21 Bug 1627577 part 2: Fix assertion in nsDeviceContextSpecWin::MakePrintTarget. r=jwatt
Depends on D73095

Differential Revision: https://phabricator.services.mozilla.com/D73096
2020-05-22 12:27:09 +00:00
Gabriele Svelto
f03cdb2b2d Bug 1600545 - Remove useless inclusions of header files generated from IDL files in modules/, netwerk/, parser/, security/, startupcache/, storage/, toolkit/, tools/, uriloader/, widget/, xpcom/ and xpfe/ r=Ehsan
The inclusions were removed with the following very crude script and the
resulting breakage was fixed up by hand. The manual fixups did either
revert the changes done by the script, replace a generic header with a more
specific one or replace a header with a forward declaration.

find . -name "*.idl" | grep -v web-platform | grep -v third_party | while read path; do
    interfaces=$(grep "^\(class\|interface\).*:.*" "$path" | cut -d' ' -f2)
    if [ -n "$interfaces" ]; then
        if [[ "$interfaces" == *$'\n'* ]]; then
          regexp="\("
          for i in $interfaces; do regexp="$regexp$i\|"; done
          regexp="${regexp%%\\\|}\)"
        else
          regexp="$interfaces"
        fi
        interface=$(basename "$path")
        rg -l "#include.*${interface%%.idl}.h" . | while read path2; do
            hits=$(grep -v "#include.*${interface%%.idl}.h" "$path2" | grep -c "$regexp" )
            if [ $hits -eq 0 ]; then
                echo "Removing ${interface} from ${path2}"
                grep -v "#include.*${interface%%.idl}.h" "$path2" > "$path2".tmp
                mv -f "$path2".tmp "$path2"
            fi
        done
    fi
done

Differential Revision: https://phabricator.services.mozilla.com/D55444
2019-12-06 09:17:57 +00:00
Gabriele Svelto
652cb568da Bug 1585156 - Remove useless inclusions of nsIDOMWindow.h and nsIDOMWindowUtils.h r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D47678
2019-09-30 22:06:47 +00:00
Ehsan Akhgari
498e2df734 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
# ignore-this-changeset
2019-01-18 10:16:18 +01:00
Sylvestre Ledru
e5a134f73a Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset
2018-11-30 11:46:48 +01:00
Gabriele Svelto
7e234e998c Bug 1510582 - Remove useless inclusions of Services.h r=erahm
Differential Revision: https://phabricator.services.mozilla.com/D13240
2018-11-28 17:25:23 +00:00
Emilio Cobos Álvarez
4b8b5e1717 Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj
This was done automatically replacing:

  s/mozilla::Move/std::move/
  s/ Move(/ std::move(/
  s/(Move(/(std::move(/

Removing the 'using mozilla::Move;' lines.

And then with a few manual fixups, see the bug for the split series..

MozReview-Commit-ID: Jxze3adipUh
2018-06-01 10:45:27 +02:00
Brendan Dahl
f0ed4840a3 Bug 221706 - Use unwritable region when printing on Windows. r=jimm
Read more information from the printing device to setup the unwritable region.
Translate the printing context's coordinate system so that the point (0,0)
refers to the top-left of the physical paper instead of the top-left of the
printable region.

MozReview-Commit-ID: 9ei2FgEUDyO
2018-03-28 17:13:10 -07:00
cku
a7e3ea2c93 Bug 1427109 - Initialize mPrintViaSkPDF as false to guarantee PrintTargetEMF is used only if 'print.print_via_pdf_encoder == skia-pdf'. r=jwatt
MozReview-Commit-ID: 950x2vDfF17
2018-01-09 16:44:36 +08:00
cku
c87761aa2e Bug 1399787 - Part 11.d. Using PrintTargetEMF on windows if skia-pdf is enable. r=jwatt
MozReview-Commit-ID: Hx94fqGJFz6
2017-11-14 13:57:11 +08:00
cku
1674672dc4 Bug 1399787 - Part 4. Take out the code we landed in bug 1370488. r=jwatt
To move EMF conversion job to a dedicated process, I will implement a new
PrintTarget subclass, named PrintTargetEMF, to coordinate tasks among the
content process, chrome process and PDFium process. All the code that we
change in nsDeviceContextSpecWin is no longer needed.

MozReview-Commit-ID: GgKZoB92WYE
2017-11-05 00:53:05 +08:00
cku
415572b105 Bug 1399787 - Part 1. Fix namespacing and include issues hidden by unified compilation. r=jwatt
We will create several new files in the following patches for IPC and a new
subprocess. Several already existed files will be shifted into new build units,
we will meet several compile errors because of it.

This patch fixes those compile error in advance.

MozReview-Commit-ID: 5hd0sNYfBu0
2017-10-06 22:01:22 +08:00
Cosmin Sabou
b72a6b5a25 Backed out 22 changesets (bug 1399787) for shutdown leaks on windows 7 debug tc-M without e10s r=backout on a CLOSED TREE
Backed out changeset 463d676df5da (bug 1399787)
Backed out changeset fc9776a2605d (bug 1399787)
Backed out changeset 2e91a90dfbc3 (bug 1399787)
Backed out changeset e82ab72f71ee (bug 1399787)
Backed out changeset d7fef200e8b9 (bug 1399787)
Backed out changeset a7d70f7f3335 (bug 1399787)
Backed out changeset 2800f9d20d96 (bug 1399787)
Backed out changeset 9dfa404abf9d (bug 1399787)
Backed out changeset 09b3c172a01e (bug 1399787)
Backed out changeset f9fd3e750636 (bug 1399787)
Backed out changeset 01284c55bf8a (bug 1399787)
Backed out changeset c2ab1b454283 (bug 1399787)
Backed out changeset e7bfa51404c5 (bug 1399787)
Backed out changeset 3fd2a734f887 (bug 1399787)
Backed out changeset ef21f295db3f (bug 1399787)
Backed out changeset c186893ce0fc (bug 1399787)
Backed out changeset 323da3bddaaa (bug 1399787)
Backed out changeset 3b89f189edff (bug 1399787)
Backed out changeset a47bd86c35ee (bug 1399787)
Backed out changeset 558526301a4c (bug 1399787)
Backed out changeset baa99fb50ba9 (bug 1399787)
Backed out changeset 6d82ed0ba805 (bug 1399787)
2017-12-08 13:09:56 +02:00
cku
95c2b2f1b8 Bug 1399787 - Part 11.d. Using PrintTargetEMF on windows if skia-pdf is enable. r=jwatt
MozReview-Commit-ID: Hx94fqGJFz6
2017-11-14 13:57:11 +08:00
cku
771f591985 Bug 1399787 - Part 4. Take out the code we landed in bug 1370488. r=jwatt
To move EMF conversion job to a dedicated process, I will implement a new
PrintTarget subclass, named PrintTargetEMF, to coordinate tasks among the
content process, chrome process and PDFium process. All the code that we
change in nsDeviceContextSpecWin is no longer needed.

MozReview-Commit-ID: GgKZoB92WYE
2017-11-05 00:53:05 +08:00
cku
c3da51fb27 Bug 1399787 - Part 1. Fix namespacing and include issues hidden by unified compilation. r=jwatt
We will create several new files in the following patches for IPC and a new
subprocess. Several already existed files will be shifted into new build units,
we will meet several compile errors because of it.

This patch fixes those compile error in advance.

MozReview-Commit-ID: 5hd0sNYfBu0
2017-10-06 22:01:22 +08:00
Bogdan Tara
6958db442b Backed out 22 changesets (bug 1399787) for failing on mozmake.EXE r=backout a=backout on a CLOSED TREE
Backed out changeset 0afbd07d8219 (bug 1399787)
Backed out changeset 80c062fd58fb (bug 1399787)
Backed out changeset b1457eabd34e (bug 1399787)
Backed out changeset d875e45f591e (bug 1399787)
Backed out changeset 8f600ac930ec (bug 1399787)
Backed out changeset c478fb75f5cb (bug 1399787)
Backed out changeset c995f4e18724 (bug 1399787)
Backed out changeset 0b75ef19e695 (bug 1399787)
Backed out changeset 2382a348a6c1 (bug 1399787)
Backed out changeset 93f9a5e253d8 (bug 1399787)
Backed out changeset 5c50bbde0950 (bug 1399787)
Backed out changeset 67e530c129c7 (bug 1399787)
Backed out changeset 682c60e52749 (bug 1399787)
Backed out changeset ff1436ae1ef7 (bug 1399787)
Backed out changeset cb3ae1dc20b2 (bug 1399787)
Backed out changeset bc52b1781641 (bug 1399787)
Backed out changeset d165846cb5e1 (bug 1399787)
Backed out changeset 185368267354 (bug 1399787)
Backed out changeset c385d0f60f8a (bug 1399787)
Backed out changeset 364b5b44932b (bug 1399787)
Backed out changeset 98758e79710d (bug 1399787)
Backed out changeset d56497aa5390 (bug 1399787)
2017-12-07 19:16:08 +02:00
cku
b902460426 Bug 1399787 - Part 11.d. Using PrintTargetEMF on windows if skia-pdf is enable. r=jwatt
MozReview-Commit-ID: Hx94fqGJFz6
2017-11-14 13:57:11 +08:00
cku
0373cf555a Bug 1399787 - Part 4. Take out the code we landed in bug 1370488. r=jwatt
To move EMF conversion job to a dedicated process, I will implement a new
PrintTarget subclass, named PrintTargetEMF, to coordinate tasks among the
content process, chrome process and PDFium process. All the code that we
change in nsDeviceContextSpecWin is no longer needed.

MozReview-Commit-ID: GgKZoB92WYE
2017-11-05 00:53:05 +08:00
cku
2be1f3dd77 Bug 1399787 - Part 1. Fix namespacing and include issues hidden by unified compilation. r=jwatt
We will create several new files in the following patches for IPC and a new
subprocess. Several already existed files will be shifted into new build units,
we will meet several compile errors because of it.

This patch fixes those compile error in advance.

MozReview-Commit-ID: 5hd0sNYfBu0
2017-10-06 22:01:22 +08:00
Nicholas Nethercote
d5b5ca8771 Bug 1407103 - Convert wstring attributes to AString in widget/nsIPrint*.idl. r=bobowen.
This avoids a lot of mismatches between nsAString and char16_t*, thus removing
many getter_Copies() and ToNewUnicode() and get() calls, and generally making
things simpler.

Note: the patch removes GetDefaultPrinterNameFromGlobalPrinters() by simply
inlining it at its two callsites, which is easy with the changed types.
2017-10-09 10:08:09 +11:00