Make `window.print()` work with tab-modal printing
Categories
(Core :: Printing: Setup, task, P1)
Tracking
()
People
(Reporter: jwatt, Assigned: emilio)
References
(Blocks 1 open bug)
Details
(Whiteboard: [print2020_v81])
Attachments
(1 file, 4 obsolete files)
(Edited 2020-08-10 to provide a useful summary and up-to-date understanding of what we need.)
We need window.print()
to synchronously create the printing static clone document so that pages that do the following have the print only changes in the print output:
makeChangesThatShouldOnlyShowInThePrintOutput();
window.print();
undoChangesThatShouldOnlyShowInThePrintOutput();
However, for the new printing UI we need the static clone to be generated in the browser element contained within the print preview doorhanger that the frontend opens. Obviously at the time that window.print()
is called in the content process, the doorhanger isn't open in the parent process though.
To achieve both the above we will need to either:
- create and store the static clone synchronously during the
window.print()
call, message the parent to start printing, and the pick up and use the stored static clone after the roundprint to the parent to get it to open the doorhanger - send an IPDL message to the parent process to open the doorhanger UI in
window.print()
, and either spin an event loop until the parent sends back the browser to clone into, or else use a blocking IPDL message
Reporter | ||
Comment 1•5 years ago
|
||
Updated•5 years ago
|
Comment 3•5 years ago
|
||
Backed out for build bustages on nsGlobalWindowOuter.cpp
Backout link: https://hg.mozilla.org/integration/autoland/rev/aa430c94ca59624d0128da2edd86a1294854a58e
Log link: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=282206995&repo=autoland&lineNumber=42980
Reporter | ||
Comment 4•5 years ago
|
||
Meh. I've mistakenly used JS::NumberValue instead of JS::BooleanValue. Why do normal builds not complain about that?
Comment 6•5 years ago
|
||
bugherder |
Comment 7•5 years ago
|
||
backout |
Backed out from Beta for suspicion of causing bug 1607671. This bug remains fixed on m-c for 74+.
https://hg.mozilla.org/releases/mozilla-beta/rev/93585cda453f
Comment 8•5 years ago
|
||
This was backed out for 74+ in bug 1607671.
https://hg.mozilla.org/integration/autoland/rev/d7e962f7ca16
Comment 9•5 years ago
|
||
There's a r+ patch which didn't land and no activity in this bug for 2 weeks.
:jwatt, could you have a look please?
For more information, please visit auto_nag documentation.
Reporter | ||
Updated•5 years ago
|
Reporter | ||
Updated•5 years ago
|
Reporter | ||
Updated•4 years ago
|
Reporter | ||
Updated•4 years ago
|
Reporter | ||
Updated•4 years ago
|
Updated•4 years ago
|
Reporter | ||
Comment 11•4 years ago
|
||
Updated•4 years ago
|
Updated•4 years ago
|
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 12•4 years ago
|
||
Stash it in the openWindowInfo, so that eventually the front-end creates
a hidden window.
Assignee | ||
Comment 13•4 years ago
|
||
This of course still needs some work. Things that I know need fixing:
-
Make the frontend not create a visible tab for window.print().
Instead, probably just create a headless / hidden browser. -
Make the print preview stuff work by either not creating a hidden
browser for that case (creating the print preview UI in the
window-opening codepath), or swapping frame loaders with the hidden
window from the print preview UI. -
Make the print preview viewer have an about:printpreview url (because
it's special-cased in some cases). -
Fix some other print-preview tests (I've fixed the main one).
-
Handle print preview settings changes. Right now I could just call
printPreviewWindow.printPreview() again I guess, and that'd preserve
behavior (and keep re-cloning clones), so may be worth doing to get
this landed, but the idea is that eventually to update the print
preview settings we don't go through window.printPreview() and
instead go through a new API in the preview window, that just
re-creates the print job and presentation.
Depends on D87062
Assignee | ||
Comment 14•4 years ago
|
||
Comment on attachment 9170014 [details]
Bug 1602410 - Centralize printing entry points in nsGlobalWindowOuter, and move cloning out of nsPrintJob.
As noted, some work still needed, but wdyt of something like this?
Comment 15•4 years ago
|
||
Comment on attachment 9170014 [details]
Bug 1602410 - Centralize printing entry points in nsGlobalWindowOuter, and move cloning out of nsPrintJob.
Added some comments on the revision - generally looks good
Assignee | ||
Comment 16•4 years ago
|
||
Do this by spinning the event loop until we've done the clone for
preview as appropriate.
This should be much less risky than finishing the previous patches
which would still be nice, but realistically landing them for 81 is not
going to happen.
This just returns without doing nothing in a couple cases, like when
there's already another modal dialog or such. That seems acceptable to
me, it's not clear what better way to do would be.
Comment 17•4 years ago
|
||
Reporter | ||
Updated•4 years ago
|
Updated•4 years ago
|
Reporter | ||
Updated•4 years ago
|
Comment 18•4 years ago
|
||
bugherder |
Assignee | ||
Updated•4 years ago
|
Comment 19•4 years ago
|
||
Comment on attachment 9170014 [details]
Bug 1602410 - Centralize printing entry points in nsGlobalWindowOuter, and move cloning out of nsPrintJob.
Revision D87063 was moved to bug 1636728. Setting attachment 9170014 [details] to obsolete.
Updated•4 years ago
|
Updated•4 years ago
|
Description
•