Commit Graph

17432 Commits

Author SHA1 Message Date
Jonas Jenwald
a6f9505a39
Merge pull request #16461 from Snuffleupagus/issue-16454
Improve "EI" detection in inline images (PR 12028 follow-up, issue 16454)
2023-05-23 22:23:22 +02:00
calixteman
1886012874
Merge pull request #16462 from calixteman/last_elem_TJ
Take into account the final space if any in the TJ command
2023-05-23 21:26:58 +02:00
calixteman
7cfe00a190
Merge pull request #16445 from calixteman/smoothing
[Editor] Improve curve smoothing for Ink tool (bug 1789443)
2023-05-23 19:20:24 +02:00
Calixte Denizet
d2b4ed3cea [Editor] Improve curve smoothing for Ink tool (bug 1789443)
- Remove the dependency on fit-curve;
- Improve the way to draw the current line in using a Path2D and
  in clearing only the last part of the curve instead of clearing
  all the canvas;
- Smooth the curve when drawing to avoid to have some changes after
  the drawing ends;
- Make the smoothing a bit less agressive.
2023-05-23 17:15:21 +02:00
Calixte Denizet
a76a69e1ed Take into account the final space if any in the TJ command
The final space was just ignored and that led to wrongly position
the next chunk of text.
2023-05-23 17:09:32 +02:00
Jonas Jenwald
dfbbb8c0ac Improve "EI" detection in inline images (PR 12028 follow-up, issue 16454)
Given that inline images may contain "EI"-sequences in the image-data itself, actually finding the end-of-image operator isn't always straightforward.
Here we extend the implementation from PR 12028 to potentially check all of the following bytes, rather than stopping immediately. While we have fairly decent test-coverage for this code, whenever you're changing it there's unfortunately a slightly higher than normal risk of regressions. (You'd really wish that PDF generators just stop using inline images.)
2023-05-23 17:04:51 +02:00
calixteman
094fb3c783
Merge pull request #16453 from calixteman/gv_telemetry
[GeckoView] Add some telemetry for the toolbar buttons (bug 1829216)
2023-05-22 17:08:43 +02:00
Calixte Denizet
7f1e8d1920 [GeckoView] Add some telemetry for the toolbar buttons (bug 1829216) 2023-05-22 16:43:09 +02:00
calixteman
1c4e4b4092
Merge pull request #16450 from calixteman/issue16300
Sanitize the glyph bounding box
2023-05-21 17:40:36 +02:00
Calixte Denizet
ca12bca276 Sanitize the glyph bounding box
- if the contours count is lower than -1, the glyph is really likely wrong
so just remove it from the font;
- if a contour has the repeat flag then repeats count mustn't be 0.
2023-05-21 16:24:41 +02:00
Tim van der Meij
d09c27d231
Merge pull request #16449 from Snuffleupagus/attachments-viewer-rm-sort
Stop trying to sort the attachments in the sidebar
2023-05-21 12:25:28 +02:00
Jonas Jenwald
14fd59c4d0 Stop trying to sort the attachments in the sidebar
Looking at the behaviour in Adobe Reader it doesn't appear that attachments are sorted alphabetically, hence it doesn't seem necessary for us to do so either in the viewer.
An additional benefit of *not* sorting the attachments is that any "actual" attachments are now always placed at the top of the list in the sidebar, and if any `FileAttachment`-annotations exist in the document they will now be appended at the end.
2023-05-21 09:54:24 +02:00
calixteman
65e23432cd
Merge pull request #16448 from calixteman/improve_rescaleandstroke
Improve performance of canvas::rescaleAndStroke by around 30% (bug 1135277)
2023-05-20 21:06:40 +02:00
Calixte Denizet
e5454be0f2 Improve performance of canvas::rescaleAndStroke by around 30%
The pdf linked in bug 1135277 contains a lot of stroke instructions.
In using the Firefox profiler, this patch helps to reduce the overall
spent time in this function by 30%.
2023-05-20 18:21:25 +02:00
Tim van der Meij
1d74936ea9
Merge pull request #16446 from Snuffleupagus/bug-1365930
Extend `getNonStdFontMap` for non-embedded Impact fonts (bug 1365930)
2023-05-20 12:20:52 +02:00
Jonas Jenwald
f657de7de2 Extend getNonStdFontMap for non-embedded Impact fonts (bug 1365930)
According to https://en.wikipedia.org/wiki/Impact_(typeface) this font should be available on all current versions of Windows, and with the recently added font-substitution we should actually be able to render it correctly (at least on Windows).
2023-05-19 18:40:03 +02:00
Tim van der Meij
38287d9435
Merge pull request #16443 from Snuffleupagus/idFactory-shorter
[api-minor] Slightly shorten some `idFactory` strings
2023-05-19 11:36:06 +02:00
Jonas Jenwald
8c4821ceda [api-minor] Slightly shorten the marked-content ids used in the textLayer
Generally we try to keep the ids that we create short, hence we can slightly shorten the "static" parts of them.
2023-05-18 22:32:10 +02:00
Jonas Jenwald
04de155aaa Slightly shorten the loadedName-ids used with font-substitutions
Generally we try to keep the ids that we create short, hence we can slightly shorten the "static" part of them.
2023-05-18 22:27:11 +02:00
Jonas Jenwald
3be66f59d6
Merge pull request #16440 from Snuffleupagus/more-modern-JS
Introduce even more modern JavaScript features in the code-base
2023-05-18 20:56:00 +02:00
calixteman
e8537e4d30
Merge pull request #16439 from calixteman/issue14755
Flush the current chunk when the font changed because of a restore op (issue #14755)
2023-05-18 20:10:31 +02:00
Calixte Denizet
3091e70aad Flush the current chunk when the font changed because of a restore op (issue #14755) 2023-05-18 19:37:16 +02:00
Jonas Jenwald
e8030752f3 Introduce even more modern JavaScript features in the code-base
After PR 12563 we're now free to use e.g. logical OR assignment, nullish coalescing, and optional chaining in the entire code-base.
2023-05-18 18:55:41 +02:00
calixteman
a24d5b629e
Merge pull request #16438 from mozilla/loc_note_openinapp
Add a localization note to explain that 'Open in app' strings are for mobile (bug 1833858)
2023-05-18 17:27:39 +02:00
Marco Castelluccio
77f8fd91ec Add a localization note to explain that 'Open in app' strings are for mobile (bug 1833858) 2023-05-18 16:43:12 +02:00
Jonas Jenwald
356f3cf285
Merge pull request #16437 from Snuffleupagus/loadFont-simpler-fontID
Simplify the `fontID` handling in `PartialEvaluator.loadFont`
2023-05-18 13:36:00 +02:00
Jonas Jenwald
4355e76c60 Simplify the fontID handling in PartialEvaluator.loadFont
The `fontID` handling is quite old and predates the use of the `idFactory` to generate a unique id for each font, hence we can simplify this code a little bit.
2023-05-18 13:09:08 +02:00
Tim van der Meij
ac8032628b
Merge pull request #16424 from Snuffleupagus/core-optional-chaining
Introduce more optional chaining in the `src/core/` folder
2023-05-18 12:40:08 +02:00
calixteman
839be801a0
Merge pull request #16433 from calixteman/bug1825002
For text widgets, get the text from the AP stream instead of from the format callback (bug 1825002)
2023-05-17 16:48:59 +02:00
Calixte Denizet
177036e6ae For text widgets, get the text from the AP stream instead of from the format callback (bug 1825002)
When fixing bug 1766987, I thought the field formatted value came from
the result of the format callback: I was wrong. The format callback is ran
but the value is unused (maybe it's useful to set some global vars... or
it's just a bug in Acrobat). Anyway the value to display is the one rendered
in the AP stream.
The field value setter has been simplified and that fixes issue #16409.
2023-05-17 14:07:28 +02:00
Jonas Jenwald
46bbabbd5d
Merge pull request #16434 from Snuffleupagus/issue-16432
Attempt to fallback to a default font, for non-available ones, in more cases (issue 16432)
2023-05-17 12:30:08 +02:00
Jonas Jenwald
bfb374dbf6 Attempt to fallback to a default font, for non-available ones, in more cases (issue 16432)
This essentially extends PR 11218 to also apply when looking up the final font-reference, via the XRef-table, fails because the font isn't available.

This patch also changes `PartialEvaluator.fallbackFontDict` to simply use "Helvetica" as the default font-name, since that seems generally reasonable given the now existing font-substitution code.
2023-05-17 11:41:08 +02:00
calixteman
5ae353cf4d
Merge pull request #16431 from calixteman/warn_missing_os_font
Warn when pdf.js can't load an OS font
2023-05-16 15:25:16 +02:00
Calixte Denizet
385f275ad9 Warn when pdf.js can't load an OS font 2023-05-16 14:58:38 +02:00
Jonas Jenwald
95ab2b8b17
Merge pull request #16430 from Snuffleupagus/npm-lockfile-version-3
Update `package-lock.json` to lockfileVersion=3
2023-05-16 10:14:00 +02:00
Jonas Jenwald
cc46d303e9 Update package-lock.json to lockfileVersion=3
This reduces the size of the `package-lock.json` file a lot, and given that we recently updated the minimum supported Node.js version to 18 this shouldn't be a problem; please also see
 - https://docs.npmjs.com/cli/v9/configuring-npm/package-lock-json#lockfileversion
 - https://docs.npmjs.com/cli/v9/using-npm/config?v=true#lockfile-version
2023-05-16 09:50:57 +02:00
calixteman
2c0478ecb2
Merge pull request #16426 from calixteman/generate_fallback_one_time
For non-embedded fonts, don't generate the fallback several times
2023-05-15 21:25:29 +02:00
Calixte Denizet
4e8dd54e8e For non-embedded fonts, don't generate the fallback several times 2023-05-15 20:02:45 +02:00
calixteman
107874fcd4
Merge pull request #16420 from calixteman/simplify_subst
Simplify the code to generate font substitution information
2023-05-15 19:58:53 +02:00
Calixte Denizet
b264e0301a Simplify the code to generate font substitution information 2023-05-15 19:17:52 +02:00
calixteman
5f91d39f13
Merge pull request #16425 from calixteman/gv_nimbus
[GeckoView] Add a Nimbus experiment for the toolbar (bug 1833093)
2023-05-15 18:26:28 +02:00
Calixte Denizet
4ed512ab2c [GeckoView] Add a Nimbus experiment for the toolbar (bug 1833093) 2023-05-15 17:18:14 +02:00
Jonas Jenwald
1b4a7c5965 Introduce more optional chaining in the src/core/ folder
After PR 12563 we're now free to use optional chaining in the worker-thread as well. (This patch also fixes one previously "missed" case in the `web/` folder.)

For the MOZCENTRAL build-target this patch reduces the total bundle-size by `1.6` kilobytes.
2023-05-15 12:38:28 +02:00
Jonas Jenwald
c20c1b3362
Merge pull request #16422 from Snuffleupagus/getFontSubstitution-css-tests
Check the `css` property in the `getFontSubstitution` unit-tests
2023-05-15 10:09:17 +02:00
Jonas Jenwald
cb1a10e358 Check the css property in the getFontSubstitution unit-tests
Given that the `css` property isn't constant, since it contains document/font ids, we cannot just check it directly. However, we can make use of regular expressions to ensure that the format is generally correct.
2023-05-14 19:11:35 +02:00
calixteman
4101128c09
Merge pull request #16421 from calixteman/font_subst_test
Add tests for the font substitution
2023-05-14 18:23:12 +02:00
Calixte Denizet
89140fcd98 Add tests for the font substitution 2023-05-14 18:07:03 +02:00
Jonas Jenwald
9cbc2c389f
Merge pull request #16418 from Snuffleupagus/jasmine-5
Update `jasmine` to version 5
2023-05-14 14:03:46 +02:00
Jonas Jenwald
95ac708fbd Update jasmine to version 5
Despite this being a *major* version increase, it doesn't appear to require any updates in our test-suites.
Note in particular that the minimum supported browsers/environments were updated, however this isn't a problem given our recent support-changes in the PDF.js library.

Please find additional details at https://github.com/jasmine/jasmine/blob/main/release_notes/5.0.0.md
2023-05-14 13:04:08 +02:00
Tim van der Meij
693092c980
Merge pull request #16415 from Snuffleupagus/no-useless-promise-resolve-reject
Enable the `unicorn/no-useless-promise-resolve-reject` ESLint plugin rule
2023-05-14 12:41:11 +02:00