Commit graph

253 commits

Author SHA1 Message Date
David Shin
05f999536d 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
ramya
b85623206f 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
7428be4a86 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
Yoshi Cheng-Hao Huang
eb793434b8 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
d4f52a01f6 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
7829e5aab5 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
Emilio Cobos Álvarez
eed264fbc7 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
6e5bce1349 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
3bcccb6ffb 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
702df2639c 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
fd0c1d6b99 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
d362d859ac 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
Emilio Cobos Álvarez
e70545f769 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
4c1667cba1 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
7e23a4287f 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
7a3ed2ce2a 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
b0fb172236 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
0e05928f20 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
b651bfe99a 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
35a88d897e 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
a8d469a8d0 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
91da4bcb58 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
15526b4e91 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
023d8b0a22 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
74e87f6df9 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
0f3b58e028 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
a5854b43a4 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
cccfc1962d 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
Mark Striemer
b87567e7b1 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
ab9c0e444e 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
7f1cae8d68 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
c6510e2e9e 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
Niklas Baumgardner
cf3a438f13 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
Haik Aftandilian
6740298617 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
Emily McDonough
9f54655566 Bug 1721265 Part 3 - Use page-size orientation information in print preview r=emilio,emalysz
When a page-size that is not auto or square exists the print preview will use
the orientation of this page-size when doing initial reflow. The frontend
applies the orientation to the print settings without updating settings and
causing a second reflow, and the orientation selector is hidden.

Differential Revision: https://phabricator.services.mozilla.com/D124976
2021-09-21 16:38:54 +00:00
Hanna Jones
5b7aa9b3a9 Bug 1670871 - truncate custom margin max attr to two decimal places r=mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D125879
2021-09-17 15:28:49 +00:00
Haik Aftandilian
b1dc2d2fe7 Bug 1695645 - "Sheets of paper" does not update when selecting "Print on both sides" r=emilio
Account for duplex mode when calculating the number of sheets of paper for the print dialog and printing to a device (not file).

Differential Revision: https://phabricator.services.mozilla.com/D125336
2021-09-14 23:55:59 +00:00
Michelle Goossens
d835eb1793 Bug 1727925 - Part 3: Migrate six more windows10-32 test suites from AWS to Azure r=jmaher
Differential Revision: https://phabricator.services.mozilla.com/D124192
2021-09-10 11:51:00 +00:00
Michelle Goossens
c7d34da2f9 Bug 1723574 - Enable mochitest-browser-chrome tests that no longer fail r=jmaher
Differential Revision: https://phabricator.services.mozilla.com/D123247
2021-08-23 12:45:31 +00:00
Michelle Goossens
d192833f8d Bug 1723574 - Migrate Windows 10 mochitest-browser-chrome suite from AWS to Azure r=jmaher,preferences-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D122511
2021-08-20 20:55:02 +00:00
Zibi Braniecki
7b320ed8a6 Bug 1613705 - [localization] part17: Fix racy tests to wait for l10n frame. r=platform-i18n-reviewers,dminor,application-update-reviewers,nalexander
Depends on D116791

Differential Revision: https://phabricator.services.mozilla.com/D116792
2021-08-03 16:25:16 +00:00
Butkovits Atila
949da905e7 Backed out 19 changesets (bug 1613705) for causing build bustages complaining about Document.cpp. CLOSED TREE
Backed out changeset 2ee1091dd20d (bug 1613705)
Backed out changeset d377afc0b09f (bug 1613705)
Backed out changeset de9d4378f0ac (bug 1613705)
Backed out changeset 9843372abb6e (bug 1613705)
Backed out changeset 5fc5918e5905 (bug 1613705)
Backed out changeset a7aeae7afd49 (bug 1613705)
Backed out changeset 5d61617a5402 (bug 1613705)
Backed out changeset 85bf98573899 (bug 1613705)
Backed out changeset 175af8a1b8c2 (bug 1613705)
Backed out changeset 93fcb23d7898 (bug 1613705)
Backed out changeset 595529cd906f (bug 1613705)
Backed out changeset 9f3e2963d925 (bug 1613705)
Backed out changeset 442289058933 (bug 1613705)
Backed out changeset fc3b9acb0e81 (bug 1613705)
Backed out changeset 408983c64f7f (bug 1613705)
Backed out changeset 08b637fc3fcd (bug 1613705)
Backed out changeset 6ef0aafd2db0 (bug 1613705)
Backed out changeset d88b294e0a5e (bug 1613705)
Backed out changeset e6bebff87544 (bug 1613705)
2021-08-03 12:36:01 +03:00
Zibi Braniecki
0bf7c83400 Bug 1613705 - [localization] part17: Fix racy tests to wait for l10n frame. r=platform-i18n-reviewers,dminor,application-update-reviewers,nalexander
Depends on D116791

Differential Revision: https://phabricator.services.mozilla.com/D116792
2021-08-03 05:52:06 +00:00
Emma Malysz
5a1d75c541 Bug 1681941, ensure nsXULTooltipListener shows tooltips when entering new target nodes r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D101951
2021-07-30 16:38:35 +00:00
Csoregi Natalia
b965f28246 Backed out changeset f8061ad44728 (bug 1681941) for failures on browser_preview_navigation.js. CLOSED TREE 2021-07-30 04:09:15 +03:00
Emma Malysz
d489a2044b Bug 1681941, ensure nsXULTooltipListener shows tooltips when entering new target nodes r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D101951
2021-07-29 23:09:04 +00:00
Matthew Noorenberghe
aa67c5a592 Bug 1670027 - Always compute isPrintSelectionRBEnabled for the settings passed to the system print dialog. r=mstriemer
When the Mozilla PDF printer is selected, a new settings object was created without the value of isPrintSelectionRBEnabled computed.

Differential Revision: https://phabricator.services.mozilla.com/D119578
2021-07-13 00:25:38 +00:00
Mark Striemer
222e434cd2 Bug 1666247 - Part 1: Add a simplify page checkbox r=emalysz,flod
Differential Revision: https://phabricator.services.mozilla.com/D102356
2021-07-08 03:54:19 +00:00
Matthew Noorenberghe
efc6383c93 Bug 1693069 - Focus the page range field when choosing a custom print range. r=mstriemer
Differential Revision: https://phabricator.services.mozilla.com/D118886
2021-07-05 22:55:55 +00:00
Daniel Holbert
5b30ebbe89 Bug 1713912 followup: drop trailing blank space. (no review, whitespace-only) DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D117555
2021-06-11 18:05:45 +00:00