Commit Graph

14608 Commits

Author SHA1 Message Date
Jonas Jenwald
3838c4e27c Re-factor the handling of *empty* Name-instances (PR 13612 follow-up)
When working on PR 13612, I mostly prioritized a simple solution that didn't require touching a lot of code. However, while working on PR 13735 I started to realize that the static `Name.empty` construction really wasn't a good idea.

In particular, having a special `Name`-instance where the `name`-property isn't actually a String is confusing (to put it mildly) and can easily lead to issues elsewhere. The only reason for not simply allowing the `name`-property to be an *empty* string, in PR 13612, was to avoid having to touch a lot of existing code. However, it turns out that this is only limited to a few methods in the `PartialEvaluator` and a few of the `BaseLocalCache`-implementations, all of which can be easily re-factored to handle *empty* `Name`-instances.

All-in-all, I think that this patch is even an *overall* improvement since we're now validating (what should always be) `Name`-data better in the `PartialEvaluator`.
This is what I ought to have done from the start, sorry about the code churn here!
2021-07-15 12:00:42 +02:00
calixteman
64f86de5cb
Merge pull request #13734 from calixteman/print_issue
XFA - Cannot print fields with no names
2021-07-14 19:45:53 +02:00
Brendan Dahl
15ab7a822f
Merge pull request #13725 from Snuffleupagus/catch-setTransform
Avoid all rendering breaking completely when `CanvasPattern.setTransform()` is unsupported
2021-07-14 10:16:56 -07:00
Calixte Denizet
019699acfb XFA - Cannot print fields with no names
- it was not possible to print pdf file in issue #13500.
2021-07-14 17:38:35 +02:00
Calixte Denizet
5081167e7f XFA - A rectangle must have the width of its parent but without inner margins
- it aims to fix #13584;
  - to avoid bad rendering because of clipping just set overflow to visible on SVG element.
2021-07-14 16:46:13 +02:00
Jonas Jenwald
2438d5ba8c Add a new "botbrowsertest" gulp-task, to allow running only the browser tests on the bots
Currently it's possible to run e.g. `gulp unittest`, `gulp fonttest`, and `gulp integrationtest` *separately* on the bots; see https://github.com/mozilla/botio-files-pdfjs
However, it's not possible to run *only* the `gulp browsertest` command on the bots without also running the full test-suite. In some cases, e.g. if the "browsertest" times out, having a way to only re-run those would thus save some time and resources.

If/when this patch lands, I'll follow-up with a patch adding a new `on_cmd_browsertest.js` file to the https://github.com/mozilla/botio-files-pdfjs repository.
2021-07-14 12:04:09 +02:00
Jonas Jenwald
b6c6a0cb7c Avoid all rendering breaking completely when CanvasPattern.setTransform() is unsupported
*Please note:* This patch doesn't fix rendering of (various) patterns in browsers/environments without full `CanvasPattern.setTransform()` support, but it at least prevents outright failures and thus allows the rest of the page to render.

This patch provides a temporary work-around for Firefox 78 ESR[1], and for Node.js environments (see issue 13724), where rendering is currently completely broken.

---
[1] Please note that the `createMatrix` helper function doesn't actually work as intended. The reason is that it's not `DOMMatrix` itself which is unsupported in older Firefox versions, but rather calling `CanvasPattern.setTransform(...)` with a `DOMMatrix`-argument.
Furthermore, the `createSVGMatrix` fallback won't actually help either since that method doesn't accept any parameters and would thus require *manually* specifying the matrix-state; see e.g. https://developer.mozilla.org/en-US/docs/Web/API/CanvasPattern/setTransform#examples
Finally, given that it's less than a month to the [Firefox 91 ESR release](https://wiki.mozilla.org/RapidRelease/Calendar) and that as-is all patterns are completely broken e.g. when using the latest viewer in Firefox 78 ESR, I'm just not convinced that it's worth the "hassle" of providing a more proper work-around.
2021-07-13 19:36:06 +02:00
calixteman
a17bd13023
Merge pull request #13721 from calixteman/layout8
XFA - Avoid to have containers not pushed in the html
2021-07-13 10:03:58 +02:00
calixteman
4d130d066c
Merge pull request #13723 from calixteman/xfa_print_fix
XFA - Only the first page was printed (bug 1720159)
2021-07-12 21:45:49 +02:00
Calixte Denizet
dd55e76f5d XFA - Avoid to have containers not pushed in the html
- it aims to fix issue #13668.
2021-07-12 21:34:58 +02:00
Calixte Denizet
0b4bf5b645 XFA - Only the first page was printed (bug 1720159) 2021-07-12 20:53:21 +02:00
calixteman
8ab65ed32d
Merge pull request #13720 from mozilla/revert-13716-layout7
Revert "XFA - Avoid to have containers not pushed in the html"
2021-07-12 09:46:50 +02:00
calixteman
140c2bc563
Revert "XFA - Avoid to have containers not pushed in the html" 2021-07-12 09:46:38 +02:00
calixteman
b6445ddc08
Merge pull request #13716 from calixteman/layout7
XFA - Avoid to have containers not pushed in the html
2021-07-12 09:31:27 +02:00
calixteman
bd3639ff80
Merge pull request #13718 from calixteman/xfa_tooltip
XFA - Support assist element
2021-07-12 00:00:20 +02:00
calixteman
789d5c9b39
Merge pull request #13717 from calixteman/valign
XFA - Fix wrong vertical alignments
2021-07-11 22:57:49 +02:00
Calixte Denizet
9bbc194846 XFA - Support assist element 2021-07-11 21:01:18 +02:00
Calixte Denizet
ff49fa5247 XFA - Fix wrong vertical alignments 2021-07-11 19:46:20 +02:00
Calixte Denizet
fccc6c2242 XFA - Avoid to have containers not pushed in the html
- it aims to fix issue #13668.
2021-07-11 19:14:44 +02:00
calixteman
70434c132f
Merge pull request #13714 from calixteman/myriad
XFA - Use fake MyriadPro as a fallback for missing fonts
2021-07-11 15:53:36 +02:00
Tim van der Meij
94b60b311f
Merge pull request #13715 from Snuffleupagus/update-packages
Update packages and translations
2021-07-11 14:33:01 +02:00
Calixte Denizet
690b5d1941 XFA - Use fake MyriadPro as a fallback for missing fonts
- aims to fix #13597.
2021-07-11 13:52:13 +02:00
Jonas Jenwald
c9ed65a0c4 Update l10n files 2021-07-11 12:25:54 +02:00
Jonas Jenwald
46b6e57b7c Update the eslint-plugin-unicorn package to the latest version 2021-07-11 12:21:29 +02:00
Jonas Jenwald
689e5c54a7 Update the es-module-shims package to the latest version 2021-07-11 12:16:47 +02:00
Jonas Jenwald
a926976e4d Update npm packages 2021-07-11 12:14:47 +02:00
calixteman
d416b23898
Merge pull request #13705 from calixteman/lineheight3
XFA - Fix text positions (bug 1718741)
2021-07-10 14:19:03 +02:00
Jonas Jenwald
16759bf390
Merge pull request #13712 from Snuffleupagus/checkDimensions-bbox
XFA - Always compute the transformed BBox values in `checkDimensions` (PR 13691 follow-up)
2021-07-10 13:27:16 +02:00
Jonas Jenwald
700b79a305 XFA - Always compute the transformed BBox values in checkDimensions (PR 13691 follow-up)
This way we ensure that these BBox values are *always* defined as expected for every `case`-block, and we also don't need to duplicate the lookup in multiple places. (Also, the patch removes a couple of unnecessary line-breaks in existing comments.)

Fixes https://github.com/mozilla/pdf.js/pull/13691#pullrequestreview-702356627, which was flagged by LGTM.
2021-07-10 11:24:05 +02:00
Tim van der Meij
2822ba4208
Merge pull request #13699 from mdrodz/webpack-hash-implementation
making webpack aware of the change inside of the worker file and hash
2021-07-09 23:06:43 +02:00
Tim van der Meij
62b5dc9eb7
Merge pull request #13696 from Snuffleupagus/issue-13689
[GENERIC viewer] Try to fixup "incomplete" language codes (issue 13689)
2021-07-09 23:01:19 +02:00
Tim van der Meij
a6d2e78b8a
Merge pull request #13690 from symtalha14/text-annotation-comb
Fixed text annotation comb input box
2021-07-09 22:58:50 +02:00
calixteman
f7cb8b4bdd
Merge pull request #13710 from calixteman/13706_f_up
XFA - Move xfa layer on top of the others (follow-up of #13706)
2021-07-09 22:00:25 +02:00
calixteman
a4f60fc417
Merge pull request #13708 from calixteman/xfa_tab
XFA - Add support for traversal and traverse element
2021-07-09 21:59:50 +02:00
Calixte Denizet
ff77acb357 XFA - Move xfa layer on top of the others (follow-up of #13706) 2021-07-09 20:58:19 +02:00
Calixte Denizet
ccac125623 XFA - Add support for traversal and traverse element
- For now, just implement the "next" target in using tabindex attribute of html elements.
2021-07-09 20:50:25 +02:00
calixteman
caaf77375f
Merge pull request #13703 from eltociear/patch-4
XFA - Fix typo in factory.js
2021-07-09 20:12:55 +02:00
calixteman
90e527968a
Merge pull request #13706 from calixteman/13697
XFA - Keep xfa layer on top of the others (bug 1719629)
2021-07-09 20:10:39 +02:00
Calixte Denizet
1b77888400 XFA - Keep xfa layer on top of the others (bug 1719629) 2021-07-09 18:18:22 +02:00
Calixte Denizet
58e1f51688 XFA - Fix text positions (bug 1718741)
- font line height is taken into account by acrobat when it isn't with masterpdfeditor: I extracted a font from a pdf, modified some ascent/descent properties thanks to ttx and the reinjected the font in the pdf: only Acrobat is taken it into account. So in this patch, line heights for some substituted fonts are added.
  - it seems that Acrobat is using a line height of 1.2 when the line height in the font is not enough (it's the only way I found to fix correctly bug 1718741).
   - don't use flex in wrapper container (which was causing an horizontal overflow in the above bug).
   - consequently, the above fixes introduced a lot of small regressions, so in order to see real improvements on reftests, I fixed the regressions in this patch:
     - replace margin by padding in some case where padding is a part of a container dimensions;
     - remove some flex display: some containers are wrongly sized when rendered;
     - set letter-spacing to 0.01px: it helps to be sure that text is not broken because of not enough width in Firefox.
2021-07-09 18:11:12 +02:00
calixteman
0afc785c7d
Merge pull request #13700 from calixteman/image_scale
XFA - Scale correctly images
2021-07-09 15:34:47 +02:00
Ikko Ashimine
dba30eac7b
XFA - Fix typo in factory.js
occured -> occurred
2021-07-09 21:51:37 +09:00
Calixte Denizet
ad195e0f05 XFA - Scale correctly images 2021-07-08 20:28:49 +02:00
Rodolfo Rangel
a7c4fb4478 making webpack aware of the change inside of the worker file and hashing its name on build accordingly
removing .worker because it is already added in the [name] part
2021-07-08 13:32:58 -03:00
Jonas Jenwald
29fd39a16e [GENERIC viewer] Try to fixup "incomplete" language codes (issue 13689)
While I don't know if it's technically correct to even do this, it could provide a slightly better out-of-the-box behaviour in browsers that specify (from the PDF.js `l10n`-folder perspective) "incomplete" language codes.

Rather than immediately falling back to English, we'll use a white-list to try and re-write a "partial" language code to a (hopefully) suitable one that matches an existing `l10n`-folder. The disadvantage of this solution is that the list needs to be kept *manually* up-to-date with any changes in the `l10n`-folder, however new locales are added infrequently enough that this should be acceptable.

Fixes 13689 (assuming we actually want/care to do so, otherwise we should just WONTFIX the issue).
2021-07-08 12:54:58 +02:00
calixteman
c33bf0b5e8
Merge pull request #13692 from calixteman/bind_global
XFA - Correctly bind global data (bug 1718725)
2021-07-08 12:42:22 +02:00
Jonas Jenwald
418880d473
Merge pull request #13694 from Snuffleupagus/handleBreak-rm-extra-target
XFA - remove unnecessary check in the `handleBreak` function (PR 13687 follow-up)
2021-07-08 09:58:29 +02:00
Jonas Jenwald
df6107714a XFA - remove unnecessary check in the handleBreak function (PR 13687 follow-up)
With the changes in PR 13687 we're now checking if `target` is defined *twice* in a row, which shouldn't be necessary :-)

(I noticed this when glancing at the unofficial LGTM results; maybe we should re-evalute the decision to not integrate that into the CI.)
2021-07-07 23:22:29 +02:00
calixteman
fbd2f28618
Merge pull request #13693 from calixteman/textfields
XFA - Enable disabled fields (bug 1719464)
2021-07-07 21:43:21 +02:00
symtalha14
e34e2e0af6 Fixed text annotation input field 2021-07-07 23:41:49 +05:30