Commit Graph

17158 Commits

Author SHA1 Message Date
Calixte Denizet
a96f10e55d Create a new chunk when the char is too rised compared to the previouse one 2023-03-28 13:56:46 +02:00
Jonas Jenwald
d584513cb2
Merge pull request #16213 from Snuffleupagus/validateCSSFont-quotes
Reduce duplication in the `validateCSSFont` helper function
2023-03-28 12:40:23 +02:00
Jonas Jenwald
ec08bd5c41
Merge pull request #16218 from Snuffleupagus/isPDFFunction-simplify
Simplify the `isPDFFunction` helper function
2023-03-28 11:16:25 +02:00
calixteman
b292d1ab95
Merge pull request #16217 from calixteman/bug1824610
ESMify some modules for m-c (bug 1824610)
2023-03-28 11:01:35 +02:00
Calixte Denizet
5f5256b4c4 ESMify some modules for m-c (bug 1824610) 2023-03-27 12:01:31 +02:00
Jonas Jenwald
20cbb89412 Simplify the isPDFFunction helper function
Originally we used helper functions for checking if something was a Dictionary or Stream, and then having an initial `typeof` check probably made sense.
However, given that we're using `instanceof` nowadays the additional check longer seems necessary.
2023-03-27 11:34:20 +02:00
Tim van der Meij
384bd96165
Merge pull request #16212 from Snuffleupagus/geckoview-rm-transition-CSS
[GeckoView] Remove unused `transition` CSS-rules
2023-03-26 16:01:08 +02:00
Jonas Jenwald
ef70988027 Reduce duplication in the validateCSSFont helper function
Currently we're *virtually* duplicating the same code, for validating quotation marks, twice in this helper function.

The size decrease is quite small (107 bytes) and this makes the code slightly harder to reader, hence I completely understand if this patch is rejected.
2023-03-26 12:12:49 +02:00
Jonas Jenwald
71fdf804de [GeckoView] Remove unused transition CSS-rules
Given that the GeckoView-viewer doesn't have a sidebar, there's no reason to have CSS-rules for it (and the variables are also undefined).
2023-03-26 10:35:19 +02:00
nmtigor
167b363eb3 Write some {Object} in api.js more precise 2023-03-25 22:00:06 +01:00
Jonas Jenwald
8a2dfdb032
Merge pull request #16211 from Snuffleupagus/occur-spelling
Fix spelling of `occurred` in a couple of comments
2023-03-25 20:54:29 +01:00
Jonas Jenwald
007c367018 Fix spelling of occurred in a couple of comments 2023-03-25 20:46:02 +01:00
Tim van der Meij
a1685fd0d8
Merge pull request #16199 from Snuffleupagus/commonobj-FontInspector
Slightly reduce the size of the `FontInspector`-integration in the API
2023-03-25 15:27:01 +01:00
Tim van der Meij
ca03b0a811
Merge pull request #16206 from Snuffleupagus/update-packages
Update packages and translations
2023-03-25 15:23:31 +01:00
Tim van der Meij
35322bcbaa
Merge pull request #16207 from Snuffleupagus/declaration-block-no-redundant-longhand-properties
Enable the `declaration-block-no-redundant-longhand-properties` Stylelint rule
2023-03-25 15:22:01 +01:00
Tim van der Meij
b3e2e26079
Merge pull request #16208 from Snuffleupagus/recoverJsURL-replaceAll
Use `replaceAll` in the `recoverJsURL` helper function
2023-03-25 15:20:33 +01:00
Jonas Jenwald
035a273d30 Use replaceAll in the recoverJsURL helper function
We can just do direct replacement when building the regular expression, rather than splitting the string into an Array and then re-joining it.
2023-03-25 12:31:39 +01:00
Jonas Jenwald
a4dfa04a0b Enable the declaration-block-no-redundant-longhand-properties Stylelint rule
Note that these changes were done automatically, using `gulp lint --fix`.
This rule will help avoid unnecessary repetition in the CSS; please see https://stylelint.io/user-guide/rules/declaration-block-no-redundant-longhand-properties/
2023-03-25 10:08:27 +01:00
Jonas Jenwald
a8af946bdc Update l10n files 2023-03-25 09:46:07 +01:00
Jonas Jenwald
ee15ec9144 Update npm packages 2023-03-25 09:41:15 +01:00
Jonas Jenwald
c706c6c34f
Merge pull request #16185 from Snuffleupagus/prefer-negative-index
Enable the `unicorn/prefer-negative-index` ESLint plugin rule
2023-03-24 12:12:11 +01:00
Jonas Jenwald
96e34fbb7d Enable the unicorn/prefer-negative-index ESLint plugin rule
Please see https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-negative-index.md
2023-03-24 10:18:32 +01:00
Jonas Jenwald
b119cde030
Merge pull request #16198 from Snuffleupagus/viewer-ChangeScale-cap
Reduce some duplication in the `PDFViewer.{increaseScale, decreaseScale}` methods
2023-03-24 10:07:22 +01:00
Jonas Jenwald
378caa7203 Slightly reduce the size of the FontInspector-integration in the API
Given that this functionality only applies in the viewer, when `PDFBug` is being enabled and used, it can't hurt to slightly reduce the size of this code.
2023-03-23 14:07:10 +01:00
Jonas Jenwald
184f5701e9
Merge pull request #16196 from Snuffleupagus/String-replaceAll
Use `String.prototype.replaceAll()` where appropriate
2023-03-23 13:59:59 +01:00
Jonas Jenwald
1fc09f0235 Enable the unicorn/prefer-string-replace-all ESLint plugin rule
Note that the `replaceAll` method still requires that a *global* regular expression is used, however by using this method it's immediately obvious when looking at the code that all occurrences will be replaced; please see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll#parameters

Please find additional details at https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-replace-all.md
2023-03-23 12:57:10 +01:00
Jonas Jenwald
56b4699650 Reduce some duplication in the PDFViewer.{increaseScale, decreaseScale} methods
- Reduce a little bit of duplication by enforcing the max/min scale-values once, at the end, in the `increaseScale`/`decreaseScale` methods.
 - Convert the "private" `PDFViewer` scale-related methods into actually private ones, now that JavaScript supports that.
2023-03-23 09:25:23 +01:00
Jonas Jenwald
c3e62e1e4e
Merge pull request #16192 from nchevobbe/cursor-draggable
Use cursor:move for draggable texts and drawings (Bug 1804252)
2023-03-22 16:15:11 +01:00
Jonas Jenwald
5f64621d46 Use String.prototype.replaceAll() where appropriate
This fairly new method allows replacing *multiple* occurrences within a string without having to use regular expressions.

Please refer to:
 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll
 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replaceAll#browser_compatibility
2023-03-22 15:31:10 +01:00
Jonas Jenwald
076bb30b6c
Merge pull request #16182 from Snuffleupagus/inset-block
Introduce `inset-block` usage in the viewer CSS
2023-03-22 12:59:10 +01:00
Jonas Jenwald
915bdd6576
Merge pull request #16173 from Snuffleupagus/inset
Introduce `inset` usage in the CSS files
2023-03-22 12:57:57 +01:00
Jonas Jenwald
39bbd8c94f
Merge pull request #16193 from Snuffleupagus/non-standard-ligatures
Add even more non-standard ligatures (PR 15517 follow-up)
2023-03-22 12:27:54 +01:00
Jonas Jenwald
137a2d6e30 Add even more non-standard ligatures (PR 15517 follow-up)
Given that we already create multi-byte ToUnicode entries in other cases, see e.g. the `getNormalizedUnicodes` table, this is hopefully fine.
2023-03-22 10:42:52 +01:00
Jonas Jenwald
f39ff20485
Merge pull request #16191 from Snuffleupagus/XRefStm-Set
Track previous "XRefStm"s in a `Set`, rather than an `Object`
2023-03-22 10:25:53 +01:00
Nicolas Chevobbe
7f80052fdf Use cursor:move for draggable texts and drawings (Bug 1804252) 2023-03-22 09:49:43 +01:00
Jonas Jenwald
122d5e549a Track previous "XRefStm"s in a Set, rather than an Object
Having just reviewed a patch touching this code, I couldn't help noticing that an `Object` isn't really the optimal data-structure for this and nowadays we can do better by using a `Set` instead.
2023-03-22 09:41:19 +01:00
Jonas Jenwald
9321758d91
Merge pull request #16186 from Snuffleupagus/issue-16176
Support multi-byte ToUnicode entries, when using predefined CMaps (issue 16176)
2023-03-21 22:17:18 +01:00
Jonas Jenwald
d4bcfe8c16 Support multi-byte ToUnicode entries, when using predefined CMaps (issue 16176)
Hopefully this makes sense, since we already "create" multi-byte ToUnicode entries in other cases (see e.g. the `getNormalizedUnicodes` table).
2023-03-21 21:35:57 +01:00
calixteman
8bfebf1c24
Merge pull request #16188 from calixteman/bug1823296
Use the position of the previous xref stream if any when saving a pdf (bug 1823296)
2023-03-21 21:21:49 +01:00
Calixte Denizet
2d0f30a67c Use the position of the previous xref stream if any when saving a pdf (bug 1823296) 2023-03-21 19:27:24 +01:00
Jonas Jenwald
a3ab2f6790 Introduce inset-block usage in the viewer CSS
Given that the viewer always set the `dir`-attribute, to either LTR or RTL, we should be able to use this logical CSS property to (very slightly) reduce the size of the CSS; please see https://developer.mozilla.org/en-US/docs/Web/CSS/inset-block
2023-03-20 16:42:39 +01:00
Jonas Jenwald
b1e0253f29
Merge pull request #16175 from Snuffleupagus/LoopbackPort-transfer
Fix the `transfer` parameter, for `structuredClone`, in the `LoopbackPort`
2023-03-20 14:22:09 +01:00
Jonas Jenwald
a29c131e90
Merge pull request #16181 from Snuffleupagus/pr-16162
Only warn about missing `--scale-factor` CSS-variable for visible textLayers (PR 16162 follow-up)
2023-03-20 14:21:37 +01:00
Jonas Jenwald
8bf5e96af9 Only warn about missing --scale-factor CSS-variable for visible textLayers (PR 16162 follow-up)
This is something that I completely overlooked in PR 16162, which in some cases cause the default viewer to incorrectly print warnings.
This can be reproduced with the PAGE scrolling-mode, and/or the PresentationMode, and this patch simply work-around it by checking the visibility as well (since the warning is a best-effort solution anyway).
2023-03-20 12:51:26 +01:00
Jonas Jenwald
fb2367d14f
Merge pull request #16180 from Snuffleupagus/appendFeFunc
Add a helper, in `DOMFilterFactory`, to reduce duplication when creating `<feFuncX>`s
2023-03-20 12:41:03 +01:00
Jonas Jenwald
cc9f6650a8 Stop passing in pageColors to the CanvasGraphics-constructor (PR 16075 follow-up)
The `pageColors`-option was removed from the `CanvasGraphics`-constructor in PR 16075, hence the code in the API no longer needs to pass in that option; this is something that I missed during review.
2023-03-20 11:41:57 +01:00
Jonas Jenwald
86cf62699c Add a helper, in DOMFilterFactory, to reduce duplication when creating <feFuncX>s
Currently we repeat the same code verbatim multiple times in the `DOMFilterFactory`, which seems completely unnecessary.
2023-03-20 11:27:47 +01:00
calixteman
3903391f3c
Merge pull request #16075 from calixteman/svg_filter_hcm
[api-minor] Use a SVG filter when rendering pages in HCM
2023-03-20 10:18:25 +01:00
Jonas Jenwald
c4a725fe98 Fix the transfer parameter, for structuredClone, in the LoopbackPort
The way that we handle the `transfer` parameter is unfortunately wrong, ever since PR 14392 which introduced the code, given that the MDN article originally contained incorrect information; please see https://github.com/mdn/content/pull/23164

By updating the `structuredClone` call such that it works correctly, we can enable more unit-tests in Node.js environments; please refer to https://developer.mozilla.org/en-US/docs/Web/API/structuredClone#parameters
2023-03-19 22:04:01 +01:00
Jonas Jenwald
553c2e05cd Introduce inset usage in the CSS files
The `inset` property is a nice shorthand that can be used to avoid having to specify the positions individually; please see
 - https://developer.mozilla.org/en-US/docs/Web/CSS/inset
 - https://developer.mozilla.org/en-US/docs/Web/CSS/inset-inline
2023-03-19 14:32:37 +01:00