Commit Graph

14260 Commits

Author SHA1 Message Date
Jonas Jenwald
edc38de37a Convert PartialEvaluator.buildToUnicode to an async method
This removes the need to *manually* wrap all return values in a Promise.
2021-06-14 15:05:14 +02:00
Jonas Jenwald
3660aaac85 Tweak adjustToUnicode to allow extending a built-in /ToUnicode map
*This is somewhat similiar to the recent changes, in PR 13277, for fonts with an /Encoding entry.*

Currently we're *completely* ignoring the `builtInEncoding`, from the font data itself, for fonts which have a built-in /ToUnicode map.
While it (obviously) doesn't seem like a good idea in general to simply overwrite existing built-in /ToUnicode entries, it should however not hurt to use the `builtInEncoding` to supplement *missing* /ToUnicode entires.
2021-06-14 15:05:14 +02:00
calixteman
246d565e3b
Merge pull request #13559 from calixteman/maxlength
XFA - Handle maxChars property for text fields
2021-06-14 14:21:04 +02:00
Calixte Denizet
d89c429d78 XFA - Handle maxChars property for text fields
- it aims to fix https://bugzilla.mozilla.org/show_bug.cgi?id=1716294.
2021-06-14 13:07:06 +02:00
calixteman
9d081d09c7
Merge pull request #13557 from calixteman/issue13556
XFA - Fix error when creating a new data node
2021-06-14 12:17:45 +02:00
Calixte Denizet
150fa3d96e XFA - Fix error when creating a new data node
- fix for issue #13556;
  - value in a field can be empty.
2021-06-14 11:33:08 +02:00
calixteman
a4e8f3bdee
Merge pull request #13555 from calixteman/value
XFA - Value in field can be html
2021-06-14 10:53:17 +02:00
Calixte Denizet
088db47849 XFA - Value in field can be html 2021-06-13 19:50:28 +02:00
calixteman
96c103462a
Merge pull request #13548 from calixteman/default_fill
XFA - Default fill color for rectangle is transparent
2021-06-13 14:11:22 +02:00
Tim van der Meij
e1a5339961
Merge pull request #13552 from Snuffleupagus/update-packages
Update packages and translations
2021-06-13 13:31:54 +02:00
Jonas Jenwald
59f72bbde1 Update l10n files 2021-06-13 10:35:58 +02:00
Jonas Jenwald
014148b28a Update the eslint-plugin-unicorn package to the latest version 2021-06-13 10:35:58 +02:00
Jonas Jenwald
99dc7af590 Update npm packages 2021-06-13 09:59:44 +02:00
Tim van der Meij
a4546e83c3
Merge pull request #13549 from Snuffleupagus/rm-isFetchSupported
Remove the `isFetchSupported` function since the Fetch API is available in all supported browsers
2021-06-12 11:47:04 +02:00
Jonas Jenwald
ddea90b8f6 Remove the isFetchSupported function since the Fetch API is available in all supported browsers
The currently supported browsers, note the minimum versions [listed here](5a4e06af2d/gulpfile.js (L78-L88)), should now have native support for all of the features checked in the `isFetchSupported` function:

 - https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API#browser_compatibility
 - https://developer.mozilla.org/en-US/docs/Web/API/Response#browser_compatibility
 - https://developer.mozilla.org/en-US/docs/Web/API/Body/body#browser_compatibility
 - https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream#browser_compatibility

Hence this function can now be removed, and the code can thus be simplified a little bit.
2021-06-12 08:01:54 +02:00
Brendan Dahl
5a4e06af2d
Merge pull request #13547 from calixteman/cerfa
XFA - Handle correctly subformSet
2021-06-11 13:09:43 -07:00
Tim van der Meij
c7c59feeaf
Merge pull request #13546 from Snuffleupagus/base_factory-tweaks
Re-factor the `DOMCanvasFactory` and `DOMSVGFactory` implementations slightly
2021-06-11 21:19:11 +02:00
Calixte Denizet
694b14c047 XFA - Default fill color for rectangle is transparent 2021-06-11 18:03:19 +02:00
calixteman
2dc22394e7
Merge pull request #13542 from calixteman/center_radio
XFA - Center vertically radio without caption
2021-06-11 17:55:55 +02:00
Calixte Denizet
d1e945998b XFA - Handle correctly subformSet
- it aims to avoid to loop forever when opening pdf in #13213;
  - the idea is to consider subformSet as inexistent when running in the tree. So if we've subformA > subformSet > subformB then subformB will be visited as a direct child of subformA.
2021-06-11 17:49:17 +02:00
Jonas Jenwald
7b17dc8bfd Re-factor the fetchData helper function, in src/display/display_utils.js to be asynchronous 2021-06-11 17:16:00 +02:00
Jonas Jenwald
b05a22d01b Re-factor the DOMSVGFactory to extend an abstract base class
This is first of all consistent with all of the other (similar) factories, and secondly it will also simplify a future addition of a corresponding `NodeSVGFactory` (if that's ever deemed necessary).
2021-06-11 17:15:49 +02:00
Jonas Jenwald
d10b850916 Move most functionality in the create methods into the BaseCanvasFactory
This *slightly* reduces the amount of code duplication in the `DOMCanvasFactory.create` and `NodeCanvasFactory.create` methods.
2021-06-11 17:15:47 +02:00
Calixte Denizet
da4916e3c1 XFA - Center vertically radio without caption
- and fix intent value which is used to name the radio button group.
2021-06-11 13:24:45 +02:00
calixteman
7b4fa0a038
Merge pull request #13540 from calixteman/13536
XFA - Return html element for the different possible value
2021-06-11 13:12:26 +02:00
Calixte Denizet
367d1ad137 XFA - Return html element for the different possible value
- it aims to fix #13536.
2021-06-11 11:51:54 +02:00
calixteman
950dcc7e9f
Merge pull request #13539 from calixteman/outline
XFA - Don't show outline on focused textfields
2021-06-11 09:53:03 +02:00
Calixte Denizet
897a679723 XFA - Don't show outline on focused textfields 2021-06-11 09:25:14 +02:00
Brendan Dahl
a3b0596cf2
Merge pull request #13534 from calixteman/missing_page
XFA - Flush contents when breakBefore target is 'auto'
2021-06-10 13:17:20 -07:00
Brendan Dahl
02c03795f3
Merge pull request #13532 from calixteman/radio
XFA - Give all the available space to the caption in case of checkButton
2021-06-10 12:30:49 -07:00
Jonas Jenwald
5bcba783cf
Merge pull request #13530 from Snuffleupagus/DOMMatrix-Node
Add a `DOMMatrix` polyfill for Node.js environments (PR 13361 follow-up)
2021-06-10 21:15:05 +02:00
Jonas Jenwald
3bd24d8d5a Throw errors directly, rather than using assert, in the DOMSVGFactory
This is similar to all of the other factories in this file, since they *directly* throw errors.
2021-06-10 21:08:23 +02:00
Jonas Jenwald
26011c65f4 Add a DOMMatrix polyfill for Node.js environments (PR 13361 follow-up)
Given that `DOMMatrix` is, unsurprisingly, not supported in Node.js the `createMatrix` helper function in `src/display/pattern_helper.js` is most likely broken in Node.js environments. It will obviously try to fallback to the `DOMSVGFactory`, however that isn't intended for Node.js usage and errors will be thrown.

Rather than trying to implement a `NodeSVGFactory`, this patch takes the easier route of just adding a `DOMMatrix` polyfill using: https://www.npmjs.com/package/dommatrix
This isn't done only for simplicity, but it'll become necessary anyway since the `createMatrix` helper function is only temporary and will be removed in the future.
2021-06-10 21:08:23 +02:00
Calixte Denizet
d7d53e7c6c XFA - Flush contents when breakBefore target is 'auto'
- some page can be missed in the final document because of that (see pdf in the test case which has 4 pages (when only 3 are rendered right now)
2021-06-10 17:15:08 +02:00
Calixte Denizet
58633ab9fd XFA - Give all the available space to the caption in case of checkButton
- a checkbox or radio doesn't have to be rescaled when the container is large so give the extra space to the caption to avoid some word wrapping.
  - when the caption is on the right, then put ui on the left as first element and so remove flex:row-reverse stuff.
2021-06-10 15:30:23 +02:00
Jonas Jenwald
cbcf0f7d1e
Merge pull request #13529 from Snuffleupagus/bundle-Liberation-license
Bundle the license-file for the Liberation fonts in the builds (PR 13517 follow-up)
2021-06-10 10:30:52 +02:00
Jonas Jenwald
8f3f76f8f6 [gulpfile.js] Reduce unnecessary duplication when bundling CMap/StandardFont files
Rather than repeating the exact same code in multiple `gulp`-tasks, we can extract it into two helper functions instead.
2021-06-10 00:12:59 +02:00
Jonas Jenwald
16d9fa1bf1 Bundle the license-file for the Liberation fonts in the builds (PR 13517 follow-up)
Currently only the Foxit license-file is included, which is most likely just an oversight as far as I can tell.
Furthermore, to be able the tell the two license-files apart, the Foxit one is also renamed slightly.
2021-06-10 00:11:47 +02:00
Brendan Dahl
c4cb71b68d
Merge pull request #13528 from calixteman/inline
XFA - Handle caption with inline placement as left one
2021-06-09 13:44:31 -07:00
Calixte Denizet
3bd936709c XFA - Handle caption with inline placement as left one
- it's just a temporary workaround to unblock release in Firefox.
2021-06-09 22:13:48 +02:00
Brendan Dahl
d333af7848
Merge pull request #13527 from calixteman/bind_inf_loop
XFA - Avoid infinite loop when creating some nodes in data
2021-06-09 12:37:29 -07:00
Brendan Dahl
aa2712744d
Merge pull request #13502 from calixteman/contentarea
XFA - contentarea must be on top of the other containers in a pageArea
2021-06-09 12:36:21 -07:00
Tim van der Meij
a5233f47f2
Merge pull request #13516 from Snuffleupagus/standard-fonts-disableFontFace
Always use standard font data, with `disableFontFace` set in the API (PR 12726 follow-up)
2021-06-09 21:35:37 +02:00
Jonas Jenwald
69477bfb06 Always use standard font data, with disableFontFace set in the API (PR 12726 follow-up)
We must force-fetch standard font data, when `disableFontFace = true` is set in the API, since otherwise rendering in e.g. the viewer is still broken (same as before PR 12726 landed).

*Please note:* We still need to also load standard font data for patterns and/or some text-rendering modes, however that will require larger changes so I figured that it cannot hurt to submit *this* patch right now.
2021-06-09 21:21:02 +02:00
Tim van der Meij
2a65455c71
Merge pull request #13525 from Snuffleupagus/api-conditional-Factory
[api-minor] Re-factor the `disableFontFace` fallback value, and skip initializing factories with `useWorkerFetch` set
2021-06-09 21:15:39 +02:00
Tim van der Meij
2a7827a7c6
Merge pull request #13515 from Snuffleupagus/standardFontDataCache
Cache the "raw" standard font data in the worker-thread (PR 12726 follow-up)
2021-06-09 21:06:01 +02:00
Calixte Denizet
cddc1d869d XFA - Avoid infinite loop when creating some nodes in data 2021-06-09 19:07:59 +02:00
Jonas Jenwald
a01c599247 Cache the "raw" standard font data in the worker-thread (PR 12726 follow-up)
*This implementation is basically a copy of the pre-existing `builtInCMapCache` implementation.*

For some, badly generated, PDF documents it's possible that we'll end up having to fetch the *same* standard font data over and over (which is obviously inefficient).
While not common, it's certainly possible that a PDF document uses *custom* font names where the actual font then references one of the standard fonts; see e.g. issue 11399 for one such example.

Note that I did suggest adding worker-thread caching of standard font data in PR 12726, however it wasn't deemed necessary at the time. Now that we have a real-world example that benefit from caching, I think that we should simply implement this now.
2021-06-09 18:27:51 +02:00
calixteman
6d88d8cdaa
Merge pull request #13517 from calixteman/liberation
XFA - Add Liberation-Sans font as a substitution for some missing fonts
2021-06-09 18:19:07 +02:00
calixteman
63bde1fcfe
Merge pull request #13524 from calixteman/print_select
XFA - Don't print arrow in select
2021-06-09 16:56:39 +02:00