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

72 Коммитов

Автор SHA1 Сообщение Дата
Emilio Cobos Álvarez a49800a500 Bug 1679706 - Communicate to the front-end whether there are no visible pages at all. r=jfkthame
This will allow them to react however they want to empty page ranges as
a result of another setting change.

Differential Revision: https://phabricator.services.mozilla.com/D98183
2020-12-02 21:48:03 +00:00
Emilio Cobos Álvarez 075593c873 Bug 1679706 - Cleanup a bit the page-sequence-using methods in nsPrintJob. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D98182
2020-12-02 17:17:17 +00:00
Emilio Cobos Álvarez a68a0e6e0e Bug 1672864 - Don't resume printing too early. r=jfkthame
When we do the initial reflow, we remove nodes from the document if
we're printing the selection. If these operations cause one iframe to be
removed, for example, then we may get hit with an nsIWebProgress
notification synchronously, which may cause us to go through
MaybeResumePrintAfterResourcesLoaded too early (and thus twice), which
messes up our state.

The ideal solution would be to add us as a listener a bit later, but we
can't because we need to know whether we did load anything during the
initial reflow.

So instead of that, just avoid resuming print while we're doing the
reflow. We'll call MaybeResumePrintAfterResourcesLoaded a few lines
below.

Differential Revision: https://phabricator.services.mozilla.com/D94586
2020-10-23 18:34:05 +00:00
Daniel Holbert 3e52de68f4 Bug 1669774 part 2: Rename some APIs and variables for accuracy (s/page/sheet/) in nsPrintJob, nsPagePrintTimer, and nsDocumentViewer. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D92791
2020-10-07 21:00:26 +00:00
Emilio Cobos Álvarez 72936d9e85 Bug 1667400 - Remove PrintPreviewUserEventSuppressor. r=jwatt
Doesn't work at all with e10s / fission.

Differential Revision: https://phabricator.services.mozilla.com/D91440
2020-09-25 14:58:17 +00:00
Jonathan Watt ad76c1dcba Bug 1653340. Add new FrameLoader.printPreview() API. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D88703
2020-09-01 11:00:36 +00:00
Emilio Cobos Álvarez 4953377ea0 Bug 1661137 - Decrement the document viewer's destroy blocker earlier. r=bobowen
Do it as soon as we're done printing, rather than waiting until the
print timer dies.

Differential Revision: https://phabricator.services.mozilla.com/D88569
2020-08-31 10:44:19 +00:00
Emilio Cobos Álvarez 044b3c4332 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
Daniel Holbert e3a6a51032 Bug 1660502 part 1: Give nsIWebBrowserPrint a "rawNumPages" attribute. r=TYLin
This is backed by an existing nsPageSequenceFrame API, which this patch also
renames to use the word "Raw" for consistency across the full callstack.

Differential Revision: https://phabricator.services.mozilla.com/D87886
2020-08-24 23:53:11 +00:00
Jonathan Watt 970f8373d2 Bug 1659489. Rename nsPrintJob's mIsDoingPrintPreview to mCreatedForPrintPreview. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D87296
2020-08-17 21:27:00 +00:00
Emilio Cobos Álvarez 68dd457e8b Bug 1658903 - Remove nsPrintJob::TurnScriptingOn. r=jwatt
This code was there to prevent stuff like bug 424377, but nowadays clone
documents are data documents to begin with, so they can't load scripts.

Differential Revision: https://phabricator.services.mozilla.com/D86948
2020-08-13 12:22:56 +00:00
Hiroyuki Ikezoe 103cf5ff04 Bug 1657515 - Constify some nsIDocumentViewerPrint methods. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D86149
2020-08-06 22:54:16 +00:00
Bob Owen ada89eea81 Bug 1653334 part 2: Cache the selection ranges on subdocuments as we build the nsPrintObject tree. r=jwatt
This also refactors the selection printing code, so that as we build the tree we
record which nsPrintObject should be used if printing a Selection is chosen.

Differential Revision: https://phabricator.services.mozilla.com/D85600
2020-08-03 14:23:56 +00:00
Bob Owen c4f92dc077 Bug 1653334 part 1: Remove unused isRangeSelection and isIFrameSelected. r=jwatt
These unused members are removed from nsIWebBrowserPrint and PPrintingTypes
along with their supporting functions.

Differential Revision: https://phabricator.services.mozilla.com/D85007
2020-08-03 14:23:27 +00:00
Butkovits Atila 076d3aa7ed Backed out 2 changesets (bug 1653334) for reftest failures at test-print-selection.html. CLOSED TREE
Backed out changeset 6cc6bbaa91f0 (bug 1653334)
Backed out changeset 75a5873f02a4 (bug 1653334)
2020-08-03 15:35:37 +03:00
Bob Owen ac5872bd35 Bug 1653334 part 2: Cache the selection ranges on subdocuments as we build the nsPrintObject tree. r=jwatt
This also refactors the selection printing code, so that as we build the tree we
record which nsPrintObject should be used if printing a Selection is chosen.

Differential Revision: https://phabricator.services.mozilla.com/D85600
2020-08-03 08:54:12 +00:00
Bob Owen d5715ceb42 Bug 1653334 part 1: Remove unused isRangeSelection and isIFrameSelected. r=jwatt
These unused members are removed from nsIWebBrowserPrint and PPrintingTypes
along with their supporting functions.

Differential Revision: https://phabricator.services.mozilla.com/D85007
2020-08-03 08:53:44 +00:00
Sylvestre Ledru 843f943758 Bug 1519636 - Reformat recent changes to the Google coding style r=andi
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D85678
2020-08-02 15:29:15 +00:00
Emilio Cobos Álvarez a1687ac170 Bug 1648064 - Make print preview documents wait properly for the document to be loaded. r=smaug
Otherwise my test fails intermittently on CI. We need to block on all
the load blockers because stuff like responsive images doesn't fire the
load directly but they do that as a micro task (blocking the load
event).

Differential Revision: https://phabricator.services.mozilla.com/D81989
2020-07-22 20:29:16 +00:00
Narcis Beleuzu 46367e2f7d Backed out 6 changesets (bug 1648064) for wp failures on test_printpreview.xhtml . CLOSED TREE
Backed out changeset 8ac892c60eda (bug 1648064)
Backed out changeset 189401f7b6e8 (bug 1648064)
Backed out changeset 2598e2706bd0 (bug 1648064)
Backed out changeset 4ec12eb9788c (bug 1648064)
Backed out changeset f735d4f6b21f (bug 1648064)
Backed out changeset 0fed6928b53d (bug 1648064)
2020-07-22 21:28:10 +03:00
Emilio Cobos Álvarez 636792f039 Bug 1648064 - Make print preview documents wait properly for the document to be loaded. r=smaug
Otherwise my test fails intermittently on CI. We need to block on all
the load blockers because stuff like responsive images doesn't fire the
load directly but they do that as a micro task (blocking the load
event).

Differential Revision: https://phabricator.services.mozilla.com/D81989
2020-07-22 14:39:47 +00:00
Emilio Cobos Álvarez f87a5320b9 Bug 1648064 - Remove some includes from nsPrintJob.h. r=jwatt
I had needed this before to export that header, and it's no longer
needed, but it seems useful anyways.

Depends on D81989

Differential Revision: https://phabricator.services.mozilla.com/D84252
2020-07-22 14:16:14 +00:00
Simon Giesecke 96fb649d21 Bug 1652017 - Remove unnecessary includes for expensive nsIFrame.h. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D83111
2020-07-15 13:44:39 +00:00
Emilio Cobos Álvarez b769a57503 Bug 1651947 - Scale the page sequence in print preview so that pages don't overflow the viewport horizontally. r=dholbert
This is going to be useful for the new print preview UI, which is in a
doorhanger and thus much more likely to be less than the page size.

We (ab)use the existing print preview scaling mechanism. We only need it
after reflowing all pages, so this works.

This whole scaling mechanism is all-in-all not amazing, but the patch is
less gross than I initially thought. It's nice, actually.

We could put the new behavior behind a pref trivially, if that's wanted,
but I honestly thing this behavior is better even without the doorhanger
ui.

Differential Revision: https://phabricator.services.mozilla.com/D83309
2020-07-15 11:16:43 +00:00
Jonathan Watt b800c4c54e Bug 1652344 p3. Stop creating an nsIPrintSettings in nsGlobalWindowOuter::PrintOuter. r=bobowen
The fallback code in nsPrintJob::DoCommonPrint to create an nsIPrintSettings if
none is passed in is never used, since all callers pass a settings object.
However, to simplify future changes I'd like nsGlobalWindowOuter::PrintOuter to
stop creating and passing in its own default valued nsIPrintSettings object.

This patch makes the fallback code that DoCommonPrint calls do what
nsGlobalWindowOuter::PrintOuter does, and makes the latter stop passing in a
settings object.

This patch also removes nsIWebBrowserPrint.globalPrintSettings since
nsGlobalWindowOuter::PrintOuter was its only consumer.

Differential Revision: https://phabricator.services.mozilla.com/D83268
2020-07-13 00:22:28 +00:00
Mihai Alexandru Michis c6f6f8daa2 Backed out 2 changesets (bug 1652344) for causing failures in test_printpreview.xhtml
CLOSED TREE

Backed out changeset d2b66d810ab5 (bug 1652344)
Backed out changeset 075903436ef2 (bug 1652344)
2020-07-13 01:21:28 +03:00
Jonathan Watt 44ed5abb22 Bug 1652344 p2. Stop creating an nsIPrintSettings in nsGlobalWindowOuter::PrintOuter. r=bobowen
The fallback code in nsPrintJob::DoCommonPrint to create an nsIPrintSettings if
none is passed in is never used, since all callers pass a settings object.
However, to simplify future changes I'd like nsGlobalWindowOuter::PrintOuter to
stop creating and passing in its own default valued nsIPrintSettings object.

This patch makes the fallback code that DoCommonPrint calls do what
nsGlobalWindowOuter::PrintOuter does, and makes the latter stop passing in a
settings object.

This patch also removes nsIWebBrowserPrint.globalPrintSettings since
nsGlobalWindowOuter::PrintOuter was its only consumer.

Differential Revision: https://phabricator.services.mozilla.com/D83268
2020-07-12 19:33:49 +00:00
Jonathan Watt bdfbfac7d5 Bug 1557983. Remove nsPrintJob::HasPrintCallbackCanvas.
After refactoring the 'beforeprint'/'afterprint' code, this method is not used
any more.

Differential Revision: https://phabricator.services.mozilla.com/D34281
2020-07-11 14:14:15 +00:00
Butkovits Atila ce77b8466f Backed out 2 changesets (bug 1557983) for failures at table-background-print.html. CLOSED TREE
Backed out changeset 249eede42e9f (bug 1557983)
Backed out changeset dfbaf61ce16a (bug 1557983)
2020-07-11 13:14:13 +03:00
Jonathan Watt a096d01a0c Bug 1557983. Remove nsPrintJob::HasPrintCallbackCanvas.
After refactoring the 'beforeprint'/'afterprint' code, this method is not used
any more.

Differential Revision: https://phabricator.services.mozilla.com/D34281
2020-07-11 09:10:03 +00:00
Butkovits Atila 222d260b21 Backed out changeset f91e5fbb9520 (bug 1557983) as requested by dev. 2020-07-11 12:11:20 +03:00
Jonathan Watt 91e46d309f Bug 1557983. Remove nsPrintJob::HasPrintCallbackCanvas.
After refactoring the 'beforeprint'/'afterprint' code, this method is not used
any more.

Differential Revision: https://phabricator.services.mozilla.com/D34281
2020-07-11 08:47:04 +00:00
Jonathan Watt cf7589cd57 Bug 1600623. Add telemetry probes for print dialog/preview opens/cancels and print target type. r=bobowen,mbalfanz
The probes collect counts for:

 - print preview open, and exit without print
 - print dialog opened from print preview, and cancelled
 - print dialog opened without print preview, and cancelled
 - silent prints
 - print target
   - PDF file
   - XPS file
   - other (probably print to physical printer, but we can never be sure)

There is some overlap with the existing PRINT_* probes, but I think we should
keep those in place temporarily until we confirm that the new probes produce
numbers that are consistent with the old probes.

This patch only adds 'print target' probes for Windows and macOS.

I use nsDeviceContextSpec*::Init() to collect the 'print target' telemetry
because the way we initialize settings from prefs (and the way macOS works in
particular) make it difficult to reliably determine the target type earlier in
the print process for all possible entry points into the printing code.

Differential Revision: https://phabricator.services.mozilla.com/D78033
2020-06-03 21:21:14 +00:00
Mirko Brodesser ec9cb4d8ef Bug 1622199: annotate `Selection::AddRangeAndSelectFramesAndNotifyListeners` with `MOZ_CAN_RUN_SCRIPT`. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D66759

--HG--
extra : moz-landing-system : lando
2020-03-13 15:46:13 +00:00
Jonathan Watt 56e18a7319 Bug 1619403. Merge nsPrintJob's GetDisplayTitleAndURL and GetDocumentTitleAndURL. r=nordzilla
This also removes nsPrintJob::mFallbackDocTitle since there really is no point
in blindly calculating it ahead of time when we will virtually never use it,
and even if there was there's no reason to store in on the nsPrintJob given
that we create a new nsPrintJob every time we print!

Differential Revision: https://phabricator.services.mozilla.com/D65014

--HG--
extra : moz-landing-system : lando
2020-03-03 20:08:53 +00:00
Jonathan Watt df7370bda4 Bug 1618909. Remove nsIWebBrowserPrint.documentName. r=nordzilla
Differential Revision: https://phabricator.services.mozilla.com/D64774

--HG--
extra : moz-landing-system : lando
2020-03-02 20:10:10 +00:00
Masayuki Nakano d586d5dc73 Bug 1543315 - part 19: Mark `PresShell::ReconstructFrames()` as `MOZ_CAN_RUN_SCRIPT` r=smaug
It calls `Document::FlushPendingNotification()` so that we should mark it
as `MOZ_CAN_RUN_SCRIPT`.

And the method calls it of `mDocument` and `mDocument` is never modified
after it's initialized.  Therefore, we can move the initializer to the
constructor and make `RefPtr<Document>` to `RefPtr<Document> const`.  Thus,
we can avoid unnecessary auto `RefPtr`.

Differential Revision: https://phabricator.services.mozilla.com/D55803

--HG--
extra : moz-landing-system : lando
2019-12-11 12:18:00 +00:00
Jonathan Watt 212f106dcf Bug 1486968. Remove nsPrintJob::mOldPrtPreview. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D56205

--HG--
extra : moz-landing-system : lando
2019-12-09 13:36:55 +00:00
Jonathan Watt db9b9ed1af Bug 1593793. Move and rename nsPrintData::mBrandName to nsPrintJob::mFallbackDocTitle. r=bobowen
nsPrintData::mBrandName never changes over the lifetime of a Firefox instance.
It is wasteful to have nsPrintData obtain and store it, since we can replace
an nsPrintJob's nsPrintData object multiple times over the lifetime of the
nsPrintJob and nsPrintJob is the only consumer.

Differential Revision: https://phabricator.services.mozilla.com/D51689

--HG--
extra : moz-landing-system : lando
2019-11-04 20:02:03 +00:00
Jonathan Watt 48364b8cbb Bug 1558210. Make various nsPrintJob methods private. r=bobowen
Also removes two unused (not even defined) method declarations.

Differential Revision: https://phabricator.services.mozilla.com/D34357

--HG--
extra : rebase_source : bd03bbe8f6a532aa38f9ae871e0b60ca9fa088a7
extra : amend_source : 758bb89dbe6413116647f78ced8afa41b9ce422e
2019-06-04 17:03:35 +01:00
Jonathan Watt 79cd40383d Bug 1558057. Remove nsPrintJob::CleanupDocTitleArray. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D34289

--HG--
extra : rebase_source : 0f65d809f1946fa1f555d24d364d49e294657ffb
extra : amend_source : 08fcb1420e8083573f7d783005eabbb7cc75dfd5
2019-05-30 14:03:36 +01:00
Jonathan Watt 88526e9eac Bug 1557878. Replace nsIWebBrowserPrint::enumerateDocumentNames with a getter for the top document's name. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D34260

--HG--
extra : rebase_source : cbac94e78d57371ec1f4bdfcd1739367fb79f864
2019-05-30 11:43:16 +01:00
Jonathan Watt 913d6b76ee Bug 1557687. Remove nsPrintData::mDocWasToBeDestroyed. r=bobowen
This shows that this variable has never been read going back all the way to
the original Mercurial import in 2007:

  hg grep -f --diff mDocWasToBeDestroyed layout/printing/ns*

Differential Revision: https://phabricator.services.mozilla.com/D34143

--HG--
extra : rebase_source : c14a51dab1825e26fb8031d291d2c69e78931c84
extra : amend_source : 73794b07d703987db8d2eb49dd97d74b1a9be325
2019-05-29 10:42:14 +01:00
Jonathan Watt 09d6c311f9 Bug 1557681. Rename nsPrintJob::Cancelled() to Cancel(). r=bobowen
"Cancelled" sounds like it's a query and should return a bool.  In fact this
method sets state in response to a nsIWebBrowserPrint.cancel() being called.

Differential Revision: https://phabricator.services.mozilla.com/D34137

--HG--
extra : rebase_source : 97797d906b84ed18a258881a31722179d50943f7
extra : amend_source : c0e1b61f13b2a8ccaec7cc995841948deabbe041
2019-05-29 07:14:46 +01:00
Jonathan Watt 02975bf7d4 Bug 1557033. Stop using nsIDocShellTreeItem in nsPrintJob. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D33793

--HG--
extra : rebase_source : f12820b3cd6a5539e79abdcf51945fcd4eef47a8
2019-05-24 10:50:22 +01:00
Jonathan Watt 5cd2b5b11e Bug 1557104. Merge nsIPageSequenceFrame and nsSimplePageSequenceFrame. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D33817

--HG--
rename : layout/generic/nsSimplePageSequenceFrame.cpp => layout/generic/nsPageSequenceFrame.cpp
rename : layout/generic/nsSimplePageSequenceFrame.h => layout/generic/nsPageSequenceFrame.h
extra : rebase_source : e75b043af4dbfe4c108f2bfc0e234fd20c5af315
2019-05-22 13:01:33 +01:00
Jonathan Watt 39945059b3 Bug 1552785. Remove printing related isFramesetDocument and isFramesetFrameSelected code. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D33696

--HG--
extra : rebase_source : 2e7f854a808059b4955ffaad425fe8b68263883e
2019-05-21 23:25:57 +01:00
Jonathan Watt 098392f093 Bug 1552785. Remove internal code for various frameset printing behaviors. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D33624

--HG--
extra : rebase_source : 336e87a05970895684602c9db3e5222918f861c8
extra : source : 98fbf1ed617549496036099b5aee333aa6b29925
2019-05-21 16:01:34 +01:00
Jonathan Watt a7b3640083 Bug 1553081. Set nsPrintJob::mDisallowSelectionPrint during Initialize(). r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D31975

--HG--
extra : rebase_source : 57b72312d1c25b62b3c5ebd6818f2010eddfefec
extra : amend_source : 9f8a0f0e30fefccd3a9296b6d91e74f7b6589676
2019-05-10 16:01:33 +01:00
Jonathan Watt e8b9c5bc5d Bug 1553080. Have nsPrintJob record modality and mozPrintCallback presence during initialization. r=bobowen
Differential Revision: https://phabricator.services.mozilla.com/D31974

--HG--
extra : rebase_source : 4e5319b1f6b3b7a70dd79d8c9538300ca1ccd581
extra : amend_source : a4510ba02336f5464463fec3ccd320296d74df92
2019-05-10 14:52:25 +01:00