Commit Graph

14285 Commits

Author SHA1 Message Date
Jonas Jenwald
fdf2c59b8f Add a (basic) TypeScript definitions for the viewer components (issue 13267)
Please note that while the `gulp types`/`gulp typestest` tasks (obviously) still work with this patch, I've got no idea if the output is first of all even useable and secondly if it's actually useful in practice.
However, in the interest of closing some (seemingly simple) issues, I suppose that this probably shouldn't hurt (and we'd need TypeScript users to help improve things here).
2021-06-19 16:24:34 +02:00
Tim van der Meij
248efb16a7
Merge pull request #13577 from Snuffleupagus/rm-PDFScriptingManager._pageEventsReady
Remove the internal `PDFScriptingManager._pageEventsReady` boolean (PR 13074 follow-up)
2021-06-18 21:06:00 +02:00
Brendan Dahl
5d251a3a3e
Merge pull request #13566 from calixteman/layout4
XFA - Fix layout issues
2021-06-17 13:23:28 -07:00
Jonas Jenwald
5db7a3cc88 Ensure that PDFScriptingManager.setDocument handles failure when initializing the scripting-factory
This way, we'll immediately clean-up in exactly the same way as the other failure code-paths in the `PDFScriptingManager.setDocument` method.
2021-06-17 18:42:15 +02:00
Jonas Jenwald
6dc5dd194f Remove the internal PDFScriptingManager._pageEventsReady boolean (PR 13074 follow-up)
With the introduction of `PDFScriptingManager._closeCapability` in PR 13074, the pre-existing `PDFScriptingManager._pageEventsReady` boolean essentially became redundant.
Given that you always want to avoid tracking closely related state *separately*, since it's easy to introduce subtle bugs that way, we should just remove `PDFScriptingManager._pageEventsReady` now.

Obviously I *should* have done this already back in PR 13074, sorry about the churn here!
2021-06-17 18:01:10 +02:00
calixteman
3264d409dd
Merge pull request #13576 from calixteman/really_fix_text_stuff
XFA - When no fonts in the pdf just use font size as width when measuring text
2021-06-17 17:47:18 +02:00
Calixte Denizet
e65b41f891 XFA - When no fonts in the pdf just use font size as width when measuring text 2021-06-17 16:50:56 +02:00
Calixte Denizet
df08b1548b XFA - Fix layout issues
- PR #13554 is buggy, so this patch aims to fix bugs.
  - check if a component fits into its parent in taking into account the parent layout.
  - introduce method isSplittable for template nodes to know if a component can be splitted in case of overflow.
2021-06-17 16:09:22 +02:00
calixteman
326226df45
Merge pull request #13575 from calixteman/fixlast
XFA - Fix reftest for xfa_issue13500
2021-06-17 15:56:27 +02:00
Calixte Denizet
226c228c2a XFA - Fix reftest for xfa_issue13500 2021-06-17 15:48:13 +02:00
calixteman
b300aba078
Merge pull request #13560 from calixteman/xfa_font_widths
XFA - Add the possibily to layout and measure text
2021-06-17 15:05:57 +02:00
Calixte Denizet
8eeb7ab4a3 XFA - Add the possibily to layout and measure text
- some containers doesn't always have their 2 dimensions and those dimensions re based on contents;
  - so in order to measure text, we must get the glyph widths (for the xfa fonts) before starting the layout;
  - implement a word-wrap algorithm;
  - handle font change during text layout.
2021-06-17 14:17:02 +02:00
calixteman
335d4cb2fc
Merge pull request #13570 from calixteman/xfa_field
XFA - By default a text ui has only one line when in a field element
2021-06-17 09:09:59 +02:00
Brendan Dahl
d6deb95f11
Merge pull request #13565 from brendandahl/fix-pattern-mask
Fix how patterns are applied to image mask objects.
2021-06-16 20:07:57 -07:00
Brendan Dahl
5efaaa0fea Fix how patterns are applied to image mask objects.
Note, this only really fixes Radial/Axial shading patterns with masks.
I'm guessing tiling patterns and mesh patterns would also be broken
if applied like the test pdf. Hopefully I'll have some time to make
test cases for the other shadings.

Fixes #13372
2021-06-16 20:06:41 -07:00
Calixte Denizet
793a0156ce XFA - By default a text ui has only one line when in a field element
- it aims to fix https://bugzilla.mozilla.org/show_bug.cgi?id=1716809.
2021-06-16 20:18:29 +02:00
calixteman
473322298f
Merge pull request #13569 from calixteman/visibility
XFA - Container wrapper must take the visibility of the wrapped content
2021-06-16 18:55:44 +02:00
Calixte Denizet
143d190a61 XFA - Container wrapper must take the visibility of the wrapped content 2021-06-16 17:29:02 +02:00
Jonas Jenwald
7fa61c062c
Merge pull request #13393 from Snuffleupagus/adjustToUnicode-hasIncludedToUnicodeMap
Tweak `adjustToUnicode` to allow extending a built-in /ToUnicode map
2021-06-16 17:06:17 +02:00
Brendan Dahl
f9a0568f96
Merge pull request #13554 from calixteman/layout3
XFA - Add support for overflow element
2021-06-15 09:16:19 -07:00
Jonas Jenwald
697c58e6e8
Merge pull request #13563 from Snuffleupagus/eslint-plugin-json
Add basic linting of JSON files using `eslint-plugin-json`
2021-06-15 12:38:42 +02:00
Calixte Denizet
0ea5792c86 XFA - Add support for overflow element
- and fix few bugs:
    - avoid infinite loop when layout the document;
    - avoid confusion between break and layout failure;
    - don't add margin width in tb layout when getting available space.
2021-06-15 12:32:01 +02:00
Jonas Jenwald
1cfaf07b82 Add basic linting of JSON files using eslint-plugin-json
By adding basic linting of JSON files, we can ensure that they're actually valid and prevent e.g. test-failures caused by *accidental* errors when editing the `test/test_manifest.json` file (something that I've done *many* times myself).

For now this simply uses the `recommended` configuration, but we can obviously tweak this later if/when needed. Please find additional information at https://github.com/azeemba/eslint-plugin-json
2021-06-15 12:19:01 +02:00
Jonas Jenwald
229a49b9b9 Re-factor the fallbackToUnicode functionality (PR 9192 follow-up)
Rather than having to create and check a *separate* `ToUnicodeMap` to handle these cases, we can simply use the `fallbackToUnicode`-data (when it exists) to directly supplement *missing* /ToUnicode entires in the regular `ToUnicodeMap` instead.
2021-06-14 15:05:14 +02:00
Jonas Jenwald
7190bc23a8 Remove unnecessary in checks of Arrays, when building the charCodeToGlyphId for TrueType fonts
Note that all standard Encodings have the same length (i.e. `256` elements) and that missing entries are always represented by empty strings, hence why a separate exists-check isn't necessary in the `baseEncoding` case.
2021-06-14 15:05:14 +02:00
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