Commit Graph

14392 Commits

Author SHA1 Message Date
calixteman
ba2d685166
Merge pull request #13673 from calixteman/images2
XFA - An image can be a stream in the pdf (bug 1718521)
2021-07-06 09:53:29 +02:00
calixteman
b9e84ba70e
Merge pull request #13665 from calixteman/reserve
XFA - Fix indentation for justified paragraph
2021-07-05 15:45:59 +02:00
Calixte Denizet
5cdee80c8e XFA - An image can be a stream in the pdf (bug 1718521) - hrefs can be found in catalog > Names > XFAImages 2021-07-05 14:06:23 +02:00
calixteman
02c069481e
Merge pull request #13653 from calixteman/lineheight
XFA - Improve text layout
2021-07-05 13:32:42 +02:00
calixteman
fcd4c8151c
Merge pull request #13672 from mozilla/revert-13654-images
Revert "XFA - An image can be a stream in the pdf (bug 1718521)"
2021-07-05 12:47:35 +02:00
calixteman
783cbc1793
Revert "XFA - An image can be a stream in the pdf (bug 1718521)" 2021-07-05 12:47:14 +02:00
calixteman
b370d4714f
Merge pull request #13654 from calixteman/images
XFA - An image can be a stream in the pdf (bug 1718521)
2021-07-05 12:04:34 +02:00
Tim van der Meij
62808cb3c2
Merge pull request #13666 from Snuffleupagus/eslint-operator-assignment
Enable the ESLint `operator-assignment` rule
2021-07-04 18:05:12 +02:00
Jonas Jenwald
819be0e78b Fix the remaining ESLint operator-assignment errors 2021-07-04 15:23:56 +02:00
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
Calixte Denizet
9b5574d3ef XFA - Fix indentation for justified paragraph
- and ceil the reserve for a caption to avoid to split it;
  - both issues are present in the pdf in issue #13633.
2021-07-03 18:07:01 +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
Calixte Denizet
f16828be49 XFA - An image can be a stream in the pdf (bug 1718521)
- hrefs can be found in catalog > Names > XFAImages
2021-07-02 20:34:10 +02:00
Calixte Denizet
f7d3b22480 XFA - Improve text layout
- support paragraph margins, line height, letter spacing, ...
  - compute missing dimensions from fields based almost on the dimensions of caption contents.
2021-07-02 17:53:32 +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