Commit Graph

14726 Commits

Author SHA1 Message Date
Jonas Jenwald
683ce66a48
Merge pull request #13761 from Snuffleupagus/issue-13756
XFA - Prevent breaking errors in `Binder`, when `searchNode` doesn't return data (issue 13756)
2021-07-19 19:38:30 +02:00
Jonas Jenwald
cf7978d507 XFA - Prevent breaking errors in Binder, when searchNode doesn't return data (issue 13756)
As can be seen in the code (see below), the `searchNode` helper function will return `null` in some cases and all of its call-sites should protect against that before attempting to access the returned data.
While only one of these changes were necessary to fix the breaking errors in issue 13756, in order to prevent future bugs I've added similar defensive code throughout this file.

 - 07955fa1d3/src/core/xfa/som.js (L169)
 - 07955fa1d3/src/core/xfa/som.js (L239)
 - 07955fa1d3/src/core/xfa/som.js (L254)
2021-07-19 18:07:07 +02:00
Tim van der Meij
07955fa1d3
Merge pull request #13735 from Snuffleupagus/bug-1720411
Ensure that the field value, for checkboxes, refers to an existing appearance state (bug 1720411)
2021-07-18 13:48:34 +02:00
Tim van der Meij
668c58d68d
Merge pull request #13746 from Snuffleupagus/getOperatorList-intent
[api-minor] Add `intent` support to the `PDFPageProxy.getOperatorList` method (issue 13704)
2021-07-18 13:28:08 +02:00
Tim van der Meij
e04386c675
Merge pull request #13754 from Snuffleupagus/refactor-PDFFunction
Remove the IR (internal representation) part of the `PDFFunction` parsing
2021-07-18 13:11:26 +02:00
Tim van der Meij
2d1f60f655
Merge pull request #13745 from Snuffleupagus/dev-enableXfa
Enable XFA by default in the development viewer
2021-07-18 13:03:31 +02:00
Jonas Jenwald
481af097b4 Convert PDFFunction to a standard class with static methods
For e.g. `gulp mozcentral`, the *built* `pdf.worker.js` file decreases from `1 837 608` to `1 834 907` bytes with this patch-series.
The improvement comes first of all from less overall indentation in `PDFFunction`, and secondly from the removal of (now) unnecessary indirection in the code.
2021-07-17 16:46:57 +02:00
Jonas Jenwald
d35fe3e796 Remove the IR (internal representation) part of the PDFFunction parsing
*This follows the exact same princial as PR 12083, but for the `PDFFunction` parsing instead.*

Given that the IR format is completely unused now, all that the current code does is add a bunch of unnecessary indirection/overhead to the handling of PDF-functions.
2021-07-17 16:44:58 +02:00
Jonas Jenwald
03cf28bf17 [api-minor] Add intent support to the PDFPageProxy.getOperatorList method (issue 13704)
With this patch, the `PDFPageProxy.getOperatorList` method will now return `PDFOperatorList`-instances that also include Annotation-operatorLists (when those exist). Hence this closes a small, but potentially confusing, gap between the `render` and `getOperatorList` methods.

Previously we've been somewhat reluctant to do this, as explained below, but given that there's actual use-cases where it's required probably means that we'll *have* to implement it now.
Since we still need the ability to separate "normal" rendering operations from direct `getOperatorList` calls in the worker-thread, this API-change unfortunately causes the *internal* renderingIntent to become a bit "messy" which is indeed unfortunate (note the `"oplist-"` strings in various spots). As-is I suppose that it's not all that bad, but we may want to consider changing the *internal* renderingIntent to e.g. a bitfield in the future.

Besides fixing issue 13704, this patch would also be necessary if someone ever tries to implement e.g. issue 10165 (since currently `PDFPageProxy.getOperatorList` doesn't include Annotation-operatorLists).

*Please note:* This patch is *also* tagged "api-minor" for a second reason, which is that we're now including the Annotation-id in the `beginAnnotation` argument. The reason for this is to allow correlating the Annotation-data returned by `PDFPageProxy.getAnnotations`, with its corresponding operatorList-data (for those Annotations that have it).
2021-07-16 17:16:30 +02:00
Jonas Jenwald
e5845739fd Enable XFA by default in the development viewer
Given that https://bugzilla.mozilla.org/show_bug.cgi?id=1720402 has just landed, enabling XFA in the development viewer probably cannot hurt now.
2021-07-16 14:16:33 +02:00
Jonas Jenwald
da808aeab3 Ensure that the field value, for checkboxes, refers to an existing appearance state (bug 1720411)
Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1720411
2021-07-16 13:11:48 +02:00
calixteman
f1ae7d7b0e
Merge pull request #13743 from calixteman/print_radio
XFA - Checkboxes must be printed (bug 1720182)
2021-07-16 12:57:04 +02:00
Calixte Denizet
3fb30ddde5 XFA - Checkboxes must be printed (bug 1720182)
- to avoid future regressions, annotationStorage is passed to the xfa render in reftests.
2021-07-16 11:32:03 +02:00
calixteman
4b2e0d0d01
Merge pull request #13732 from calixteman/rect
XFA - A rectangle must have the width of its parent but without inner margins
2021-07-15 22:30:25 +02:00
Tim van der Meij
ad34f16861
Merge pull request #13730 from Snuffleupagus/botbrowsertest
Add a new "botbrowsertest" gulp-task, to allow running only the browser tests on the bots
2021-07-15 22:14:17 +02:00
Tim van der Meij
c1f89c76c7
Merge pull request #13738 from Snuffleupagus/empty-Name
Re-factor the handling of *empty* `Name`-instances (PR 13612 follow-up)
2021-07-15 22:07:42 +02:00
Tim van der Meij
05340cc917
Merge pull request #13739 from Snuffleupagus/viewer-rm-IE-meta-tag
Remove `<meta>` tag only necessary for IE-compatibility
2021-07-15 22:00:05 +02:00
Jonas Jenwald
f376a3fbb1 Remove <meta> tag only necessary for IE-compatibility
Given that Internet Explorer is, since some time now, no longer supported in the PDF.js library this `<meta>` tag can also be removed (added in PR 6374).
2021-07-15 13:59:40 +02:00
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