Commit Graph

814 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
51af54fe65 Bug 1774378 - Make select code harder to mess up. r=Gijs
Right now we rely on the menulist to be injected by hand in all the
relevant windows. Instead create it lazily, making the select code more
standalone.

The DevTools window was missing it, for example.

Differential Revision: https://phabricator.services.mozilla.com/D149620
2022-06-21 21:42:58 +00:00
Sam Foster
d48c41ef34 Bug 1771313 - Add an opaque background behind the print preview paginator buttons. r=mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D148865
2022-06-15 21:24:36 +00:00
Emilio Cobos Álvarez
0ec6b77907 Bug 1752379 - Don't hide margins / headers settings on PDF printing. r=mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D147308
2022-05-27 09:24:03 +00:00
Jonathan Watt
b677f00ccc 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
Hanna Jones
602ce39e22 Bug 1756169 - Set print margins to 'None' when defaults are invalid r=mstriemer
For smaller paper sizes (e.g. label maker sized paper) it's possible that the defaut margins will be too large, wich results in non-obvious error state for the print dialog. In this case we want to fall back to using "None" margins to ensure the form is valid/printing is still possible.

Differential Revision: https://phabricator.services.mozilla.com/D142889
2022-05-13 18:19:32 +00:00
Jonathan Watt
e336997b9a 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
Cristian Tuns
cebb65e9b3 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
7509ece9d9 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
f6c122e1d0 Bug 1769113 - Kill off nsIPrintingPromptService and use nsIPrintDialogService directly. r=emilio
nsIPrintingPromptService comes from an era when the platform print code would
open the print settings dialog, which defaulted to the OS native dialogs.
Its purpose was to allow that dialog to be overridden by embedders to provide
their own interface for the user to select print settings. Nowadays the
platform print code does not open the dialogs. Instead apps like Firefox are
responsible for getting the print settings to pass to the platform code, and
the platform code provides a way to open the OS native print dialog if they
want to use that (nsIPrintDialogService). So nsIPrintingPromptService no longer
has any purpose, and just adds indirection and needless complexity.

Differential Revision: https://phabricator.services.mozilla.com/D146232
2022-05-13 11:20:59 +00:00
Jonathan Watt
9fe04ae6d6 Bug 1769132 - Fix "Print selection only" when pref 'print.prefer_system_dialog' is set to true. r=mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D146249
2022-05-12 20:59:24 +00:00
Jonathan Watt
343324b433 Bug 1712104 p2 - Support printing directly via the system print dialog. r=emilio
This is behind the bool pref print.prefer_system_dialog

Differential Revision: https://phabricator.services.mozilla.com/D135452
2022-05-06 14:30:25 +00:00
Jonathan Watt
bd8604a213 Bug 1712104 p1 - Refactor PrintUtils.startPrintWindow for easier reasoning. r=emilio,webdriver-reviewers
Having the called-back-for-new-static-doc logic mixed in with the
start-new-print logic was confusing. The new structure, function names
and comments should hopefully make it easier for people unfamiliar with the
various printing code flows to understand and reason about this code. It also
allows the addition of new print-via-system-dialog logic without things getting
completely out of hand.

Differential Revision: https://phabricator.services.mozilla.com/D135451
2022-05-06 14:30:24 +00:00
Emilio Cobos Álvarez
9b7168fafd Bug 1765076 - Use in-content styles for page setup dialog. r=mstriemer
These look much nicer, and support dark mode.

Depends on D143903

Differential Revision: https://phabricator.services.mozilla.com/D143904
2022-04-30 21:49:42 +00:00
Emilio Cobos Álvarez
29e6512b14 Bug 1762921 - Add a bit more slop on a test for non-macOS platforms.
Differential Revision: https://phabricator.services.mozilla.com/D142920
2022-04-05 10:30:44 +00:00
Emilio Cobos Álvarez
4305bfb027 Bug 1762293 - Deal with one-byte size difference seen on automation.
Differential Revision: https://phabricator.services.mozilla.com/D142548
2022-03-31 13:26:50 +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
a0341155da Bug 1752298 - Ensure clone documents always have the same doc base URI as the src documents. r=smaug
This is important for srcdoc iframes printed from window.print().

Unlike for bug 1710822, there's no awesome way to test this using WPT.

Differential Revision: https://phabricator.services.mozilla.com/D137135
2022-01-27 17:36:07 +00:00
Emilio Cobos Álvarez
64175b6c73 Bug 1744009 - Simplify combobox <select> code. r=mconley,dholbert
With this patch on its own we get some a11y tests failures, but those
are fixed on a later patch.

Combobox select no longer creates frames for its <options>, nor an
nsListControlFrame. Instead, it computes its right intrinsic size using
the largest size of the options. This is better, because we render the
option text using the select style so if the select and option styles
are mismatched it'd cause changes in the size of the select when text
changes. See the following in a build without the patch, for example:

  <select>
    <option>ABC</option>
    <option style="font-size: 1px">Something long</option>
  </select>

This seems like a rather obscure case, but it's important to get it
right, see bug 1741888.

With this patch we use the same setup in content and parent processes
(this needs bug 1596852 and bug 1744152). This means we can remove a
bunch of the native view and popup code in nsListControlFrame. A couple
browser_* tests are affected by this change and have been tweaked
appropriately (the changes there are trivial).

Not creating an nsListControlFrame for dropdown select means that we
need to move a bunch of the event handling code from nsListControlFrame
to a common place that nsComboboxControlFrame can also use. That place
is HTMLSelectEventListener, and I think the setup is much nicer than
having the code intertwined with nsListControlFrame. It should be
relatively straight-forward to review, mostly moving code from one part
to another.

Another thing that we need to do in HTMLSelectEventListener that we
didn't use to do is listening for DOM mutations on the dropdown. Before,
we were relying on changes like text mutations triggering a reflow of
the listcontrolframe, which also triggered a reflow of the
comboboxcontrolframe, which in turn updated the text of the anonymous
content. Now we need to trigger that reflow manually.

There are some further simplifications that can be done after this
lands (cleanup naming of openInParentProcess and so on, among others),
but I'd rather land this first (after the merge of course) and work on
them separately.

Differential Revision: https://phabricator.services.mozilla.com/D132719
2022-01-17 11:10:05 +00:00
Marian-Vasile Laza
84e23c5194 Backed out 2 changesets (bug 1744009) for causing reftest failures on select-3.html.
Backed out changeset 3e44e31d3d12 (bug 1744009)
Backed out changeset 619389788775 (bug 1744009)
2022-01-17 11:14:27 +02:00
Emilio Cobos Álvarez
d4e563138d Bug 1744009 - Simplify combobox <select> code. r=mconley,dholbert
With this patch on its own we get some a11y tests failures, but those
are fixed on a later patch.

Combobox select no longer creates frames for its <options>, nor an
nsListControlFrame. Instead, it computes its right intrinsic size using
the largest size of the options. This is better, because we render the
option text using the select style so if the select and option styles
are mismatched it'd cause changes in the size of the select when text
changes. See the following in a build without the patch, for example:

  <select>
    <option>ABC</option>
    <option style="font-size: 1px">Something long</option>
  </select>

This seems like a rather obscure case, but it's important to get it
right, see bug 1741888.

With this patch we use the same setup in content and parent processes
(this needs bug 1596852 and bug 1744152). This means we can remove a
bunch of the native view and popup code in nsListControlFrame. A couple
browser_* tests are affected by this change and have been tweaked
appropriately (the changes there are trivial).

Not creating an nsListControlFrame for dropdown select means that we
need to move a bunch of the event handling code from nsListControlFrame
to a common place that nsComboboxControlFrame can also use. That place
is HTMLSelectEventListener, and I think the setup is much nicer than
having the code intertwined with nsListControlFrame. It should be
relatively straight-forward to review, mostly moving code from one part
to another.

Another thing that we need to do in HTMLSelectEventListener that we
didn't use to do is listening for DOM mutations on the dropdown. Before,
we were relying on changes like text mutations triggering a reflow of
the listcontrolframe, which also triggered a reflow of the
comboboxcontrolframe, which in turn updated the text of the anonymous
content. Now we need to trigger that reflow manually.

There are some further simplifications that can be done after this
lands (cleanup naming of openInParentProcess and so on, among others),
but I'd rather land this first (after the merge of course) and work on
them separately.

Differential Revision: https://phabricator.services.mozilla.com/D132719
2022-01-16 23:31:22 +00:00
Jonathan Watt
6a014e32da Bug 1749018 - Roll PrintUtils._setPrinterDefaultsForSelectedPrinter into its sole caller. r=mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D135355
2022-01-07 17:13:09 +00:00
Jonathan Watt
2fcd3c5856 Bug 1749016. Update Page Setup menu code in printUtils.js to reflect removal of the Print Preview menu. r=mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D135351
2022-01-07 17:13:08 +00:00
Jonathan Watt
30c88a278d Bug 1749014 - Remove some unused printUtils.js code and a test. r=mstriemer
We don't "pass" print settings to the content process by saving them to prefs,
so the test is no longer useful (this removes the code it's testing anyway).

Differential Revision: https://phabricator.services.mozilla.com/D135349
2022-01-07 17:13:08 +00:00
Jonathan Watt
79109555b9 Bug 1702501 - Remove print.tab_modal.enabled pref and old frontend print preview code. r=mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D134699
2022-01-06 18:55:38 +00:00
Jonathan Watt
4bd6fa9eb2 Bug 1741698 - Fix silent printing for both window.print() and print to file. r=emilio
Printing was failing for silent window.print() printing because we need a
RemotePrintJobChild. The content process side of the print now asks the parent
process to send a valid nsIPrintSettings object and a RemotePrintJobChild
before it starts printing.

Printing was also failing for silent print-to-file printing in the case that
the user omits to set the `printer.print_to_filename` pref. That was because
we weren't setting a fallback value for nsIPrintSettings.toFileName.

Differential Revision: https://phabricator.services.mozilla.com/D134799
2022-01-02 13:05:54 +00:00
criss
694ce29c46 Backed out changeset 8105d0c98b35 (bug 1741698) for causing wpt failures on Devices-without-focus.https.html. CLOSED TREE 2021-12-31 23:10:31 +02:00
Jonathan Watt
31bf88a168 Bug 1741698 - Fix silent printing for both window.print() and print to file. r=emilio
Printing was failing for silent window.print() printing because we need a
RemotePrintJobChild. The content process side of the print now asks the parent
process to send a valid nsIPrintSettings object and a RemotePrintJobChild
before it starts printing.

Printing was also failing for silent print-to-file printing in the case that
the user omits to set the `printer.print_to_filename` pref. That was because
we weren't setting a fallback value for nsIPrintSettings.toFileName.

Differential Revision: https://phabricator.services.mozilla.com/D134799
2021-12-31 14:50:35 +00:00
Jonathan Watt
d70db9baf8 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
6c14d03852 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
260ef48d25 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
Jonathan Watt
c1297c6a6c Bug 1745325 - Remove unnecessary setting of print.tab_modal.enabled=true in tests. r=hiro
Differential Revision: https://phabricator.services.mozilla.com/D133449
2021-12-10 22:56:09 +00:00
Jonathan Watt
ed0cb1a544 Bug 1745294 - Remove browser_preview_print_simplify_non_article.js. r=mstriemer
This test is for the old printing UI, and the equivalent test for the new UI
already exists at toolkit/components/printing/tests/browser_print_simplified_mode.js

Differential Revision: https://phabricator.services.mozilla.com/D133428
2021-12-10 22:24:52 +00:00
Jonathan Watt
b6020fabcd Bug 1745290 - Remove browser_preview_switch_print_selected.js. r=mstriemer
This test is for the old printing UI, and the equivalent test for the new UI
already exists at toolkit/components/printing/tests/browser_print_simplified_mode.js

Differential Revision: https://phabricator.services.mozilla.com/D133427
2021-12-10 20:57:15 +00:00
Jonathan Watt
614ba9d91d Bug 1745465 - Add a pref to enable the Page Setup menu. r=mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D133502
2021-12-10 19:02:48 +00:00
Jonathan Watt
42f2f30052 Bug 1745301 - Remove the old UI tests from browser_preview_print_coop.js. r=mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D133431
2021-12-10 16:16:35 +00:00
Jonathan Watt
066f861c60 Bug 1745319 - Remove toolkit/components/printing/tests/browser_page_change_print_original.js. r=mstriemer
This test checks that the underlying page can navigate and the print preview
document will not start previewing the new underlying document when settings
change. But that's not how the new print UI works. In the new print UI we
cancel the print preview if the document navigates, and we have other tests
for that.

Differential Revision: https://phabricator.services.mozilla.com/D133436
2021-12-10 16:06:29 +00:00
Iulian Moraru
bfa41f4b1b Backed out changeset 01eb21de6aef (bug 1745325) for causing mochitest failures on browser_preview_print_coop.js. CLOSED TREE 2021-12-10 07:28:02 +02:00
Jonathan Watt
aa399cfa50 Bug 1745325 - Remove unnecessary setting of print.tab_modal.enabled=true in tests. r=hiro
Differential Revision: https://phabricator.services.mozilla.com/D133449
2021-12-10 03:11:13 +00:00
Emilio Cobos Álvarez
71359f4bcd Bug 1663366 - Make content select work on the parent process (and opt-in the print settings dialog into it). r=mconley
This should do nothing until bug 1744009 lands. It would also need
bug 1596852 to be usable, but no reason to not land it now.

Differential Revision: https://phabricator.services.mozilla.com/D132732
2021-12-08 11:34:02 +00:00
Mark Striemer
e40ea0b135 Bug 1661663 - Allow overriding @page margin rules r=sfoster
Differential Revision: https://phabricator.services.mozilla.com/D132284
2021-11-30 15:59:11 +00:00
Christoph Kerschbaumer
83fbbc882d Bug 1742776: Update more tests within toolkit/components to work with https-first enabled r=robwu
Differential Revision: https://phabricator.services.mozilla.com/D132003
2021-11-24 16:59:10 +00:00
Geoff Lankow
719f2be567 Bug 1740630 - Fix and enable printing the selection from a parent process browser. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D130938
2021-11-18 21:56:02 +00:00
Antonin LOUBIERE
eaab02de17 Bug 35228 - Ability to print even/odd pages. r=emilio,fluent-reviewers,mstriemer
Ability to print all even pages or all odd pages.

Differential Revision: https://phabricator.services.mozilla.com/D130111
2021-11-10 20:08:58 +00:00
Jonathan Watt
639001973b Bug 1740243. Backout accidental print.js changes in D126590 that are part of D130111. r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D130741
2021-11-09 12:56:25 +00:00
Antonin LOUBIERE
cf38ac05ce Bug 1732366 - When closing last tab while having private window, remove the tab from the tabs list . r=Gijs
With session restore and close window on last tab close both enabled, if the last tab is closed while having another private window, move it from the winData.tabs list to the winData._closedTabs list.

Differential Revision: https://phabricator.services.mozilla.com/D126590
2021-11-01 17:09:28 +00:00
Niklas Baumgardner
7fe3c15bfa Bug 1733427 - Toggle print preview dialog when pressing print toolbar button. r=mtigley
Differential Revision: https://phabricator.services.mozilla.com/D129275
2021-11-01 13:55:09 +00:00
Emilio Cobos Álvarez
abd672d0cb Bug 1735526 - Make print settings custom margins pane have a less fragile layout. r=mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D129409
2021-10-29 19:33:18 +00:00
Haik Aftandilian
66d09c03b6 Bug 1735587 - "Sheets of paper" incorrect when numCopies>1 and sheetCount is odd r=emilio
Multiply the sheet count by numCopies after accounting for duplex printing.

Differential Revision: https://phabricator.services.mozilla.com/D128430
2021-10-15 00:01:13 +00:00