Commit Graph

14380 Commits

Author SHA1 Message Date
Jonas Jenwald
901b24e8af Enable the ESLint operator-assignment rule
This patch was generated automatically, using the `gulp lint --fix` command.

Please find additional details about the ESLint rule at https://eslint.org/docs/rules/operator-assignment
2021-07-04 12:57:45 +02:00
Jonas Jenwald
de80590157
Merge pull request #13662 from calixteman/no_arial
XFA - Don't use system font when a font is not embeded but there is a substitution
2021-07-04 11:35:50 +02:00
Tim van der Meij
5c7cd6fb4f
Merge pull request #13661 from Snuffleupagus/fingerprints
[api-minor] Support accessing both the original and modified PDF fingerprint
2021-07-03 18:59:11 +02:00
Tim van der Meij
f979aae6fe
Merge pull request #13664 from Snuffleupagus/rm-package-version
Remove the `version` field from the `package.json` file
2021-07-03 18:50:07 +02:00
Jonas Jenwald
e4adde3462 Remove the version field from the package.json file
According to https://docs.npmjs.com/cli/v7/configuring-npm/package-json#version, the "version" field is not required[1]:
> If you don't plan to publish your package, the name and version fields are optional.

Hence it shouldn't be necessary to have a "dummy" `version` field in the `package.json` file, and it seems quite unfortunate to have an essentially meaningless entry in that file.[2]
Furthermore, I'd even go as far as suggesting that it's actually doing more harm than good in practice, since it's not uncommon for people to open issues where they simply quote the `package.json`-entry when filling out the ISSUE_TEMPLATE thus causing confusion as to which *exact* version is actually used.

Unless I'm misremembering, I believe that the only reason for adding the `version` field was that is was necessary in order for things to work back when testing was run on Travis.
Now we're using GitHub Actions instead, where things seem to work just find even without a `version` field; hence why I think it makes sense to remove this.

---
[1] Please note that this patch doesn't affect the `pdfjs-dist` package, since the `package.json` file used there is created in `gulpfile.js` during building.

[2] Trying to, automatically, update the `version` field on *every* commit really doesn't seem worth it to me.
2021-07-03 16:46:28 +02:00
Calixte Denizet
5744dd773d XFA - Don't use system font when a font is not embeded but there is a substitution
- always use a font coming from pdf.js when there is one: this way we don't use a system font which could looks wrong.
2021-07-03 15:13:56 +02:00
Jonas Jenwald
661c60ecc9 [api-minor] Support accessing both the original and modified PDF fingerprint
The PDF.js API has only ever supported accessing the original file ID, however the second one that (should) exist in *modified* documents have thus far been completely inaccessible through the API.
That seems like a simple oversight, caused e.g. by the viewer not needing it, since it really shouldn't hurt to provide API-users with the ability to check if a PDF document has been modified since its creation.[1]

Please refer to https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf#G13.2261661 for additional information.

For an example of how to update existing code to use the new API, please see the changes in the `web/app.js` file included in this patch.

*Please note:* While I'm not sure if we'll ever be able to remove the old `PDFDocumentProxy.fingerprint` getter, given that it's existed since "forever", that probably isn't a big deal given that it's now limited to only `GENERIC`-builds.

---
[1] Although this obviously depends on the PDF software following the specification, by updating the second file ID as intended.
2021-07-03 13:56:33 +02:00
Tim van der Meij
f9d506cf50
Merge pull request #13658 from Snuffleupagus/cloneValue
Don't attempt to structure clone unsupported types with workers disabled
2021-07-03 13:01:46 +02:00
Tim van der Meij
227d0b0dac
Merge pull request #13657 from Snuffleupagus/rm-instanceof-Object
Replace `instanceof Object` with `typeof` checks
2021-07-03 12:54:34 +02:00
Jonas Jenwald
bdf6f733bf Don't attempt to structure clone unsupported types with workers disabled
Please refer to https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm

Based on that information, and manually testing our code, the implementation in `cloneValue` has the following shortcomings:
 - Attempting to clone `function`s is only prevented when they're part of an Object, but is currently allowed when they occur standalone.
 - Cloning of `Symbol`s is currently not prevented, which it should be since the native structured clone algorithm throws.
 - Any disallowed types should be checked first, to reduce the risk of future changes accidentally allowing something that shouldn't be supported.
2021-07-03 11:56:33 +02:00
Jonas Jenwald
909ff8e29f Replace instanceof Object with typeof checks
Using `instanceof Object` is generally problematic, since it's not guaranteed to always do the right thing for all Objects.
(I stumbled upon this while working on another patch, when I noticed that the `outlineView` was broken with workers disabled.)
2021-07-03 11:30:46 +02:00
calixteman
d80651e572
Merge pull request #13598 from calixteman/dhl
XFA - Remove empty pages
2021-06-30 20:43:07 +02:00
calixteman
a8a5c5f10b
Merge pull request #13648 from calixteman/xfa_bg
XFA - Don't fill when the fill element is not visible (bug 1718735)
2021-06-30 18:12:13 +02:00
Calixte Denizet
08e08d5852 XFA - Don't fill when the fill element is not visible (bug 1718735) 2021-06-30 17:14:08 +02:00
Calixte Denizet
ff440d13e7 XFA - Remove empty pages
- it aims to fix #13583;
  - fix the switch to breakBefore target;
  - force the layout of an unsplittable element on an empty page;
  - don't fail when there is horizontal overflow (except in lr-tb);
  - handle correctly overflow in the same content area (bug 1717805, bug 1717668);
  - fix a typo in radial gradient first argument.
2021-06-30 16:32:27 +02:00
Tim van der Meij
6307349e31
Merge pull request #13640 from Snuffleupagus/issue-6759
Add non-PRODUCTION/TESTING overflow `assert`s to various string helper-functions (issue 6759)
2021-06-29 21:22:34 +02:00
calixteman
d88d9a2574
Merge pull request #13616 from marco-c/1773_reftests
Add PDFs from #1773 to the reftests
2021-06-29 17:28:10 +02:00
Marco Castelluccio
db15205e2c Add PDFs from #1773 to the reftests 2021-06-29 16:35:06 +02:00
calixteman
f35e4cc9ab
Merge pull request #13645 from calixteman/bug1718241
XFA - Choice list has no selected value by default (bug 1718241)
2021-06-28 23:46:59 +02:00
calixteman
04dc902933
Merge pull request #13644 from calixteman/xfa_missing_fonts
XFA - Support non-embedded fonts without a Widths entry
2021-06-28 23:46:09 +02:00
Calixte Denizet
70bb672dcd XFA - Support non-embedded fonts without a Widths entry
- some pdf use some fonts which are not embedded or they don't have any width array or don't have any css info (e.g. for standard fonts or Arial).
  - so add widths arrays for Liberation fonts in order to compute the ones for other fonts in using scale factors array.
2021-06-28 23:05:08 +02:00
Calixte Denizet
1de133a7c9 XFA - Choice list has no selected value by default 2021-06-28 22:10:26 +02:00
calixteman
3f02a46570
Merge pull request #13641 from calixteman/image_dim
XFA - Implement aspect property on image element
2021-06-28 21:55:25 +02:00
Calixte Denizet
71d17b0cc4 XFA - Implement aspect property on image element
- it aims to fix issue #13634;
  - move some img-related functions in test/drivers.js in order to have images in xfa reftests.
2021-06-28 20:43:39 +02:00
calixteman
ff3a5382ee
Merge pull request #13635 from calixteman/1718037
XFA - Fix width of a container with lr-tb layout (bug 1718037)
2021-06-28 17:51:46 +02:00
Calixte Denizet
b261446981 XFA - Fix width of a container with lr-tb layout (bug 1718037) 2021-06-28 17:47:04 +02:00
calixteman
03dff1c5f5
Merge pull request #13639 from calixteman/old_break
XFA - Replace deprecated break element (bug 1718053)
2021-06-28 17:44:03 +02:00
calixteman
191db4145e
Merge pull request #13642 from calixteman/quotes
XFA - Remove quotes of font name in xhtml
2021-06-28 13:25:47 +02:00
Calixte Denizet
677332aa7b XFA - Remove quotes of font name in xhtml 2021-06-27 18:05:12 +02:00
Jonas Jenwald
273d8cb746 Add non-PRODUCTION/TESTING overflow asserts to various string helper-functions (issue 6759) 2021-06-27 16:06:30 +02:00
Calixte Denizet
257de0e8c5 XFA - Replace deprecated break element (bug 1718053)
- the break element has been deprecated in XFA 2.4 but some old documents can use it, so replace it with one (or more) of its possible substitutions:
    - breakBefore;
    - breakAfter;
    - overflow.
2021-06-27 15:03:00 +02:00
Tim van der Meij
d644b66c72
Merge pull request #13638 from Snuffleupagus/api-tweak-docs
A couple of smaller JSDocs tweaks in `src/display/api.js`
2021-06-27 12:47:57 +02:00
Tim van der Meij
4a8466cdac
Merge pull request #13637 from Snuffleupagus/update-packages
Update packages and translations
2021-06-27 12:42:54 +02:00
Jonas Jenwald
d02146b13b Add a OnProgressParameters typedef to reduce (some) duplication in src/display/api.js 2021-06-27 11:55:53 +02:00
Jonas Jenwald
ea4b162328 Use the RefProxy typedef in more JSDoc comments in src/display/api.js 2021-06-27 11:34:59 +02:00
Jonas Jenwald
0326c05db0 Update l10n files 2021-06-27 10:31:06 +02:00
Jonas Jenwald
b146c597b0 Fix (some) vulnerabilities reported by npm audit
This was done automatically, using the `npm audit fix` command.
2021-06-27 10:29:39 +02:00
Jonas Jenwald
e79ed27f2f Update the es-module-shims package to the latest version 2021-06-27 10:27:02 +02:00
Jonas Jenwald
f03d5b3ee7 Update npm packages 2021-06-27 10:25:40 +02:00
Tim van der Meij
d7f8a0e9b9
Merge pull request #13628 from Snuffleupagus/issue-13626
Check that TrueType (3, 0) cmap tables, for symbolic fonts, are sorted correctly (issue 13626)
2021-06-26 14:17:11 +02:00
Tim van der Meij
82660296d6
Merge pull request #13600 from Snuffleupagus/scrollMatchIntoView-selectedLeft
Take the position of the `selected` element into account when scrolling matches (issue 13596)
2021-06-26 14:04:20 +02:00
calixteman
9de0916fd4
Merge pull request #13627 from calixteman/save
XFA - Save filled data in the pdf when downloading the file (Bug 1716288)
2021-06-25 20:12:09 +02:00
Calixte Denizet
429ffdcd2f XFA - Save filled data in the pdf when downloading the file (Bug 1716288)
- when binding (after parsing) we get a map between some template nodes and some data nodes;
  - so set user data in input handlers in using data node uids in the annotation storage;
  - to save the form, just put the value we have in the storage in the correct data nodes, serialize the xml as a string and then write the string at the end of the pdf using src/core/writer.js;
  - fix few bugs around data bindings:
    - the "Off" issue in Bug 1716980.
2021-06-25 18:57:01 +02:00
Jonas Jenwald
50edd5da63 Suppress OTS warnings about the caretOffset in the hhea-table
- https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6hhea.html
 - https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6head.html
2021-06-25 17:02:02 +02:00
Jonas Jenwald
185be678ec Check that TrueType (3, 0) cmap tables, for symbolic fonts, are sorted correctly (issue 13626)
According to a comment in `readCmapTable`, we're assuming that the cmap tables (when more than one exist) are sorted in ascending order. If that's not the case, keep checking the following cmap tables in order to fix the referenced issue.
2021-06-25 16:56:00 +02:00
Brendan Dahl
dc7faa213e
Merge pull request #13624 from calixteman/center
XFA - Take into account text position in caption
2021-06-24 09:07:39 -07:00
Calixte Denizet
57b6746bab XFA - Take into account text position in caption 2021-06-24 10:25:41 +02:00
Brendan Dahl
d7fdb72a3f
Merge pull request #13619 from calixteman/bg
XFA - Add back empty subforms (which can have a background)
2021-06-23 16:21:28 -07:00
Brendan Dahl
ad28622595
Merge pull request #13622 from calixteman/no_stretch_lrtb
XFA - No container stretching with lr-tb layout
2021-06-23 15:06:21 -07:00
Brendan Dahl
f4f00a9bc6
Merge pull request #13618 from calixteman/bind_root
XFA - Always bind root subform on root data
2021-06-23 13:14:12 -07:00