Commit Graph

825 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
01ea62498c Bug 1789439 - Fix browser_modal_print.js after previous patch.
MANUAL PUSH: Orange fix CLOSED TREE
2022-09-15 09:49:10 -07:00
Emilio Cobos Álvarez
0a4f7b9301 Bug 1789439 - Throw rather than logging an error when tab-modal print is already open. r=mstriemer
If we succeed but return null, we end up retargeting to a new window
here:

  https://searchfox.org/mozilla-central/rev/3aaca0a12a2d1463da54933bdbdae2f06fead06f/dom/ipc/ContentParent.cpp#5462-5465

Which is bad.

Depends on D156682

Differential Revision: https://phabricator.services.mozilla.com/D156683
2022-09-15 15:37:57 +00:00
Itiel
bbddee85f8 Bug 1787663 - Don't shrink the open-in-new.svg icon in the Print dialog r=sfoster
Differential Revision: https://phabricator.services.mozilla.com/D155795
2022-08-30 04:22:08 +00:00
David Shin
e6118a5a8c 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
Barret Rennie
7b67827d97 Bug 1776307 - Port osfile.jsm usage to IOUtils in toolkit/components/printing r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D150205
2022-08-12 18:37:31 +00:00
ramya
8c14a92baa Bug 1697226 - Added option to print current page. r=sfoster,fluent-reviewers,flod,mstriemer
Added the option to print the current page to print UI.
Added tests to check if current page is selected correctly.

Differential Revision: https://phabricator.services.mozilla.com/D152810
2022-08-11 19:47:20 +00:00
Mark Banner
1e3410cbdd Bug 1782008 - Remove now unnecessary .eslintrc.js files. r=webcompat-reviewers,extension-reviewers,media-playback-reviewers,pip-reviewers,denschub,rpl,alwu,mossop
Differential Revision: https://phabricator.services.mozilla.com/D152736
2022-08-03 11:16:20 +00:00
Barret Rennie
a70c93c344 Bug 1772941 - Port osfile.jsm usage to IOUtils in toolkit/content/ r=florian,preferences-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D149303
2022-07-12 00:25:35 +00:00
Tooru Fujisawa
48c568867c Bug 1667455 - Part 5: Stop importing Services.jsm from chrome-priv JS code, top-level single-line cases. r=kmag,webdriver-reviewers,perftest-reviewers,webcompat-reviewers,geckoview-reviewers,extension-reviewers,application-update-reviewers,pip-reviewers,twisniewski,m_kato,jdescottes,mconley,AlexandruIonescu,mossop
Differential Revision: https://phabricator.services.mozilla.com/D150894
2022-07-11 12:41:50 +00:00
Yoshi Cheng-Hao Huang
aad3de8bd2 Bug 1777496 - Check if ModuleLoader exists before calling SetAcquiringImportMaps. r=smaug
For the print preview documents, they are cloned from the original document in
Document::CreateStaticClone[1]. But the cloned document isn't attched to any
nsIContentViewer yet so it won't have any global object. The document is
attached to the nsIContentViewer later when the cloning is done[2].

Also, the script elements from the cloned document are also cloned from
the original document, so they won't be processed in the cloned document.

Therefore we simply bail out if the module loader isn't initialized yet.

[1]: https://searchfox.org/mozilla-central/rev/3e1a721bce1da3ae04675539b39a4e95b25a046d/dom/base/Document.cpp#13240
[2]: https://searchfox.org/mozilla-central/rev/3e1a721bce1da3ae04675539b39a4e95b25a046d/dom/base/Document.cpp#13295

Differential Revision: https://phabricator.services.mozilla.com/D151105
2022-07-11 09:38:55 +00:00
Dão Gottwald
f8ffa34eec Bug 1775129 - browser-toolbarKeyNav.js thinks focus is moving backwards when it's moving forward, focus gets stuck. r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D149790
2022-06-24 15:04:03 +00:00
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