Commit Graph

232 Commits

Author SHA1 Message Date
Geoff Lankow
3ecdc2bcdb Bug 1711805 - Extract uses of gBrowser in PrintUtils in a way that can be easily overridden. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D115433
2021-05-19 10:45:01 +00:00
Emilio Cobos Álvarez
a35c7babe5 Bug 1705757 - Make printing a single frame choose the right process for the preview frame. r=nika
We were using the top BrowsingContextGroup id in this case, which is
obviously wrong. Also make the API take a BrowsingContext directly,
rather than passing outerwindowids around.

Differential Revision: https://phabricator.services.mozilla.com/D112413
2021-04-17 18:41:11 +00:00
Emilio Cobos Álvarez
0e55bca38f Bug 1705757 - Move FrameLoader.print to BrowsingContext.print. r=nika,remote-protocol-reviewers,marionette-reviewers,extension-reviewers,zombie
This makes it trivial to choose the right BrowserParent to print a
browsing context, by removing the OuterWindowID / FrameLoader
indirections.

Differential Revision: https://phabricator.services.mozilla.com/D112412
2021-04-17 18:41:11 +00:00
Emilio Cobos Álvarez
3f9c03ab78 Bug 1697836 - Avoid throwing when asking for a selection. r=emalysz
Selection may be null if the page got hidden in e.g., the afterprint
event listener or somewhere else.

Add a try catch for good measure, assuming there's no selection is
always safe.

I'll try to get an automated test-case for this working, though it might
be tricky.

Depends on D109714

Differential Revision: https://phabricator.services.mozilla.com/D109715
2021-03-27 10:22:55 +00:00
Emilio Cobos Álvarez
1c7b2a9f3b Bug 1697836 - Improve error handling when failing to window.print(). r=emalysz
Ensure we report the error to the web console, and that the print
browser gets removed, as that is what will exit the modal state in the
page that's printing.

Differential Revision: https://phabricator.services.mozilla.com/D109714
2021-03-27 10:22:54 +00:00
Emilio Cobos Álvarez
9a73b05d1b Bug 1694951 - Remove printing.trigger telemetry. r=jwatt,marionette-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D106465
2021-03-01 11:36:43 +00:00
Emilio Cobos Álvarez
73a16e79d9 Bug 1572798 - Make content browsing contexts for tabs start as inactive. r=nika
Otherwise autoplay blocking until-in-foreground breaks with the other
patch in this bug, because it unblocks media playback once a browsing
context is active for the first time.

Differential Revision: https://phabricator.services.mozilla.com/D42329
2021-01-21 20:20:57 +00:00
Emma Malysz
9dcba03b71 Bug 1683279, fix intermittent test error and use the focused window in PrintingSelectionChild.jsm r=mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D102618
2021-01-21 19:29:10 +00:00
Cosmin Sabou
36851bbb53 Backed out changeset 975f6057245a (bug 1572798) for turning bug 1511706 to perma. CLOSED TREE 2021-01-21 21:35:33 +02:00
Emilio Cobos Álvarez
4aeecb504c Bug 1572798 - Make content browsing contexts for tabs start as inactive. r=nika
Otherwise autoplay blocking until-in-foreground breaks with the other
patch in this bug, because it unblocks media playback once a browsing
context is active for the first time.

Differential Revision: https://phabricator.services.mozilla.com/D42329
2021-01-21 17:40:12 +00:00
Dorel Luca
cc8fec8923 Backed out 2 changesets (bug 1572798) for multiple failures. CLOSED TREE
Backed out changeset cfdebb863454 (bug 1572798)
Backed out changeset f2d3a6800638 (bug 1572798)
2021-01-20 00:15:48 +02:00
Emilio Cobos Álvarez
e8fa29326b Bug 1572798 - Make content browsing contexts for tabs start as inactive. r=nika
Otherwise autoplay blocking until-in-foreground breaks with the other
patch in this bug, because it unblocks media playback once a browsing
context is active for the first time.

Differential Revision: https://phabricator.services.mozilla.com/D42329
2021-01-19 19:14:33 +00:00
Micah Tigley
e6541ef741 Bug 1680637 - Rename TabDialogBox's manager to tabDialogManager r=marionette-reviewers,Gijs
To clarify the two separate SubDialog managers managed by TabDialogManager, this patch renames `_.dialogManager` to `._tabDialogManager`.

Depends on D100066

Differential Revision: https://phabricator.services.mozilla.com/D100955
2021-01-14 06:55:55 +00:00
Butkovits Atila
24473dc461 Backed out 4 changesets (bug 1680637, bug 1682395) for causing Marionette failures. CLOSED TREE
Backed out changeset 073e0be7db95 (bug 1680637)
Backed out changeset 552b91b31b0f (bug 1682395)
Backed out changeset c80de6c72779 (bug 1680637)
Backed out changeset d513e228b0ad (bug 1680637)
2021-01-13 02:13:06 +02:00
Micah Tigley
6e23f8d01a Bug 1680637 - Rename TabDialogBox's manager to tabDialogManager r=marionette-reviewers,Gijs
To clarify the two separate SubDialog managers managed by TabDialogManager, this patch renames `_.dialogManager` to `._tabDialogManager`.

Depends on D100066

Differential Revision: https://phabricator.services.mozilla.com/D100955
2021-01-11 20:55:19 +00:00
Bogdan Tara
b79b69550f Backed out 3 changesets (bug 1680637, bug 1682395) for browser/base/content/* failures CLOSED TREE
Backed out changeset 270e2e3183de (bug 1682395)
Backed out changeset e3566f596187 (bug 1680637)
Backed out changeset 66563136c84e (bug 1680637)
2021-01-11 21:36:20 +02:00
Micah Tigley
294f4945cf Bug 1680637 - Rename TabDialogBox's manager to tabDialogManager r=marionette-reviewers,Gijs
To clarify the two separate SubDialog managers managed by TabDialogManager, this patch renames `_.dialogManager` to `._tabDialogManager`.

Depends on D100066

Differential Revision: https://phabricator.services.mozilla.com/D100955
2021-01-11 05:13:00 +00:00
Emma Malysz
1f4d421611 Bug 1685184, print selected frame when selecting Print Frame from context menu r=marionette-reviewers,mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D100842
2021-01-07 19:34:56 +00:00
Emma Malysz
b1d397a394 Bug 1683318, use focused browsing context for print preview if it is currently active r=mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D100133
2021-01-05 20:42:27 +00:00
Emma Malysz
8647c92f00 Bug 1670122: add check box in print UI to print selection only. r=mstriemer,fluent-reviewers,flod
Uses a new printing actor to determine if there was a selection within
the browsing context.

We now create two browsers, the primary browser and a selected browser,
and will use the appropriate browser depending on the settings value
for printSelectionOnly.

Differential Revision: https://phabricator.services.mozilla.com/D94467
2020-12-17 23:14:43 +00:00
Sam Foster
69e18b4ee0 Bug 1654684 - Add sheet-indicator and preview navigation to the print preview. r=mstriemer,fluent-reviewers,flod
Differential Revision: https://phabricator.services.mozilla.com/D96737
2020-12-09 20:56:28 +00:00
Csoregi Natalia
ab71c86aaf Backed out 2 changesets (bug 1654684) for browser chrome failures with .printPreviewCurrentPageNumber. CLOSED TREE
Backed out changeset 2fdc1b5569e1 (bug 1654684)
Backed out changeset 8ae1d037aa9c (bug 1654684)
2020-12-09 16:11:42 +02:00
Sam Foster
b39650600d Bug 1654684 - Add sheet-indicator and preview navigation to the print preview. r=mstriemer,fluent-reviewers,flod
Differential Revision: https://phabricator.services.mozilla.com/D96737
2020-12-09 02:59:26 +00:00
Brindusan Cristian
76c9db8ae8 Backed out 2 changesets (bug 1654684) for bc failures at browser_ext_tabs_printPreview. CLOSED TREE
Backed out changeset 5a0333ca8a19 (bug 1654684)
Backed out changeset 87d06a4d6ab6 (bug 1654684)
2020-12-07 12:59:10 +02:00
Sam Foster
9528af8e33 Bug 1654684 - Add sheet-indicator and preview navigation to the print preview. r=mstriemer,fluent-reviewers,flod
Differential Revision: https://phabricator.services.mozilla.com/D96737
2020-12-07 08:44:14 +00:00
Neil Deakin
c75a6ce058 Bug 1669369, remove legacy actor from PrintingChild and replace with JSWindowActor, r=mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D92519
2020-10-28 19:19:52 +00:00
Narcis Beleuzu
784e881f1d Backed out changeset ab6c1419da26 (bug 1669369) for bc failures on browser_all_files_referenced.js CLOSED TREE 2020-10-28 17:32:34 +02:00
Neil Deakin
9abeb74c9d Bug 1669369, remove legacy actor from PrintingChild and replace with JSWindowActor, r=mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D92519
2020-10-28 13:58:27 +00:00
Emilio Cobos Álvarez
0a718e3901 Bug 1670643 - Ignore DOMWindowClose events fired at the preview browser. r=jfkthame
See the comment.

https://phabricator.services.mozilla.com/D90808 made it so that we
reused the print document (and thus <browser>) to do the actual print
job.

When a print job finishes, we call window.close(), which is used as a
signal to the front-end to clean up the <browser> element. Before that
patch we sent that signal to the browser created in printUtils.js, but
afterwards we send it to the preview window which causes this badness
when the event bubbles up.

Ignoring it effectively restores the previous behavior, so let's do it.

Differential Revision: https://phabricator.services.mozilla.com/D93499
2020-10-16 16:57:57 +00:00
Emilio Cobos Álvarez
6f93d6f391 Bug 1669925 - Add a printing.trigger keyed scalar to record what triggers a particular print dialog. r=jwatt,marionette-reviewers,maja_zf
In order to avoid over/under-counting, we need to treat window.print()
specially. The new UI was using aOpenWindowInfo.isForPrintPreview for
that, but that doesn't quite work for the old UI (because it will
trigger a regular print, not a preview).

But since isForPrintPreview was only really needed to distinguish
window.print(), just rename it and set it to true when the old UI is
triggered by window.print() as well.

Differential Revision: https://phabricator.services.mozilla.com/D92925
2020-10-09 14:59:46 +00:00
Jonathan Watt
f281fef584 Bug 1669723. Stop unnecessarily catching exceptions from nsIPrintSettingsService.lastUsedPrinterName. r=mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D92768
2020-10-09 10:21:44 +00:00
Jonathan Watt
908122a81a Bug 1669187. Make sure we have a last used printer saved in the common case. r=bobowen,remote-protocol-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D92879
2020-10-08 13:41:24 +00:00
Emilio Cobos Álvarez
36ebff8616 Bug 140718 - Add a "Print selection only" entry to the context menu. r=Gijs,jwatt,fluent-reviewers
This allows to use the feature from the context menu and is very
straight-forward.

This has the benefit of working with fission (as print from the focused
frame) and so on.

Making a checkbox on the UI on top of this is doable, but it is a lot
more complex (requires a bunch of both front-end and platform work)
because undoing this implies restoring the DOM which "print selection"
removes.

I think the context menu entry is very useful regardless of whether we
add a checkbox to undo it, and other browsers (with smaller context
menus) seem to agree.

Differential Revision: https://phabricator.services.mozilla.com/D92205
2020-10-07 20:45:08 +00:00
Jonathan Watt
1bfe204c2e Bug 1667265. Remove nsIPrintSettingsService.globalPrintSettings. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D91366
2020-09-30 12:25:02 +00:00
Jonathan Watt
31d269adf0 Bug 1663733. Add telemetry for the time from print initiation to FrameLoader.printPreview() call and completion. r=emalysz
Differential Revision: https://phabricator.services.mozilla.com/D90370
2020-09-16 18:53:41 +00:00
Cosmin Sabou
9f1f6241e0 Backed out changeset 0e787c1b0a30 (bug 1663733) for eslint failure on content/print.js. CLOSED TREE 2020-09-16 21:22:56 +03:00
Jonathan Watt
730a4301ce Bug 1663733. Add telemetry for the time from print initiation to FrameLoader.printPreview() call and completion. r=emalysz
Differential Revision: https://phabricator.services.mozilla.com/D90370
2020-09-16 15:46:22 +00:00
Emilio Cobos Álvarez
34abb8f383 Bug 1662090 - Don't rely on gBrowser in PrintUtils.startPrintWindow. r=jwatt
This is all we really need and allows Thunderbird to use this rather
than rolling their own thing.

Differential Revision: https://phabricator.services.mozilla.com/D89294
2020-09-07 09:55:33 +00:00
Emma Malysz
895926f519 Bug 1659624, close the print UI when the user chooses to print or save r=mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D89198
2020-09-03 01:58:57 +00:00
pbz
9684cdfd60 Bug 1661030 - Refactor SubDialog and TabDialogBox to support passing multiple window arguments. r=Gijs,preferences-reviewers
This also updates the behavior of the allowDuplicates check:
Instead of only checking if the top dialog is a duplicate, it will now check the whole stack and
skip the dialog open if a duplicate URL is found.
This fixes an issue where callers could alternate between dialogs to bypass the check.

Differential Revision: https://phabricator.services.mozilla.com/D88422
2020-09-02 14:24:47 +00:00
Emma Malysz
2680749792 Bug 1659340, hide menu options if new print UI pref is enabled r=mstriemer
If print.tab_modal.enabled is enabled, we should not display the print preview
menu item, as this will redirect us to the print preview automatically and thus
be redundant with the other print button. We also want to hide the page setup
menu item.

Differential Revision: https://phabricator.services.mozilla.com/D88224
2020-08-28 01:23:42 +00:00
Emilio Cobos Álvarez
c020e3ea6b Bug 1660739 - Fix tabs.printPreview API with the new print preview design. r=mstriemer,mixedpuppy
Return a promise from PrintUtils.printPreview which resolves when the
new print preview dialog is closed.

Differential Revision: https://phabricator.services.mozilla.com/D88013
2020-08-26 03:10:47 +00:00
Emilio Cobos Álvarez
2c0dea8fd4 Bug 1636728 - Centralize printing entry points in nsGlobalWindowOuter, and move cloning out of nsPrintJob. r=jwatt,geckoview-reviewers,smaug,agi
This centralizes our print and preview setup in nsGlobalWindowOuter so
that we never re-clone a clone, and so that we reuse the window.open()
codepath to create the browsing context to clone into.

For window.print, for both old print dialog / silent printing and new
print preview UI, we now create a hidden browser (as in with visibility:
collapse, which takes no space but still gets a layout box).

 * In the modern UI case, this browser is swapped with the actual print
   preview clone, and the UI takes care of removing the browser.

 * In the print dialog / silent printing case, the printing code calls
   window.close() from nsDocumentViewer::OnDonePrinting().

 * We don't need to care about the old print preview UI for this case
   because it can't be open from window.print().

We need to fall back to an actual window when there's no
nsIBrowserDOMWindow around for WPT print tests and the like, which don't
have one. That seems fine, we could special-case this code path more if
needed but it doesn't seem worth it.

Differential Revision: https://phabricator.services.mozilla.com/D87063
2020-08-25 17:45:12 +00:00
Mark Striemer
be39afa956 Bug 1660026 - Move print preview updating code into print.js r=sfoster,emalysz
Differential Revision: https://phabricator.services.mozilla.com/D87366
2020-08-24 19:17:08 +00:00
Mark Striemer
a1e4f2c59e Bug 1654962 - Size tab modal print UI to available window size r=Gijs,sfoster,emalysz,pbz
Differential Revision: https://phabricator.services.mozilla.com/D86037
2020-08-24 21:00:36 +00:00
Mihai Alexandru Michis
62de909fbe Backed out changeset 80e6be24260d (bug 1654962) for causing bc failures in browser_modal_print.js
CLOSED TREE
2020-08-21 17:47:07 +03:00
Mark Striemer
a7a11db244 Bug 1654962 - Size tab modal print UI to available window size r=Gijs,sfoster,emalysz,pbz
Differential Revision: https://phabricator.services.mozilla.com/D86037
2020-08-21 13:55:15 +00:00
Emma Malysz
15a3804a78 Bug 1653389, validate page range setting r=sfoster,mstriemer,fluent-reviewers,flod
Creates two input elements for the start and end range.

Differential Revision: https://phabricator.services.mozilla.com/D85349
2020-08-19 22:17:00 +00:00
Mark Striemer
556163b570 Bug 1653317 - Use TabDialogBox for tab modal print UI r=Gijs,pbz
Differential Revision: https://phabricator.services.mozilla.com/D86597
2020-08-19 20:04:52 +00:00
Sam Foster
c515e0f438 Bug 1653607 - Add margins, color mode controls to the print UI. r=emalysz,fluent-reviewers,mstriemer,flod
* New PrintSettingSelect element for the margin and color-mode picker
* The destination-picker and color-mode picker now extend the PrintSettingSelect
* Drive-by change to have numCopies info use the PrintSettingNumber for consistency & code reuse
* Margin presets are retrieved from a defaultSettings object which is the settings for the current printer without the user pref values

Differential Revision: https://phabricator.services.mozilla.com/D86849
2020-08-19 17:23:18 +00:00