Commit Graph

18675 Commits

Author SHA1 Message Date
Calixte Denizet
c4ac7eef95 [Editor] Correctly rotate the mask when rotation a free highlight (bug 1879102) 2024-02-08 15:29:29 +01:00
calixteman
d7479a59b7
Merge pull request #17638 from calixteman/bug1879107
[Editor] Set the right color to size samples in the highlight thickness panelwhen in HCM (bug 1879107)
2024-02-08 15:25:14 +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
Jonas Jenwald
6a78cf0d93 Remove support for require statements from the build system
This part of the (modern) preprocessor is now dead code, since we no longer use `require` statements anywhere in the main code-base.

Note that as part of the changes leading up to PDF.js version `4` we removed all[1] the remaining `require` statements, and we also have an ESLint rule to ensure that no new ones are accidentally added.

---
[1] With two small exceptions, in benchmarking-code and in the Webpack-example.
2024-02-07 13:34:46 +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
Tim van der Meij
7d9cc49010
Merge pull request #17620 from Snuffleupagus/PDFDataTransportStream-signature
Simplify the signature of the `PDFDataTransportStream` constructor
2024-02-04 15:24:26 +01:00
Jonas Jenwald
06cd278808 Simplify the signature of the PDFDataTransportStream constructor
Given that we need to pass in a `PDFDataRangeTransport`-instance a number of the needed parameters can be obtained from it, rather than having to specify them manually.
2024-02-03 13:10:42 +01:00
Jonas Jenwald
247af2ee09
Merge pull request #17619 from Snuffleupagus/string-split-limit
Use a limit, in more places, when splitting strings
2024-02-02 15:04:12 +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
af4d2fa53c
Merge pull request #17610 from Snuffleupagus/createBundleFallback-dev-path
Point the *development mode* fallback locale-path to the `l10n`-folder (issue 17609, PR 17603 follow-up)
2024-02-01 14:22:19 +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
calixteman
cbbd1fcaa3
Merge pull request #17608 from wojtekmaj/fix-annotation-layer-parameters
Make downloadManager optional in AnnotationLayerParameters
2024-02-01 12:06:27 +01:00
Wojciech Maj
f80ba44fb0
Make downloadManager optional in AnnotationLayerParameters
Continuation of fix started in #17038
2024-02-01 11:08:12 +01:00
calixteman
49bcce27c1
Merge pull request #17605 from calixteman/file_perm
Change file permissions for newly added cursors
2024-02-01 10:00:28 +01:00
Calixte Denizet
081be89f54 Change file permissions for newly added cursors 2024-02-01 09:56:59 +01:00
Jonas Jenwald
eb5c1d441a
Merge pull request #17604 from Snuffleupagus/externalServices-lazy-init
Initialize the `ExternalServices`-instance lazily in the viewer (PR 17588 follow-up)
2024-01-31 22:12:52 +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
9588bceff5
Merge pull request #17603 from Snuffleupagus/GenericL10n-fallback
Ensure that `GenericL10n` works if the locale files cannot be loaded
2024-01-31 15:16:48 +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
833d7ac830
Merge pull request #17602 from calixteman/editor_free_highlight_lastpoint
[Editor] Fix the position of the free highlight toolbar
2024-01-30 20:34:47 +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
calixteman
f7ed040aa6
Merge pull request #17598 from calixteman/update_highlight_cursors
[Editor] Update highlight cursors
2024-01-30 17:16:04 +01:00
Calixte Denizet
3064361099 [Editor] Update highlight cursors 2024-01-30 16:11:18 +01:00
Calixte Denizet
7529c1e3dc [Editor] Fix the position of the free highlight toolbar 2024-01-30 15:40:33 +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
Jonas Jenwald
56dabe9390
Merge pull request #17596 from nicolo-ribaudo/fix-babel-plugin
Fix transform of unary expression in Babel plugin
2024-01-29 12:57:42 +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
802f702695
Merge pull request #17593 from Snuffleupagus/debuggerSrc-AppOptions
Move the `debuggerSrc`-parameter into the `AppOptions`
2024-01-28 18:54:15 +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
Tim van der Meij
2e2127cbb5
Merge pull request #17592 from Snuffleupagus/viewer-generate-fileInput
[GENERIC viewer] Generate the `fileInput` DOM-element dynamically
2024-01-28 18:11:21 +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
Tim van der Meij
32a5bb83d4
Merge pull request #17591 from Snuffleupagus/issue-17399
Re-enable the `should compress and save text` unit-test (issue 17399)
2024-01-28 14:47:52 +01:00
Jonas Jenwald
384291234d Re-enable the should compress and save text unit-test (issue 17399)
This unit-test is now failing in up to date versions of Node.js respectively Chromium-browsers, since `CompressionStream` no longer produces consistent data across all environments/browsers.
However logging the compressed TypedArray produced by `writeStream`, with Firefox respectively Chrome, and then feeding *both* of those TypedArray as input to `DecompressionStream` produced the same (correct) result in both browsers.

Hence the *exact* output of `CompressionStream` shouldn't matter, as long as we're able to successfully decompress it when the resulting PDF document is opened with the PDF.js library, and the unit-test is thus extended to check this.
2024-01-28 14:31:07 +01:00
Tim van der Meij
ab392584f3
Merge pull request #17590 from timvandermeij/updates
Update dependencies/translations to the most recent versions
2024-01-28 12:10:20 +01:00
Tim van der Meij
94309edc9a
Disable the "should compress and save text" unit test in Chrome too
Starting with Chrome 120.0.6099.109 (shipped with Puppeteer 21.8.0+) the
unit test fails in Chrome as well. The issue is tracked in #17399, but
for now we'll only run the unit test in Firefox so we can continue to
update Puppeteer while also still having a browser in which it runs,
until we figure out why the behavior of `CompressionStream` changed.
2024-01-27 20:34:30 +01:00
Tim van der Meij
f103f277ac
Update translations to the most recent versions 2024-01-27 19:13:06 +01:00
Tim van der Meij
f855a6dae8
Update dependencies to the most recent versions 2024-01-27 19:12:59 +01:00
Tim van der Meij
a6e0b0292e
Merge pull request #17588 from Snuffleupagus/DefaultExternalServices-lighten
Re-factor `DefaultExternalServices` into a regular class, without static methods
2024-01-27 14:13:49 +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