Граф коммитов

85 Коммитов

Автор SHA1 Сообщение Дата
Fred Chasen 42c8df00ac Bug 1793220 - Use at-page size rule as paper size when printing to PDF r=dholbert,AlaskanEmily
Adds a usePageRuleSizeAsPaperSize setting to allow overriding the default paper size when printing to a PDF file.

Print preview now checks for at-page size rules and when enabled will use that size for the previewed sheet of paper.

The preview will also return the page width and height (in inches) during its callback for the frontend to use to override the default paper settings.

Differential Revision: https://phabricator.services.mozilla.com/D160303
2023-02-27 20:22:18 +00:00
Emilio Cobos Álvarez 368171d435 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
Jonathan Watt 2b527f4d33 Bug 1755153 p2 - Prevent saving print settings to prefs if print.save_print_settings=false. r=emilio
Depends on D146943

Differential Revision: https://phabricator.services.mozilla.com/D146944
2022-10-30 10:32:28 +00:00
Jonathan Watt 17f8eb8dec Bug 1755153 p1 - Centralize saving of last used printer name. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D146943
2022-10-30 10:32:28 +00:00
David Shin 05f999536d Bug 1681183: Ignore unwriteable margins user specifies `Margins: None` for printing. r=dholbert,mstriemer
This lets users e.g. print-to-scale where it matters.
Custom margins are still clamped to unwriteable margins, even when all zeroes,
to avoid impacting user-specified & persisted margins.

Differential Revision: https://phabricator.services.mozilla.com/D152900
2022-08-15 19:55:08 +00:00
Jonathan Watt c0ea877a65 Bug 1749598 p1 - Stop reading the last used printer name in content processes. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D150098
2022-07-18 14:34:27 +00:00
Jonathan Watt ca15f68e8a Bug 1754308 p2 - Stop sending nsIPrintSettings.printerName to content processes. r=bobowen
This avoids exposing printer names to potentially compromised content processes.

The changes in bug 1770211 mean that we no longer create platform specific
nsIDeviceContextSpec instances in the content process, so we no longer need
the printer name to instantiate an nsDeviceContextSpecWin there.

Differential Revision: https://phabricator.services.mozilla.com/D146868
2022-05-20 22:51:00 +00:00
Jonathan Watt 43e1613319 Bug 1754308 p1 - Stop sending nsIPrintSettings.toFileName to content processes. r=bobowen
This avoids exposing the path to potentially compromised content processes.

The roundtripping of the toFileName value from RemotePrintJobParent's
mPrintSettings to the content process and then back to
RemotePrintJobParent::InitializePrintDevice was silly anyway.

Differential Revision: https://phabricator.services.mozilla.com/D146867
2022-05-20 22:50:59 +00:00
Jonathan Watt 6e5bce1349 Bug 1769388 - Change nsIPrintSettingsService's 'newPrintSettings' attribute to a 'createNewPrintSettings' function. r=bobowen,webdriver-reviewers,whimboo
Having an attribute be a constructor is just...wrong.

Differential Revision: https://phabricator.services.mozilla.com/D146383
2022-05-16 11:50:34 +00:00
Jonathan Watt 247babb515 Bug 1432651 p2 - Remove nsIPrintSession and all the code that uses it. r=emilio,geckoview-reviewers,m_kato
Lately nsIPrintSession was only used to pass around RemotePrintJobChild objects.
Now that we pass those objects explicitly where needed (part 1), this class
serves no purpose.

Another reason to want to get rid of this class is that having it as a member
of nsIPrintSettings made no sense and was confusing.

Differential Revision: https://phabricator.services.mozilla.com/D146381
2022-05-16 08:38:02 +00:00
Jonathan Watt 702df2639c Bug 1769129. Remove nsIPrintSettings.isPrintSelectionRBEnabled. r=emilio
nsIPrintSettings is supposed to be a collection of settings passed to the
platform code to determine how the document prints. The
isPrintSelectionRBEnabled member doesn't belong here since it is a flag that
is passed to the OS native print settings dialog to tell it whether to
display a "Print selection only" radio button.

Depends on D146232

Differential Revision: https://phabricator.services.mozilla.com/D146251
2022-05-13 15:26:07 +00:00
Daniel Holbert 50464c1e32 Bug 1765059: Stop storing/reading the print resolution in about:config pref. r=bobowen
This per-printer "print_resolution" about:config pref (which ends up in
nsPrintSettings 'mResolution' member-var) is never exposed in UI, and it's
almost entirely unused.  For the usages that do exist (usages of
nsPrintSettings::mResolution), we potentially do the wrong thing when the value
comes from an about:config pref, as described in this bug.  These usages scale
the printed output *as if we're printing to a printer with the given
resolution*, though of course we have no guarantee of this being the printer's
actual resolution, when this value comes from about:config prefs.

After this patch, nsPrintSettings will simply use the value that we actually
get from the printer, instead of this potentially-bogus value from
about:config.  This will avoid the scaling issues described in this bug.

Differential Revision: https://phabricator.services.mozilla.com/D146261
2022-05-13 15:00:29 +00:00
Cristian Tuns fd0c1d6b99 Backed out changeset 00ef44ea9e3f (bug 1769129) for causing build bustages on nsPrintDialogX.mm CLOSED TREE 2022-05-13 08:20:12 -04:00
Jonathan Watt d362d859ac Bug 1769129. Remove nsIPrintSettings.isPrintSelectionRBEnabled. r=emilio
nsIPrintSettings is supposed to be a collection of settings passed to the
platform code to determine how the document prints. The
isPrintSelectionRBEnabled member doesn't belong here since it is a flag that
is passed to the OS native print settings dialog to tell it whether to
display a "Print selection only" radio button.

Differential Revision: https://phabricator.services.mozilla.com/D146251
2022-05-13 11:57:08 +00:00
Jonathan Watt f2a529bd7b Bug 1766651 - Remove nsIPrintSettings.isCancelled and nsIPrintSettings.saveOnCancel. r=bobowen
nsIPrintSettings.isCancelled was only being set to true by the Windows widget
code ShowNativePrintDialog nowadays. That seems pointless since that widget
code is only invoked under the _showPrintDialog call in print.js, and in the
case that the widget code throws, the print is never invoked and the
nsIPrintSettings object isn't used.

nsIPrintSettings.saveOnCancel was set in some places but never read.

Differential Revision: https://phabricator.services.mozilla.com/D144830
2022-04-27 17:55:24 +00:00
Jonathan Watt ea773f7d3c Bug 1763989. Remove the PPrinting and nsPrintingProxy code. r=bobowen
Bug 1757395 basically removed the reason for PPrinting to exist. What remained
essentially just added an unnecessary layer of complexity/indirection to the
creation of PRmotePrintJob actors.

Differential Revision: https://phabricator.services.mozilla.com/D143330
2022-04-26 14:30:29 +00:00
Jonathan Watt b876849eb8 Bug 1668210. Prevent print settings being saved to unprefixed prefs on non-Android. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D91907
2022-04-04 19:42:35 +00:00
Emilio Cobos Álvarez 7e23a4287f 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 7a3ed2ce2a 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 b0fb172236 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
Jonathan Watt 300fb860be Bug 1756447 - Remove the code supporting saving print setting from the content process. r=bobowen,ipc-reviewers,mccr8
Differential Revision: https://phabricator.services.mozilla.com/D139292
2022-02-27 23:45:56 +00:00
Jonathan Watt ac90ddff59 Bug 1745452 - Remove the print progress dialog code. r=mstriemer,bobowen,webdriver-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D133500
2021-12-16 15:12:33 +00:00
Butkovits Atila 7d46682c0e Backed out changeset 51d7c5d96ceb (bug 1745452) for causing failures at browser_all_files_referenced.js. CLOSED TREE 2021-12-16 15:13:34 +02:00
Jonathan Watt f2d22001b0 Bug 1745452 - Remove the print progress dialog code. r=mstriemer,bobowen,webdriver-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D133500
2021-12-16 11:45:59 +00:00
Bob Owen c105e16a8d Bug 1669149 p6: Change print settings stored as floats to be stored as doubles. r=jwatt
This more precisely matches what we get from the printer and use in layout.

Depends on D99808

Differential Revision: https://phabricator.services.mozilla.com/D99810
2021-11-16 08:17:04 +00:00
Bob Owen 571f1db901 Bug 1669149 p5: Make nsPrintSettingsService::ReadPrefs return NS_ERROR_NOT_AVAILABLE, not NS_OK, if no prefs are read. r=jwatt
This allows us to detect if any prefs were read in JavaScript.

Depends on D99807

Differential Revision: https://phabricator.services.mozilla.com/D99808
2021-11-16 08:17:04 +00:00
Bob Owen 773d934c75 Bug 1669149 p4: Change unwriteable margin pref to be stored in twips. r=jwatt
This means that more precise values can be stored, so that they match what we
actually retrieve from the printer and use in layout.

Depends on D99806

Differential Revision: https://phabricator.services.mozilla.com/D99807
2021-11-16 08:17:04 +00:00
Emilio Cobos Álvarez d455c7de64 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
Emilio Cobos Álvarez 95e40970cd Bug 1692845 - Restore read from global print settings for a few settings, including print_bgcolor and print_bgimages. r=bobowen
These were lost in bug 1667953, but I don't think print_bgimages /
print_bgcolor should be printer-specific only.

Differential Revision: https://phabricator.services.mozilla.com/D105465
2021-02-23 10:52:53 +00:00
Bob Owen 45aa80a96d Bug 1682877: Only send the RemotePrintJob to the parent in PrintData for SendShowPrintDialog. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D102463
2021-01-22 15:04:39 +00:00
Butkovits Atila 4d521226ef Backed out changeset f8e28ebbdaa0 (bug 1675720) for causing failures on browser_system_dialog_subdialog_hidden.js. CLOSED TREE 2021-01-13 03:00:31 +02:00
Erik Nordin 979cf92582 Bug 1675720 - Fix print_to_filename prefs for Linux system dialog r=emilio
This patch ensures that the global print_to_filename pref is checked
when initializing print settings from prefs.

It also fixes a regression which was preventing the Linux system dialog
from correctly reading its printer-specific print_to_filename prefs.

Differential Revision: https://phabricator.services.mozilla.com/D98975
2021-01-12 22:08:21 +00:00
Mark Striemer 8a4e6bf3a5 Bug 1673713 - Part 1: Serialize the numPagesPerSheet property r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D95334
2020-11-30 22:46:23 +00:00
Simon Giesecke 971b645fe3 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
Emilio Cobos Álvarez 771dd03229 Bug 1669854 - Add a single pageRanges print setting. r=nordzilla
... which is an array of pairs of ranges, and use it instead of the
existing printRange / startPage / endPage settings.

Differential Revision: https://phabricator.services.mozilla.com/D96093
2020-11-07 16:01:57 +00:00
Jonathan Kew f2b9ae0184 Bug 1667053 - Refactor macOS print settings implementation for clarity. r=jwatt
Rather than wrapping an NSPrintInfo in nsPrintSettingsX, where we then have two
(potentially conflicting) sources of truth about various settings, we treat the
settings in the base nsPrintInfo class as authoritative, and just apply them to
a temporary NSPrintInfo when needed to interact with platform APIs.

Differential Revision: https://phabricator.services.mozilla.com/D92966
2020-10-23 11:07:21 +00:00
Bob Owen e4f458e04e Bug 1672370: Revert paper size pref validation back to checking for either being less than 100 inches. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D94341
2020-10-22 08:13:35 +00:00
Daniel Holbert 675e1e5b28 Bug 1669409: Convert the nsIPrintSettings:kEnableSelectionRB flag into a boolean, since it's the only entry in a bitfield. r=jwatt,emilio
This was the last flag that the PrintOptions bitfield was tracking.

So, this patch is effectively converting that bitfield (and its alias
"PrintOptionsBits") into a new, simpler boolean field named
"isPrintSelectionRBEnabled".

Differential Revision: https://phabricator.services.mozilla.com/D92542
2020-10-07 00:36:51 +00:00
Daniel Holbert 63230729cd Bug 1669375 part 2: Remove code that partially implemented the "print only even/odd pages" feature. r=jwatt
This code looked like it might work, but it seems to have only ever been backed
by per-printer about:config prefs.  I believe we only ever exposed UI for this
feature on Linux, via the native GTK dialog; and even there, the UI doesn't
actually seem to have done anything -- it was never wired up to the actual
implementation of even/odd page-skipping.

Differential Revision: https://phabricator.services.mozilla.com/D92528
2020-10-06 15:33:29 +00:00
Jonathan Watt c3bb0ca8ef Bug 1669370. Purge the worst/most obvious cases of corrupt/invalid printing prefs. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D92520
2020-10-06 00:35:40 +00:00
Emilio Cobos Álvarez 941e868780 Bug 1668767 - Make "print selection" setting independent of page range. r=jfkthame
It conceptually is, and this will allow to have UI independent of the
page range in bug 140718.

Differential Revision: https://phabricator.services.mozilla.com/D92201
2020-10-02 13:59:48 +00:00
Bob Owen 922f287afd Bug 1668492: Stop using locale based decimals when saving printing prefs. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D92099
2020-10-01 17:55:01 +00:00
Emilio Cobos Álvarez b94fd775e1 Bug 1668406 - Fix nsIPrintSettings.showMarginGuides. r=jfkthame
So that:

 * It accounts for @page.
 * It is correctly serialized and deserialized over IPC.
 * It's nicer to use.

Depends on D92004

Differential Revision: https://phabricator.services.mozilla.com/D92005
2020-10-01 10:54:18 +00:00
Emilio Cobos Álvarez fbd95bb29e Bug 1668406 - Introduce nsIPrintSettings.honorPageRuleMargins. r=jfkthame
(Doing the obvious)

This should allow the front-end to expose it in one way or another in
bug 1661663.

Differential Revision: https://phabricator.services.mozilla.com/D92004
2020-10-01 13:18:01 +00:00
Jonathan Watt 568f31deea Bug 1668296. Remove a bunch of DEBUG_rods code. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D91939
2020-09-30 15:54:30 +00:00
Jonathan Watt 1890bfffde Bug 1667265. Remove nsIPrintSettingsService.globalPrintSettings. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D91366
2020-09-30 12:25:02 +00:00
Csoregi Natalia b3bc0b7401 Backed out changeset 0028834844d2 (bug 1668210) for web platform failures on delayed_window_print.html. CLOSED TREE 2020-09-30 14:37:59 +03:00
Jonathan Watt 85b74a2951 Bug 1668210. Prevent print settings being saved to unprefixed prefs on non-Android. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D91907
2020-09-30 09:36:40 +00:00
Jonathan Watt 3f30f74084 Bug 1667953 p1. Stop reading printer specific settings from global prefs. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D91819
2020-09-29 18:51:35 +00:00
Jonathan Watt d5de56ef43 Bug 1667285. Make nsPrintSettingsService::_CreatePrintSettings pure virtual. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D91377
2020-09-25 09:33:14 +00:00