Commit Graph

4149 Commits

Author SHA1 Message Date
Calixte Denizet
39aeea3e94 [Editor] Add a toggle button to show/hide all the highlights (bug 1867740) 2024-03-07 13:16:59 +01:00
Calixte Denizet
6d0835dc52 In the m-c automation, give the possibility to remove window listeners when a test ended
The goal is to avoid to have some exceptions in the logs when a test finished.
2024-03-06 14:21:57 +01:00
calixteman
f1272ee435
Merge pull request #17771 from calixteman/bug1832519
[GeckoView] Remove the open-in-app button (bug 1832519)
2024-03-05 14:11:12 +01:00
Calixte Denizet
ba3e559583 Don't stringify data for telemetry 2024-03-04 20:17:47 +01:00
Calixte Denizet
3cb58f84a2 [GeckoView] Remove the open-in-app button (bug 1832519) 2024-03-04 19:32:12 +01:00
Jonas Jenwald
e781b553cb [Editor] Reduce a bit of CSS duplication for the highlight-thickness "indicators" 2024-03-01 16:18:39 +01:00
Jonas Jenwald
c7e7122e25 [Editor] Indicate if the highlight-thickness slider is disabled
The fact that the highlight-thickness can only be changed in "free" mode isn't really obvious visually in the toolbar, so attempt to provide at least some indication of the `disabled`-state by "dimming" the slider.
2024-03-01 16:18:31 +01:00
Calixte Denizet
65342d2bee [Editor] Add some telemetry for the highlight feature (bug 1866437) 2024-02-28 10:17:11 +01:00
Calixte Denizet
9e042e7acc Avoid to have to wait to zoom after scrolling
Allow to zoom with the wheel once the scrolling is finished.
It's now possible to know that thanks to the scrollend event.

Fixes #17707.
2024-02-25 21:40:48 +01:00
Calixte Denizet
bb19cf9b64 [Editor] In caret browsing mode, get the caret position in the text layer (bug 1881692)
The function caretPositionFromPoint return the position within the last visible element
and sometimes there are some elements on top of the ones in the text layer.
So the idea is to hide the visible elements which aren't in the text layer in order
to get the right caret position.
2024-02-23 16:50:19 +01:00
Calixte Denizet
e1f6f5179f [Editor] Add the possibility to create an highlight from the context menu when some text is selected (bug 1867739) 2024-02-23 16:18:03 +01:00
calixteman
72b8b29147
Merge pull request #17701 from calixteman/alt_text_ai
[Editor] Add the possibility to query some ML stuff to guess an alt text for an image
2024-02-21 10:14:40 +01:00
Calixte Denizet
46416bb131 [Editor] Add the possibility to query some ML stuff to guess an alt text for an image
It's only for an experimental purpose.
2024-02-20 21:29:33 +01:00
Calixte Denizet
95f9bedc7c [Editor] Disable annotation layer when highlighting (bug 1868759)
When highlighting, the annotation editor layer is disabled to get pointer events
from the text layer, but the annotation layer must be then disabled either in
order to avoid bad interactions.
2024-02-20 21:17:05 +01:00
Tim van der Meij
fd5d040073
Merge pull request #17667 from Snuffleupagus/createPrintService-params
Change `PDFPrintServiceFactory.createPrintService` to take a parameter object
2024-02-17 14:54:53 +01:00
Jonas Jenwald
b420bd8b20 Access PDFViewerApplication.findBar safely in more spots (PR 15831 follow-up)
Note that this patch is the result of code-inspection, and the code as written doesn't (currently) cause any bugs in e.g. the GeckoView PDF Viewer.
2024-02-15 11:25:29 +01:00
Jonas Jenwald
a204f434f3 Change PDFPrintServiceFactory.createPrintService to take a parameter object
By "modernizing" the method to use a parameter object instead, we avoid having to pass along the needed parameters individually.
2024-02-13 21:28:02 +01:00
calixteman
5cfaff508c
Merge pull request #17651 from calixteman/add_enableStamp_pref
Revert "Remove the `enableStampEditor` preference" (bug 1879588)
2024-02-11 18:53:09 +01:00
calixteman
9980447d25
Merge pull request #17652 from calixteman/editor_disable_thickness
[Editor] Disable the thickness slider for non-free highlight
2024-02-11 18:32:36 +01:00
Jonas Jenwald
485e9cecd7
Merge pull request #17646 from Snuffleupagus/app-break-import-cycles
Break import cycles, in the viewer, for `PDFViewerApplication`
2024-02-10 23:22:49 +01:00
Jonas Jenwald
e98b9b019a Break import cycles, in the viewer, for PDFViewerApplication
Currently the `web/app.js` file pulls in various build-specific dependencies, via the use of import maps, and those files in turn import from `web/app.js` thus creating undesirable import cycles.
To avoid this we instead pass in a `PDFViewerApplication`-reference, immediately after it's been created, to the relevant code.

Note that we use an ESLint plugin rule, see `import/no-cycle`, that is normally able to catch import cycles. However, in this case import maps are involved which is why this wasn't caught.
2024-02-10 23:15:57 +01:00
Calixte Denizet
b5e446213e [Editor] Disable the thickness slider for non-free highlight 2024-02-09 22:54:53 +01:00
Calixte Denizet
bcc95460b6 Revert "Remove the enableStampEditor preference" (bug 1879588)
This reverts commit e820688510.
2024-02-09 18:21:21 +01:00
Calixte Denizet
c4ac7eef95 [Editor] Correctly rotate the mask when rotation a free highlight (bug 1879102) 2024-02-08 15:29:29 +01:00
Calixte Denizet
3f68a08ef3 [Editor] Set the right color to size samples in the highlight thickness panelwhen in HCM (bug 1879107) 2024-02-08 14:31:10 +01:00
Jonas Jenwald
6da9448f6c Remove the web-com import map (PR 17588 follow-up)
With the changes in PR 17588 we're already importing the relevant code via the `web/app.js` file.
2024-02-07 16:33:27 +01:00
Jonas Jenwald
898172e9d2 Re-factor PDFPrintServiceFactory to use import maps
This is very old code, which can (ever so slightly) be simplified now that import maps are available.
2024-02-07 16:33:25 +01:00
calixteman
60fd9d583d
Merge pull request #17611 from calixteman/caret_browsing_mode
Implement caret browsing mode (bug 807730)
2024-02-07 10:16:52 +01:00
Calixte Denizet
81466ee039 Implement caret browsing mode (bug 807730)
The users will be able to navigate within the pdf in using the arrows
and they'll be able to select some text, for example in order to
highlight it.
2024-02-07 09:35:22 +01:00
Jonas Jenwald
363dce6744 Use a limit, in more places, when splitting strings
This should be a *tiny* bit more efficient, since it avoids parsing substrings that we don't care about.

*Please note:* I cannot find an ESLint rule to enforce this automatically.
2024-02-02 13:10:52 +01:00
Jonas Jenwald
da8297115f Point the *development mode* fallback locale-path to the l10n-folder (issue 17609, PR 17603 follow-up) 2024-02-01 13:03:36 +01:00
Calixte Denizet
081be89f54 Change file permissions for newly added cursors 2024-02-01 09:56:59 +01:00
Jonas Jenwald
f11dc611b3 Initialize the ExternalServices-instance lazily in the viewer (PR 17588 follow-up) 2024-01-31 20:22:57 +01:00
Jonas Jenwald
97c2ce9da0 Ensure that GenericL10n works if the locale files cannot be loaded
- Ensure that localization works in the GENERIC viewer, even if the necessary locale files cannot be loaded.
   This was the behaviour prior to the introduction of Fluent, and it seems worthwhile to keep that (especially since we already bundle the en-US strings anyway).

 - Let the `GenericL10n`-implementation use the *bundled* en-US strings directly when no language is provided.

 - Remove the `NullL10n`-implementation, and simply fallback to `GenericL10n`, to reduce the maintenance burden of viewer-components localization.

 - Indirectly, given the previous point, stop exporting `NullL10n` in the viewer-components since it's now removed.
   Note that it was never really intended to be used directly and only existed as a fallback.

*Please note:* This doesn't affect the Firefox PDF Viewer, thanks to the use of import maps.
2024-01-31 14:07:11 +01:00
calixteman
245fd02141
Merge pull request #17586 from calixteman/editor_freehighlight_outline_inside
[Editor] Remove the outline which is inside the free highlight shape
2024-01-30 17:56:52 +01:00
Calixte Denizet
3064361099 [Editor] Update highlight cursors 2024-01-30 16:11:18 +01:00
Calixte Denizet
b88c6f9c39 [Editor] Remove the outline which is inside the free highlight shape
When an highlight is self-intersecting, the outline was drawn inside.
In order to remove it, we use a svg mask to exclude the shape inside
when drawing the outlines.
That leads to change the outline 1px,white-2px,blue-1px,white to a
2px,white-2px,blue: the part of the stroke which is inside the shape
is removed because of the mask.
2024-01-30 14:40:56 +01:00
Nicolò Ribaudo
a352f28785
Fix transform of unary expression in Babel plugin
All of our static evaluation & dead-code elimination transforms need to
happen in post-order, transforming inner nodes first. This is so that
in complex nested cases all transforms see the simplified version of
their inner nodes.

For example:
  async getNimbusExperimentData() {
    if (!PDFJSDev.test("GECKOVIEW")) { return null; }
    // other code
  }
-> [evaluation of PDFJSDev.*]
  async getNimbusExperimentData() {
    if (!false) { return null; }
    // other code
  }
-> [!false -> true]
  async getNimbusExperimentData() {
    if (true) { return null; }
    // other code
  }
-> [if (true) -> replace with the if branch]
  async getNimbusExperimentData() {
    return null;
    // other code
  }
-> [early return -> remove dead code]
  async getNimbusExperimentData() {
    return null;
    // other code
  }

This was done correctly in all cases except for our `UnaryExpression`
transform, which was happening in pre-order.
2024-01-29 11:53:17 +01:00
Jonas Jenwald
eb36fd375c Move the debuggerSrc-parameter into the AppOptions
Having this parameter among a list of DOM-elements seems slightly strange now, however this is very old code hence the explanation for why this was done is for historical reasons (as is often the case).
Hence we can simply move this into `AppOptions` instead, which seems more appropriate overall.
2024-01-28 18:47:51 +01:00
Jonas Jenwald
f394031c1d [GENERIC viewer] Generate the fileInput DOM-element dynamically
Given that only the GENERIC viewer supports opening more than one PDF document, we can simplify things a tiny bit by instead generating the necessary DOM-element in JavaScript.
2024-01-28 16:51:28 +01:00
Jonas Jenwald
c6594b73a7 Stub out the getNimbusExperimentData method in "regular" MOZCENTRAL builds 2024-01-27 13:12:54 +01:00
Jonas Jenwald
5dd25b6e80 Re-factor DefaultExternalServices into a regular class, without static methods
The `DefaultExternalServices` code, which is used to provide build-specific functionality, is very old. This results in a pattern where we first initialize `PDFViewerApplication.externalServices` and then *override* it for the different builds.

By converting `DefaultExternalServices` into a "regular" class, and leveraging import maps, we can directly initialize the correct instance depending on the build.
2024-01-27 12:07:15 +01:00
Jonas Jenwald
d1080e785a Remove the createPreferences method from DefaultExternalServices
Given the simplicity of the `createPreferences` method, we can leverage import maps to directly initialize the correct `Preferences`-instance depending on the build.
2024-01-27 11:38:42 +01:00
Jonas Jenwald
1698991ae2 Remove the createDownloadManager method from DefaultExternalServices
Given the simplicity of the `createDownloadManager` method, we can leverage import maps to directly initialize the correct `DownloadManager`-instance depending on the build.
2024-01-27 11:38:36 +01:00
calixteman
d8f77e6b84
Merge pull request #17582 from calixteman/editor_highlight_thickness_tooltip
[Editor] Add a tooltip to the slider to set the thickness of free highlights
2024-01-26 19:20:08 +01:00
calixteman
e63fafd0fb
Merge pull request #17581 from calixteman/editor_highlight_cursor
[Editor] Change the cursors for highlighting (bug 1876588)
2024-01-26 18:52:29 +01:00
Jonas Jenwald
3192d37aa7
Merge pull request #17587 from Snuffleupagus/fix-FontInspector-textLayer-opacity
Fix the textLayer-opacity when using the FontInspector (PR 17533 follow-up)
2024-01-26 18:37:50 +01:00
Calixte Denizet
0432d1e8e6 [Editor] Add a tooltip to the slider to set the thickness of free highlights 2024-01-26 18:34:26 +01:00
Jonas Jenwald
fed3ef1743 Fix the textLayer-opacity when using the FontInspector (PR 17533 follow-up) 2024-01-26 18:31:38 +01:00
Calixte Denizet
f3bdbedf9b [Editor] Change the cursors for highlighting (bug 1876588) 2024-01-26 18:17:05 +01:00