1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 14:48:08 +02:00
Commit graph

19903 commits

Author SHA1 Message Date
Calixte Denizet
d114f71feb Always fill the mask with the backdrop color
It fixes #18956.

In the patch #18029, for performance reasons and because I thought it was useless, I deliberately chose to not fill the mask
with the backdrop color when it's full black: it was a bad idea.
So in this patch we always add the backdrop color to the mask.
2024-10-26 14:14:51 +02:00
Jonas Jenwald
b048420d21 [api-minor] Remove the CMapCompressionType enumeration
After the binary CMap format had been added there were also some ideas about *maybe* providing other formats, see [here](https://github.com/mozilla/pdf.js/pull/8064#issuecomment-279730182), however that was over seven years ago and we still only use binary CMaps.
Hence it now seems reasonable to simplify the relevant code by removing `CMapCompressionType` and instead just use a boolean to indicate the type of the built-in CMaps.
2024-10-24 11:08:16 +02:00
Jonas Jenwald
50c291eb33 Unconditionally cache built-in CMaps on the worker-thread
Given that we've not shipped, nor used, anything except binary CMaps for years let's just cache them unconditionally (since that's a tiny bit less code).
2024-10-24 10:15:09 +02:00
calixteman
bde36f28be
Merge pull request #18947 from calixteman/add_comment_ftl
Add a comment in l10n file for the non-standard attribute default-content
2024-10-23 15:16:18 +02:00
Calixte Denizet
c0c527266d Add a comment in l10n file for the non-standard attribute default-content 2024-10-23 15:12:52 +02:00
calixteman
1ad09779f1
Merge pull request #18910 from calixteman/image_decoder1
Use ImageDecoder in order to decode jpeg images (bug 1901223)
2024-10-23 13:54:07 +02:00
Calixte Denizet
b6c4f0b69e Use ImageDecoder in order to decode jpeg images (bug 1901223) 2024-10-23 10:42:01 +02:00
Tim van der Meij
1e07b87bb6
Merge pull request #18933 from Snuffleupagus/base-factory-fetchData
Change the `BaseCMapReaderFactory` fetch-helper to return a `Uint8Array`
2024-10-22 20:03:50 +02:00
Tim van der Meij
54a77d24eb
Merge pull request #18940 from Snuffleupagus/bug-report-PDF-placeholder
Try to discourage "unrelated" information under `Attach (recommended) or Link to PDF file` in the bug report template (PR 18535 follow-up)
2024-10-22 19:53:33 +02:00
Jonas Jenwald
49c3dc9c5f
Merge pull request #18942 from Snuffleupagus/issue-18941
Fallback to a standard font if a font-file entry doesn't contain a Stream (issue 18941)
2024-10-22 18:18:44 +02:00
Jonas Jenwald
236c8d862e Re-factor how we handle missing, corrupt, or empty font-file entries
This improves the fixes for e.g. issue 9462 and 18941 slightly and allows better fallback behaviour for non-standard fonts.
2024-10-22 17:07:12 +02:00
Jonas Jenwald
63b34114b1 Fallback to a standard font if a font-file entry doesn't contain a Stream (issue 18941)
The PDF document is clearly corrupt, since it has /FontFile2 entries that are Dictionaries which obviously isn't correct.
While there's obviously no guarantee that things will look perfect this way, actually rendering the text at all should be an improvement in general.
2024-10-22 11:51:28 +02:00
Jonas Jenwald
a809461738 Try to discourage "unrelated" information under Attach (recommended) or Link to PDF file in the bug report template (PR 18535 follow-up)
Unfortunately it turns out to be somewhat common for users to provide a bunch of "unrelated" information in this field, or even stating their entire problem there, rather than placing it under the appropriate headings further down in the template.
2024-10-22 09:23:32 +02:00
Jonas Jenwald
6c3336f04f Re-factor the DefaultFileReaderFactory unit-test helper
We can re-use the existing helpers from `src/display/` rather than re-implementing the functionality here.
2024-10-21 13:20:31 +02:00
Jonas Jenwald
df696063b9 Change the BaseCMapReaderFactory fetch-helper to return a Uint8Array
This moves more functionality into the base-class, rather than having to duplicate that in the extending classes.
For consistency, also updates the `BaseStandardFontDataFactory` and introduces more `async`/`await` in various relevant code.
2024-10-21 13:20:18 +02:00
Jonas Jenwald
d37e4b08e4
Merge pull request #18930 from Snuffleupagus/rm-duplicate-print-download-mask-image
Remove `mask-image` duplication for the print/download buttons
2024-10-21 08:31:16 +02:00
Jonas Jenwald
65b38f24ff Remove mask-image duplication for the print/download buttons
With the recent re-factoring of the viewer CSS rules we now have some duplication of the `mask-image` definitions for the print/download buttons in the secondaryToolbar; note 17419de157/web/viewer.css (L1204-L1210)
2024-10-20 21:15:09 +02:00
Tim van der Meij
17419de157
Merge pull request #18923 from timvandermeij/integration-test-text-layer
Fix the "Text selection using mouse doesn't jump when hovering on an empty area in a single page" integration test
2024-10-20 19:49:49 +02:00
Tim van der Meij
24b8393bfe
Fix the "Text selection using mouse doesn't jump when hovering on an empty area in a single page" integration test
The `getSpanRectFromText` helper function returns the location as float
values. This could be desirable in cases where the exact values matter
(for example during comparisons), but in the text layer tests we don't
need this precision. Moreover, the Puppeteer `page.mouse.move` API
apparently doesn't work correctly if float values are given as input.

Note that this test only failed because it couldn't move to the initial
selection position; any subsequent moves actually worked because the
`moveInSteps` helper function already rounded all values correctly.

This commit fixes the issue by consistently rounding all values that we
pass to Puppeteer's `page.mouse.move` API.
2024-10-20 19:42:40 +02:00
Tim van der Meij
b94ab46be5
Merge pull request #18929 from timvandermeij/eslint-perfectionist
Replace `eslint-plugin-sort-exports` by `eslint-plugin-perfectionist`
2024-10-20 19:41:37 +02:00
Jonas Jenwald
9c6f85f1f2
Merge pull request #18920 from Snuffleupagus/FreeText-l10n-default-content
Simplify localization of the "default-content" in FreeText editors
2024-10-20 19:31:34 +02:00
Tim van der Meij
347f155ebc
Replace eslint-plugin-sort-exports by eslint-plugin-perfectionist
The `eslint-plugin-sort-exports` plugin doesn't support ESLint 9 or has
published plans to do so. The `eslint-plugin-perfectionist` does support
ESLint 9 [1], seems more actively maintained [2, 3] and contains other
rules that could be interesting later on [4]. Note that both plugins
behave the same, except for two cases which are updated here.

[1] https://github.com/azat-io/eslint-plugin-perfectionist/issues/154
[2] https://github.com/azat-io/eslint-plugin-perfectionist/commits/main
[3] https://www.npmjs.com/package/eslint-plugin-perfectionist?activeTab=versions
[4] https://perfectionist.dev/rules
2024-10-20 18:50:35 +02:00
Jonas Jenwald
2ef3fd2a81 Simplify localization of the "default-content" in FreeText editors
By using "data-l10n-attrs" it's possible to instruct Fluent to localize *custom* attributes, which means that we don't need to manually translate/update the "default-content" in FreeText editors.
2024-10-20 18:46:44 +02:00
Tim van der Meij
f9659f4635
Merge pull request #18921 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2024-10-20 16:35:14 +02:00
Tim van der Meij
ccfb8a20c2
Update translations to the most recent versions 2024-10-20 15:59:03 +02:00
Tim van der Meij
b4651390bb
Update dependencies to the most recent versions 2024-10-20 15:58:59 +02:00
Tim van der Meij
29b2f26131
Merge pull request #18927 from timvandermeij/eslint-plugin-cleanup
Remove the `eslint-plugin-{fetch-options,html}` and `eslint-config-prettier` dependencies
2024-10-20 15:56:04 +02:00
Tim van der Meij
6def1c8453
Remove the eslint-config-prettier dependency
The `eslint-plugin-prettier` dependency already installs this dependency
by default nowadays, so we don't have to specify it ourselves anymore.
2024-10-20 15:38:22 +02:00
Tim van der Meij
760dd24ea0
Remove the eslint-plugin-{fetch-options,html} dependencies
The plugins have originally been introduced in commit d63da81 for the
`eslint-plugin-mozilla` dependency, but the `eslint-plugin-mozilla`
plugin got removed in commit be93d53 and we also don't use the plugins
ourselves in e.g. our `.eslintrc` files (as evidenced by `npx gulp lint`
not failing while it does fail if we remove any of the other plugins).
2024-10-20 15:38:22 +02:00
Tim van der Meij
df77401821
Merge pull request #18925 from Snuffleupagus/ci-test-Node-23
Run CI tests in Node.js version 23
2024-10-20 14:03:20 +02:00
Jonas Jenwald
6604adb5ff Run CI tests in Node.js version 23
Node.js version 23 was recently released, see https://github.com/nodejs/release#release-schedule, hence it cannot hurt to start testing in that environment.
2024-10-20 13:50:48 +02:00
Jonas Jenwald
521f5b8cdc
Merge pull request #18924 from Snuffleupagus/version-4.8
Bump library version to `4.8`
2024-10-20 12:52:16 +02:00
Jonas Jenwald
4165910fd9 Bump library version to 4.8 2024-10-20 12:49:06 +02:00
Jonas Jenwald
2a4630f89a
Merge pull request #18922 from Snuffleupagus/node-canvas-3
[api-minor] Update the `canvas` package to version 3
2024-10-20 12:42:59 +02:00
Jonas Jenwald
54e00b0104 Catch errors when invoking applyPath2DToCanvasRenderingContext
This way we allow the rest of the packages to be loaded successfully, such that e.g. the Node.js unit-tests work correctly.

Note that this occurred after updating the `node-canvas` package to version `3.0.0-rc2`, however it's not immediately clear to me if it's a problem there or in the `path2d` package; see also nilzona/path2d-polyfill/issues/84.
2024-10-20 12:39:10 +02:00
Jonas Jenwald
6ae13fac9b [api-minor] Update the canvas package to version 3
This allows us to run the Node.js unit-tests in version 22, which is good since it'll very soon become the active LTS release; see https://github.com/nodejs/release#release-schedule.
2024-10-20 12:39:08 +02:00
Tim van der Meij
025c0875b0
Merge pull request #18919 from Snuffleupagus/GrabToPan-AbortSignal
Remove event listeners with `AbortSignal` in the `GrabToPan` class
2024-10-19 13:08:10 +02:00
Jonas Jenwald
c3bbeb51e3 Remove event listeners with AbortSignal in the GrabToPan class 2024-10-19 12:01:43 +02:00
Jonas Jenwald
c88d3a31cf
Merge pull request #18888 from Snuffleupagus/MessageHandler-AbortSignal
Re-factor the `MessageHandler`-class event handler function
2024-10-18 17:27:14 +02:00
calixteman
762667b2df
Merge pull request #18916 from calixteman/bug1922766
When changing a property on a radio button then change it for the siblings (bug 1922766)
2024-10-17 20:21:00 +02:00
Calixte Denizet
86d1272d1b When changing a property on a radio button then change it for the siblings (bug 1922766) 2024-10-17 18:27:12 +02:00
Jonas Jenwald
788eabc76a Re-factor the MessageHandler-class event handler function
- Change the "message" event handler function to a private method.

 - Remove the "message" event listener with an `AbortSignal`.

 - Extend the `LoopbackPort`-class with `AbortSignal` support.
2024-10-16 10:16:27 +02:00
Jonas Jenwald
689ffda9df
Merge pull request #18902 from Snuffleupagus/pdkids-rm-linked-test
Add the `pdkids` PDF document to the repository
2024-10-15 22:15:09 +02:00
Tim van der Meij
96bced7f5b
Merge pull request #18884 from hubgit/patch-1
Handle null parentElement for selection anchor
2024-10-15 20:55:23 +02:00
Tim van der Meij
ec79316379
Merge pull request #18905 from Snuffleupagus/optionalContentConfig-determine-groups
Reduce duplication when collecting optional content groups
2024-10-15 20:46:23 +02:00
Tim van der Meij
e8149b3982
Merge pull request #18898 from Snuffleupagus/PDFViewerApplication-bindEvents-opts
Create fewer Objects in `PDFViewerApplication.bindEvents`
2024-10-15 20:34:45 +02:00
Tim van der Meij
54606e9b7b
Merge pull request #18893 from Snuffleupagus/PDFViewerApplication-rm-removeEventListener-opts
Remove unnecessary options from `removeEventListener` in the `web/app.js` file
2024-10-15 20:26:19 +02:00
Jonas Jenwald
805f962181 Reduce duplication when collecting optional content groups
After PR 18825 we can easily "compute" the optional content groups, and can thus avoid tracking them manually.
2024-10-15 13:20:30 +02:00
Jonas Jenwald
424f81c4db
Merge pull request #18825 from agrahn/rbgroups
implementing optional content radiobutton groups
2024-10-15 13:11:19 +02:00
Alexander Grahn
441efe456e Optional Content (OC) radiobutton (RB) groups implemented. Resolves #18823.
The code parses the /RBGroups entry in the OC configuration dict and adds the property `rbGroups' to instances of the OptionalContentGroup class. rbGroups takes an array of Sets, where each Set instance represents an RB group the OptionalContentGroup instance is a member of. Such a Set instance contains all OCG ids within the corresponding RB group. RB groups an OCG is associated with are processed when its visibility is set to true, as required by the PDF spec.
2024-10-15 11:34:45 +02:00