Closed Bug 1807176 Opened 3 years ago Closed 3 years ago

Update PDF.js to new version a749f6cc149be7ca2aa4f84851a9aee1f21ebc45 from 2022-12-19 22:09:26

Categories

(Firefox :: PDF Viewer, enhancement)

enhancement

Tracking

()

RESOLVED DUPLICATE of bug 1807983
Tracking Status
firefox110 --- affected

People

(Reporter: update-bot, Assigned: calixte)

References

(Blocks 1 open bug)

Details

(Whiteboard: [3pl-filed][task_id: dBIEfIZtR6ii9yT6iU8llg])

Attachments

(1 obsolete file)

This update covers 37 commits:


f3d7f2e64f7644ceee4259d71a2d513eeb805ae6 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/f3d7f2e64f7644ceee4259d71a2d513eeb805ae6
Authored: 2022-12-19 01:10:11 +0100
Committed: 2022-12-19 01:20:06 +0100

Fix the loadingBar initialization in the "mobile-viewer" example (PR 15831 follow-up)

Given that the ProgressBar-constructor was updated, we need to update the "mobile-viewer" example as well; this is yet another thing I missed during review.

Files Modified:

  • examples/mobile-viewer/viewer.js

e8c7278337589d9498d2a514f10337faf87324aa by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/e8c7278337589d9498d2a514f10337faf87324aa
Authored: 2022-12-19 01:04:04 +0100
Committed: 2022-12-19 01:04:04 +0100

Improve the linkService handling in the DEFAULT_LAYER_PROPERTIES (PR 15811 follow-up)

We'll no longer import the SimpleLinkService dependency unconditionally in the file, since it's only used in COMPONENTS-builds.
Furthermore, for the COMPONENTS-builds, we'll create a SimpleLinkService-instance only for those layers that actually need it.

Files Modified:

  • web/pdf_page_view.js

d9cdc46f841c752b808655ca2a673ecba759a514 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/d9cdc46f841c752b808655ca2a673ecba759a514
Authored: 2022-12-07 12:18:05 +0100
Committed: 2022-12-18 13:26:56 +0100

Update the "pageviewer" example to account for the previous patches

This uses a simple version number check, to prevent breakage if the example is used with older PDF.js versions.

Files Modified:

  • examples/components/pageviewer.js

8b8d89006411edacad1af3fc28bbb35ff32fd31f by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/8b8d89006411edacad1af3fc28bbb35ff32fd31f
Authored: 2022-12-07 00:13:44 +0100
Committed: 2022-12-18 13:26:54 +0100

[api-minor] Remove the xfaLayerFactory in the viewer

Please note that this functionality has never really mattered for the Firefox PDF Viewer, the GENERIC viewer, or even the "simpleviewer"/"singlepageviewer" component-examples. Hence, in practice this means that only the "pageviewer" component-example[1] have ever really utilized this.

Using factories to initialize various layers in the viewer, rather than simply invoking the relevant code directly, seems (at least to me) like a somewhat roundabout way of doing things.
Not only does this lead to more code, both to write and maintain, but since many of the layers have common parameters (e.g. an AnnotationStorage-instance) there's also some duplication.

Hence this patch, which removes the xfaLayerFactory and instead uses a lookup-function in the PDFPageView-class to access the external viewer-properties as necessary.
Note that this should even be an improvement for the "pageviewer" component-example, since most layers will now work by default rather than require manual configuration.


[1] In practice we generally suggest using the "simpleviewer", or "singlepageviewer", since it does most things out-of-the-box and given that a lot of functionality really require a viewer and not just a single page in order to work.

Files Deleted:

  • web/default_factory.js

Files Modified:

  • web/interfaces.js
  • web/pdf_page_view.js
  • web/pdf_viewer.component.js
  • web/pdf_viewer.js

c393148748d2d097dfe5bbe7ebefb7fb11b713db by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/c393148748d2d097dfe5bbe7ebefb7fb11b713db
Authored: 2022-12-07 00:09:14 +0100
Committed: 2022-12-18 13:26:33 +0100

[api-minor] Remove the textLayerFactory in the viewer

Please note that this functionality has never really mattered for the Firefox PDF Viewer, the GENERIC viewer, or even the "simpleviewer"/"singlepageviewer" component-examples. Hence, in practice this means that only the "pageviewer" component-example[1] have ever really utilized this.

Using factories to initialize various layers in the viewer, rather than simply invoking the relevant code directly, seems (at least to me) like a somewhat roundabout way of doing things.
Not only does this lead to more code, both to write and maintain, but since many of the layers have common parameters (e.g. an AnnotationStorage-instance) there's also some duplication.

Hence this patch, which removes the textLayerFactory and instead uses a lookup-function in the PDFPageView-class to access the external viewer-properties as necessary.
Note that this should even be an improvement for the "pageviewer" component-example, since most layers will now work by default rather than require manual configuration.


[1] In practice we generally suggest using the "simpleviewer", or "singlepageviewer", since it does most things out-of-the-box and given that a lot of functionality really require a viewer and not just a single page in order to work.

Files Modified:

  • web/default_factory.js
  • web/interfaces.js
  • web/pdf_page_view.js
  • web/pdf_viewer.component.js
  • web/pdf_viewer.js

4c78290028ff976e392aa046ffaf29a40f9c8e0a by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/4c78290028ff976e392aa046ffaf29a40f9c8e0a
Authored: 2022-12-06 23:55:23 +0100
Committed: 2022-12-18 13:26:10 +0100

[api-minor] Remove the textHighlighterFactory in the viewer

Please note that this functionality has never really mattered for the Firefox PDF Viewer, the GENERIC viewer, or even the "simpleviewer"/"singlepageviewer" component-examples. Hence, in practice this means that only the "pageviewer" component-example[1] have ever really utilized this.

Using factories to initialize various layers in the viewer, rather than simply invoking the relevant code directly, seems (at least to me) like a somewhat roundabout way of doing things.
Not only does this lead to more code, both to write and maintain, but since many of the layers have common parameters (e.g. an AnnotationStorage-instance) there's also some duplication.

Hence this patch, which removes the textHighlighterFactory and instead uses a lookup-function in the PDFPageView-class to access the external viewer-properties as necessary.
Note that this should even be an improvement for the "pageviewer" component-example, since most layers will now work by default rather than require manual configuration.


[1] In practice we generally suggest using the "simpleviewer", or "singlepageviewer", since it does most things out-of-the-box and given that a lot of functionality really require a viewer and not just a single page in order to work.

Files Modified:

  • web/pdf_page_view.js
  • web/pdf_viewer.js

f1d1f6edfd032e956d1298d0aa21fa6bce7dd11e by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/f1d1f6edfd032e956d1298d0aa21fa6bce7dd11e
Authored: 2022-12-06 23:43:09 +0100
Committed: 2022-12-18 13:26:08 +0100

[api-minor] Remove the structTreeLayerFactory in the viewer

Please note that this functionality has never really mattered for the Firefox PDF Viewer, the GENERIC viewer, or even the "simpleviewer"/"singlepageviewer" component-examples. Hence, in practice this means that only the "pageviewer" component-example[1] have ever really utilized this.

Using factories to initialize various layers in the viewer, rather than simply invoking the relevant code directly, seems (at least to me) like a somewhat roundabout way of doing things.
Not only does this lead to more code, both to write and maintain, but since many of the layers have common parameters (e.g. an AnnotationStorage-instance) there's also some duplication.

Hence this patch, which removes the structTreeLayerFactory and instead uses a lookup-function in the PDFPageView-class to access the external viewer-properties as necessary.
Note that this should even be an improvement for the "pageviewer" component-example, since most layers will now work by default rather than require manual configuration.


[1] In practice we generally suggest using the "simpleviewer", or "singlepageviewer", since it does most things out-of-the-box and given that a lot of functionality really require a viewer and not just a single page in order to work.

Files Modified:

  • web/default_factory.js
  • web/interfaces.js
  • web/pdf_page_view.js
  • web/pdf_viewer.component.js
  • web/pdf_viewer.js

ca69da735e72dc9df2144861c4d1b2406c84dca5 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/ca69da735e72dc9df2144861c4d1b2406c84dca5
Authored: 2022-12-06 23:34:55 +0100
Committed: 2022-12-18 13:25:45 +0100

[api-minor] Remove the annotationLayerFactory in the viewer

Please note that this functionality has never really mattered for the Firefox PDF Viewer, the GENERIC viewer, or even the "simpleviewer"/"singlepageviewer" component-examples. Hence, in practice this means that only the "pageviewer" component-example[1] have ever really utilized this.

Using factories to initialize various layers in the viewer, rather than simply invoking the relevant code directly, seems (at least to me) like a somewhat roundabout way of doing things.
Not only does this lead to more code, both to write and maintain, but since many of the layers have common parameters (e.g. an AnnotationStorage-instance) there's also some duplication.

Hence this patch, which removes the annotationLayerFactory and instead uses a lookup-function in the PDFPageView-class to access the external viewer-properties as necessary.
Note that this should even be an improvement for the "pageviewer" component-example, since most layers will now work by default rather than require manual configuration.


[1] In practice we generally suggest using the "simpleviewer", or "singlepageviewer", since it does most things out-of-the-box and given that a lot of functionality really require a viewer and not just a single page in order to work.

Files Modified:

  • web/default_factory.js
  • web/interfaces.js
  • web/pdf_page_view.js
  • web/pdf_viewer.component.js
  • web/pdf_viewer.js

7aedb8ed7a7f58d185b71f43ff6b60adf2753d7e by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/7aedb8ed7a7f58d185b71f43ff6b60adf2753d7e
Authored: 2022-12-06 14:21:51 +0100
Committed: 2022-12-18 13:10:23 +0100

[api-minor] Remove the annotationEditorLayerFactory in the viewer

Please note that this functionality has never really mattered for the Firefox PDF Viewer, the GENERIC viewer, or even the "simpleviewer"/"singlepageviewer" component-examples. Hence, in practice this means that only the "pageviewer" component-example[1] have ever really utilized this.

Using factories to initialize various layers in the viewer, rather than simply invoking the relevant code directly, seems (at least to me) like a somewhat roundabout way of doing things.
Not only does this lead to more code, both to write and maintain, but since many of the layers have common parameters (e.g. an AnnotationStorage-instance) there's also some duplication.

Hence this patch, which removes the annotationEditorLayerFactory and instead uses a lookup-function in the PDFPageView-class to access the external viewer-properties as necessary.
Note that this should even be an improvement for the "pageviewer" component-example, since most layers will now work by default rather than require manual configuration.


[1] In practice we generally suggest using the "simpleviewer", or "singlepageviewer", since it does most things out-of-the-box and given that a lot of functionality really require a viewer and not just a single page in order to work.

Files Modified:

  • web/annotation_editor_layer_builder.js
  • web/default_factory.js
  • web/interfaces.js
  • web/pdf_page_view.js
  • web/pdf_viewer.js

8fa8310ec91297a4a0c6b4894473a9e15010ec9a by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/8fa8310ec91297a4a0c6b4894473a9e15010ec9a
Authored: 2022-12-07 17:27:02 +0100
Committed: 2022-12-18 13:10:23 +0100

Decouple the annotationLayer and annotationEditorLayer in the viewer

Currently we'll only initialize and render the annotationEditorLayer once the regular annotationLayer has been rendered.
While it obviously makes sense to render the annotationEditorLayer last, the way that the code is currently written means that if a third-party user disables the annotationLayer then the editing-functionality indirectly becomes disabled as well.
Given that this seems like a somewhat arbitrary limitation, this patch simply decouples these two layers while still keeping the rendering order consistent.

Files Modified:

  • web/pdf_page_view.js

ded02941f22aeb501e5d909048f93db89bdf18dd by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/ded02941f22aeb501e5d909048f93db89bdf18dd
Authored: 2022-12-06 13:38:19 +0100
Committed: 2022-12-18 13:10:23 +0100

[api-minor] Move, most of, the isPureXfa-handling from PDFViewer and into PDFPageView

By moving this code the "pageviewer"-component example will become slightly more usable on its own, it may simplify a future addition of XFA Foreground document support, and finally also serves as preparation for the following patches.

Files Modified:

  • src/display/api.js
  • web/pdf_page_view.js
  • web/pdf_viewer.js

a84d14b382ed825b4cd6a1a30901d266a30d41eb by Calixte Denizet

https://github.com/mozilla/pdf.js/commit/a84d14b382ed825b4cd6a1a30901d266a30d41eb
Authored: 2022-12-17 13:48:19 +0100
Committed: 2022-12-17 13:48:19 +0100

[Editor] Avoid to scroll when an annotation is commited (fixes issue #15744)

Files Modified:

  • src/display/editor/freetext.js
  • src/display/editor/ink.js

f4914849df36c91529ce633dec0764eb8729d3f4 by Calixte Denizet

https://github.com/mozilla/pdf.js/commit/f4914849df36c91529ce633dec0764eb8729d3f4
Authored: 2022-12-16 21:34:12 +0100
Committed: 2022-12-16 21:34:12 +0100

Display the text layer before running the a11y stuff (follow-up of #15845)

Files Modified:

  • web/text_layer_builder.js

c550953c6d73e63ddd76cef4f848687a183fce5a by Calixte Denizet

https://github.com/mozilla/pdf.js/commit/c550953c6d73e63ddd76cef4f848687a183fce5a
Authored: 2022-12-14 18:47:59 +0100
Committed: 2022-12-16 20:55:29 +0100

Avoid to compute the client rect of the viewer

The container position and dimensions should be almost constant, hence
it's pretty useless to query them on each rescale.
Finally it avoids to trigger some reflows.

Files Modified:

  • web/app.js
  • web/pdf_viewer.js

c3a3ba2ebeddb5b02a465b5db75164d6654f3165 by Calixte Denizet

https://github.com/mozilla/pdf.js/commit/c3a3ba2ebeddb5b02a465b5db75164d6654f3165
Authored: 2022-12-16 17:24:40 +0100
Committed: 2022-12-16 17:24:40 +0100

[TextLayer] Hide the text layer when it's created in order to avoid reflows (fix #15844)

Files Modified:

  • web/text_layer_builder.js

f80880ccaaad0b951378bcf49903c95e7bc62d33 by Calixte Denizet

https://github.com/mozilla/pdf.js/commit/f80880ccaaad0b951378bcf49903c95e7bc62d33
Authored: 2022-12-16 11:51:23 +0100
Committed: 2022-12-16 15:17:46 +0100

Strip out a reserved operator (9) from CFF char strings (fixes issue #15784)

Files Added:

  • test/pdfs/issue15784.pdf.link

Files Modified:

  • src/core/cff_parser.js
  • test/test_manifest.json

0289038961231b2e95f319e8ed7ba620b1e26ce7 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/0289038961231b2e95f319e8ed7ba620b1e26ce7
Authored: 2022-12-16 11:59:22 +0100
Committed: 2022-12-16 12:09:56 +0100

[GeckoView] Ignore the pageLayout, from the PDF document, to prevent issues

First of all, given the screen-sizes of most mobile phones using Spread modes is unlikely to be useful.
Secondly, and more importantly, since there's (currently) no UI available for the user to override a PDF document-specified Spread mode this would result in a bad UX otherwise.

Also, removes an outdated comment from the apiPageLayoutToViewerModes helper function.

Files Modified:

  • web/app.js
  • web/pdf_scripting_manager.js
  • web/ui_utils.js

4bd66a215093e4580b5db2793e3cea971bda8abd by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/4bd66a215093e4580b5db2793e3cea971bda8abd
Authored: 2022-12-15 18:48:10 +0100
Committed: 2022-12-15 18:48:10 +0100

Protect a few additional DOM element accesses in the viewer (PR 15831 follow-up)

A couple of cases that I missed during review, for code-paths that don't run by default in the viewer.

Files Modified:

  • web/app.js

26135b0313ca0926faaeb37b14d05c2be42aa2f0 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/26135b0313ca0926faaeb37b14d05c2be42aa2f0
Authored: 2022-12-15 13:35:39 +0100
Committed: 2022-12-15 13:46:28 +0100

Always parse the entire startXRefQueue in XRef.readXRef (issue 15833)

Previously we'd abort all parsing if an Error was encountered, despite the fact that multiple startXRefQueue-entries may be available and that continued parsing could thus eventually be able to find usable data.

Note that in the referenced PDF document the startxref-operator, at the end of the file, points to a position in the middle of an arbitrary stream which is why things break.

Files Added:

  • test/pdfs/issue15833.pdf.link

Files Modified:

  • src/core/xref.js
  • test/test_manifest.json

f19572c4ccbabc4d6c3f0ce7e157d90bfe163e08 by Calixte Denizet

https://github.com/mozilla/pdf.js/commit/f19572c4ccbabc4d6c3f0ce7e157d90bfe163e08
Authored: 2022-12-14 16:40:25 +0100
Committed: 2022-12-15 13:39:48 +0100

[GV] Add a viewer for GeckoView

Files Added:

  • web/viewer-geckoview.css
  • web/viewer-geckoview.html
  • web/viewer-geckoview.js

Files Modified:

  • gulpfile.js
  • web/app.js
  • web/ui_utils.js

20037e9919ec5c1322ec35ff01918b7e2293fce5 by Calixte Denizet

https://github.com/mozilla/pdf.js/commit/20037e9919ec5c1322ec35ff01918b7e2293fce5
Authored: 2022-12-14 18:13:09 +0100
Committed: 2022-12-15 10:19:49 +0100

Don't remove the loading icon from the DOM when a page is resetted

Files Modified:

  • web/pdf_page_view.js

0ef72044e27394187041fb2230cc42352246843e by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/0ef72044e27394187041fb2230cc42352246843e
Authored: 2022-12-14 21:36:31 +0100
Committed: 2022-12-14 21:36:31 +0100

Attempt to expose OnProgressParameters in the TypeScript definitions (issue 15828)

Hopefully this works, since as usual I don't really know anything about TypeScript...

Files Modified:

  • src/pdf.js

8ac94d65199d4e3fd6050b0470ad292cd4b4fa3e by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/8ac94d65199d4e3fd6050b0470ad292cd4b4fa3e
Authored: 2022-12-14 13:19:41 +0100
Committed: 2022-12-14 13:23:05 +0100

Initialize the TextHighlighter-instance lazily in PDFPageView

Depending on e.g. the textLayerMode option it might not actually be necessary to always initialize this eagerly.
Please note: Unfortunately we cannot shadow a private field, hence why this is only made semi-"private".

Files Modified:

  • web/pdf_page_view.js

5df341ed7ef0488cbc1f5fab4dc7027de6e6e618 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/5df341ed7ef0488cbc1f5fab4dc7027de6e6e618
Authored: 2022-12-14 13:12:49 +0100
Committed: 2022-12-14 13:12:49 +0100

Make the various layer-render methods, in PDFPageView, properly private

Files Modified:

  • web/pdf_page_view.js

91524d1a60ec2343eead6d9f4873da2e0bc35a47 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/91524d1a60ec2343eead6d9f4873da2e0bc35a47
Authored: 2022-12-14 12:34:16 +0100
Committed: 2022-12-14 12:34:16 +0100

[api-minor] Allow specifying an extra-delay, in RenderTask.cancel, for worker-thread aborting of operatorList parsing

This is done to support upcoming viewer-changes, and in order to prevent third-party users from outright breaking things we'll simply ignore too large values.

Files Modified:

  • src/display/api.js
  • src/display/display_utils.js
  • test/unit/api_spec.js

dcf9ff2182becaecf59274d59b9b56fa6ce9aee8 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/dcf9ff2182becaecf59274d59b9b56fa6ce9aee8
Authored: 2022-12-07 16:12:48 +0100
Committed: 2022-12-14 12:23:24 +0100

Handle possibly undefined parameters once per AnnotationLayer.render invocation

There's no reason to repeat this for every single annotation. Also, adds a couple of missing JSDoc-parameters.

Files Modified:

  • src/display/annotation_layer.js
  • web/annotation_layer_builder.js

2ebf8745a24d30756ef828af354756333beb1abb by Calixte Denizet

https://github.com/mozilla/pdf.js/commit/2ebf8745a24d30756ef828af354756333beb1abb
Authored: 2022-12-13 16:08:36 +0100
Committed: 2022-12-13 21:12:32 +0100

[JS] Run the named actions before running the format when the file is open (issue #15818)

It's a follow-up of #14950: some format actions are ran when the document is open
but we must be sure we've everything ready for that, hence we have to run some
named actions before runnig the global format.
In playing with the form, I discovered that the blur event wasn't triggered when
JS called setFocus (because in such a case the mouse was never down). So I removed
the mouseState thing to just use the correct commitKey when blur is triggered by a
TAB key.

Files Added:

  • test/pdfs/issue15818.pdf

Files Modified:

  • src/display/annotation_layer.js
  • src/scripting_api/doc.js
  • src/scripting_api/event.js
  • test/integration/scripting_spec.js
  • test/pdfs/.gitignore
  • web/annotation_layer_builder.js
  • web/default_factory.js
  • web/interfaces.js
  • web/pdf_scripting_manager.js
  • web/pdf_viewer.js

0c1ec946aa3aa8d9bdfc30858570a0cc63afc6ea by Calixte Denizet

https://github.com/mozilla/pdf.js/commit/0c1ec946aa3aa8d9bdfc30858570a0cc63afc6ea
Authored: 2022-12-13 00:07:45 +0100
Committed: 2022-12-13 19:08:26 +0100

[JS] Handle correctly choice widgets where the display and the export values are different (issue #15815)

Files Added:

  • test/pdfs/issue15815.pdf

Files Modified:

  • src/core/annotation.js
  • src/display/annotation_layer.js
  • src/scripting_api/event.js
  • src/scripting_api/field.js
  • test/integration/scripting_spec.js
  • test/pdfs/.gitignore
  • test/test_manifest.json

1a397681fe92980c9189f3e522ffc89f667d73bf by Calixte Denizet

https://github.com/mozilla/pdf.js/commit/1a397681fe92980c9189f3e522ffc89f667d73bf
Authored: 2022-12-13 14:33:58 +0100
Committed: 2022-12-13 14:54:45 +0100

The annotation layer dimensions must be set before adding some elements (follow-up of #15770)

In order to move the annotations in the DOM to have something which corresponds
to the visual order, we need to have their dimensions/positions which means that
the parent must have some dimensions.

Files Added:

  • test/pdfs/fields_order.pdf

Files Modified:

  • src/display/annotation_layer.js
  • test/integration/accessibility_spec.js
  • test/pdfs/.gitignore

cafdc481478e45f58b59a65704fb11b7bd04014f by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/cafdc481478e45f58b59a65704fb11b7bd04014f
Authored: 2022-12-08 12:37:18 +0100
Committed: 2022-12-11 18:37:35 +0100

[api-minor] Add a new PageViewport-getter to access the original, un-scaled, viewport dimensions

While reviewing recent patches, I couldn't help but noticing that we now have a lot of call-sites that manually access the PageViewport.viewBox-property.
Rather than repeating that verbatim all over the code-base, this patch adds a lazily computed and cached getter for this data instead.

Files Modified:

  • src/display/annotation_layer.js
  • src/display/display_utils.js
  • src/display/editor/annotation_editor_layer.js
  • src/display/editor/editor.js
  • src/display/text_layer.js

9b6d0d994dbe3df5b29b96026958c84f4bc54592 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/9b6d0d994dbe3df5b29b96026958c84f4bc54592
Authored: 2022-12-10 12:25:50 +0100
Committed: 2022-12-11 18:12:10 +0100

Remove the API-caching of annotation-data

This was essentially done only to compensate for the viewer calling PDFPageProxy.getAnnotations unconditionally on every annotationLayer-rendering invocation. With the previous patch that's no longer happening, and this API-caching should thus no longer be necessary.

Files Modified:

  • src/display/api.js

8e56f072e0bde6706919dfbead61bc96164a7c92 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/8e56f072e0bde6706919dfbead61bc96164a7c92
Authored: 2022-12-11 14:51:28 +0100
Committed: 2022-12-11 18:12:09 +0100

Don't attempt to re-create the annotationLayer, for pages without any annotations, on zooming and rotation

For pages without any annotations, applies e.g. to the tracemonkey.pdf document, we'll repeatedly try to re-create the annotationLayer on every zoom and rotation operation.
The reason that this happens is because we don't insert the annotationLayer-div into the DOM unless there's annotations present on the page, which thus means that we miss the existing annotationLayer-caching present in the PDFPageView implementation.

This is a very old issue, and the easiest solution is to simply always insert an empty (and hidden) annotationLayer-div such that the existing code/caching starts working for the "no annotations" case as well.
Note that this is consistent with other layers, since e.g. the textLayer and/or annotationEditorLayer may be empty. Given that only a limited, by default ten, number of pages are ever active at once the additional DOM-elements shouldn't effect things negatively here.

Files Modified:

  • web/annotation_layer_builder.js

828efd9d000ab868369ac19cbc2ed0f8cc09c92f by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/828efd9d000ab868369ac19cbc2ed0f8cc09c92f
Authored: 2022-12-11 13:07:44 +0100
Committed: 2022-12-11 13:08:23 +0100

Change the XfaLayerBuilder.render method to be asynchronous

This is consistent with the render methods of the other layers, and reduces overall indentation in the method.
Furthermore, don't "swallow" errors since the PDFPageView._renderXfaLayer method is already able to deal with that.

Files Modified:

  • web/xfa_layer_builder.js

a989b5a87942ff728463af7a6a1dae3df691d095 by Calixte Denizet

https://github.com/mozilla/pdf.js/commit/a989b5a87942ff728463af7a6a1dae3df691d095
Authored: 2022-11-21 18:48:37 +0100
Committed: 2022-12-10 14:35:06 +0100

Set the dimensions of the various layers at their creation

  • Use a unique helper function in display/display_utils.js;
  • Move those dimensions in css' side.

Files Modified:

  • src/display/annotation_layer.js
  • src/display/display_utils.js
  • src/display/editor/annotation_editor_layer.js
  • src/display/text_layer.js
  • src/pdf.js
  • web/annotation_editor_layer_builder.js
  • web/annotation_layer_builder.js
  • web/pdf_page_view.js
  • web/pdf_viewer.css

bed1a1baa19e9f0f63bdb637d7c02aa3dd38a4d8 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/bed1a1baa19e9f0f63bdb637d7c02aa3dd38a4d8
Authored: 2022-12-09 23:24:18 +0100
Committed: 2022-12-10 10:16:20 +0100

[AnnotationEditorLayerBuilder] Inline the destroy code in the cancel method

It doesn't seem necessary to have a separate destroy method given that the cancel method always invokes it unconditionally.
In the PDFPageView.reset method we currently attempt to call destroy directly, however that'll never actually happen since either:

  • We're keeping the annotationEditorLayer, in which case we're just hiding the layer and nothing more (and the relevant branch is never entered).
  • We're removing the annotationEditorLayer, in which case the PDFPageView.cancelRendering method has already cancelled and nulled it (and there's thus nothing left to destroy here).

Please note: Hopefully I'm not overlooking something obvious here, since both reading through the code and also adding console.log(this.annotationEditorLayer); before this line suggests that it's indeed unnecessary.

Files Modified:

  • web/annotation_editor_layer_builder.js
  • web/pdf_page_view.js

527258c31677ee024e093c1844714aecf4614c0f by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/527258c31677ee024e093c1844714aecf4614c0f
Authored: 2022-12-09 14:30:12 +0100
Committed: 2022-12-09 14:30:12 +0100

Ensure that the various layers always get the correct initial size (issue 15795)

Files Modified:

  • web/pdf_page_view.js
  • web/pdf_viewer.js

47ac706972d1c62853f8e3e1a7335eb0efcf4771 by Jonas Jenwald

https://github.com/mozilla/pdf.js/commit/47ac706972d1c62853f8e3e1a7335eb0efcf4771
Authored: 2022-12-09 11:40:45 +0100
Committed: 2022-12-09 14:09:56 +0100

Fix page-switching for landscape documents with SpreadModes and PresentationMode (PR 14877 follow-up)

In PR 14877 I forgot to update the horizontal padding, used when computing the scale of the pages, for the case where SpreadModes and PresentationMode are being used together.

Steps to reproduce:

  1. Open the viewer with the default tracemonkey.pdf document.
  2. Enable any SpreadMode.
  3. Rotate the document once, either clockwise or counterclockwise.
  4. Enter PresentationMode.
  5. Try swithching page, e.g. by clicking on the document.

Expected result:
The visible pages change as you click.

Actual result:
The visible pages are "stuck" in the current view.

Files Modified:

  • web/pdf_viewer.js

Duplicate of this bug: 1806031

The try push is done, we found jobs with unclassified failures.

Needs Investigation (From Push Health):

No tests were found for flavor 'plain' and the following manifest filters:

skip_if, run_if, fail_if, subsuite(name=None), tags(['condprof']), pathprefix(['toolkit/components/pdfjs/test'])

Make sure the test paths (if any) are spelt correctly and the corresponding
--flavor and --subsuite are being used. See mach mochitest --help for a
list of valid flavors.
- 2 of 2 failed on different tasks
- test-linux1804-64-qr/opt-mochitest-plain-condprof-1 (XcEMWGIfQhqW2f5zo4DRoQ)
- test-windows10-64-2004-qr/opt-mochitest-plain-condprof-1 (UNoZVKbxTxaZNQPqH0b7Ng)

browser/base/content/test/static/browser_all_files_referenced.js
	- 9 of 9 failed on different tasks
	- test-linux1804-64-qr/opt-mochitest-browser-chrome-spi-nw-1 (cv2ncOiSRYmfBeQYdG2cqA)
	- test-linux1804-64-qr/opt-mochitest-browser-chrome-swr-1 (XnYRdKFVSziAwlfmJHixlg)
	- test-linux1804-64-qr/opt-mochitest-browser-chrome-swr-a11y-checks-1 (Z0JnL5IwSb-idNdRNzDHvg)
	- test-macosx1015-64-qr/opt-mochitest-browser-chrome-1 (Jvm1ORGWSAyNI3hAMc8Wyw)
	- test-macosx1015-64-qr/opt-mochitest-browser-chrome-spi-nw-1 (R6JN42BwT4auPSt-d9jrvw)
	- test-windows10-64-2004-qr/opt-mochitest-browser-chrome-1 (aKwnc3SeRuytCabXVeQxoA)
	- test-windows10-64-2004-qr/opt-mochitest-browser-chrome-spi-nw-1 (HrHdpWkDTju72mpJ-TKeOw)
	- test-windows10-64-2004-qr/opt-mochitest-browser-chrome-msix-1 (QdeFZ8jeS9GCVjpcuzecng)
	- test-windows7-32-qr/opt-mochitest-browser-chrome-1 (Ysy-77jAShOjZh_QzkgVoQ)

browser/base/content/test/static/browser_parsable_css.js
	- 8 of 8 failed on different tasks
	- test-linux1804-64-qr/opt-mochitest-browser-chrome-spi-nw-1 (cv2ncOiSRYmfBeQYdG2cqA)
	- test-linux1804-64-qr/opt-mochitest-browser-chrome-swr-1 (XnYRdKFVSziAwlfmJHixlg)
	- test-linux1804-64-qr/opt-mochitest-browser-chrome-swr-a11y-checks-1 (Z0JnL5IwSb-idNdRNzDHvg)
	- test-macosx1015-64-qr/opt-mochitest-browser-chrome-1 (Jvm1ORGWSAyNI3hAMc8Wyw)
	- test-macosx1015-64-qr/opt-mochitest-browser-chrome-spi-nw-1 (R6JN42BwT4auPSt-d9jrvw)
	- test-windows10-64-2004-qr/opt-mochitest-browser-chrome-1 (aKwnc3SeRuytCabXVeQxoA)
	- test-windows10-64-2004-qr/opt-mochitest-browser-chrome-spi-nw-1 (HrHdpWkDTju72mpJ-TKeOw)
	- test-windows7-32-qr/opt-mochitest-browser-chrome-1 (Ysy-77jAShOjZh_QzkgVoQ)

toolkit/components/pdfjs/test/browser_pdfjs_zoom.js
	- 17 of 17 failed on different tasks
	- test-linux1804-64-qr/debug-mochitest-browser-chrome-swr-1 (N7GoaHd0TMuJTS0MNp5ldw)
	- test-linux1804-64-qr/debug-mochitest-browser-chrome-spi-nw-1 (SQawFiuHTPG3Wv_Ty986Pg)
	- test-windows10-64-2004-qr/debug-mochitest-browser-chrome-spi-nw-1 (EeMnbq7sTS2cy4AntO2_UA)
	- test-windows10-64-2004-qr/debug-mochitest-browser-chrome-1 (EmpBDWsKQlilI9ivf8Q4cg)
	- test-windows10-64-2004-qr/debug-mochitest-browser-chrome-swr-1 (H4cNiBFuQc62w_PcCM_V_g)
	- test-linux1804-64-qr/opt-mochitest-browser-chrome-spi-nw-1 (cv2ncOiSRYmfBeQYdG2cqA)
	- test-linux1804-64-qr/opt-mochitest-browser-chrome-swr-1 (XnYRdKFVSziAwlfmJHixlg)
	- test-linux1804-64-qr/opt-mochitest-browser-chrome-swr-a11y-checks-1 (Z0JnL5IwSb-idNdRNzDHvg)
	- test-macosx1015-64-qr/opt-mochitest-browser-chrome-1 (Jvm1ORGWSAyNI3hAMc8Wyw)
	- test-macosx1015-64-qr/opt-mochitest-browser-chrome-spi-nw-1 (R6JN42BwT4auPSt-d9jrvw)
	- test-windows10-64-2004-qr/opt-mochitest-browser-chrome-1 (aKwnc3SeRuytCabXVeQxoA)
	- test-windows10-64-2004-qr/opt-mochitest-browser-chrome-spi-nw-1 (HrHdpWkDTju72mpJ-TKeOw)
	- test-macosx1015-64-qr/debug-mochitest-browser-chrome-spi-nw-1 (beGaI8b7RdGyKnbmy2zoOg)
	- test-macosx1015-64-qr/debug-mochitest-browser-chrome-1 (HMR7EnOLSGuVruBjjJYTrw)
	- test-windows10-64-2004-qr/opt-mochitest-browser-chrome-msix-1 (QdeFZ8jeS9GCVjpcuzecng)
	- test-windows7-32-qr/opt-mochitest-browser-chrome-1 (Ysy-77jAShOjZh_QzkgVoQ)
	- test-windows10-32-2004-qr/debug-mochitest-browser-chrome-1 (OkVr9iPRRX6wW5QODOSRzw)

Needs Investigation (Other Failed Jobs):
test-linux1804-64-qr/debug-mochitest-devtools-chrome-spi-nw-1
- 4 of 4 failed on the same (retriggered) task (Ux-hcRPxTEqy6gIMQx1ZfA, cmHaeeBtRmGyYv5vCCpSpA, NH_GVrHkRZWTVVW5AS1N-Q, T44rG96jRpGm1ozV_86a8A)
test-linux1804-64-qr/debug-mochitest-devtools-chrome-swr-1
- 4 of 4 failed on the same (retriggered) task (AMaJqdetRiiiNweWC-d5Lg, XQwGU_KiQ1SkM8pkgoMrsQ, MI2g14_WRiChcnuwcH_u4A, YFSBtgKpQ8a2OrbUokeNlQ)
test-macosx1015-64-qr/debug-mochitest-devtools-chrome-1
- 4 of 4 failed on the same (retriggered) task (ATrrshPlTO6Dde-apuqHTw, cq5xlZ0CTlK5UAy4V7Ahiw, Ht9VMQd1RDy520GGjRxUTg, asKUkcMrSi6t3E8DbMe4Eg)
test-windows10-64-2004-qr/debug-mochitest-devtools-chrome-1
- 4 of 4 failed on the same (retriggered) task (bjQ-4SGWT42OQOj6xW6Mfw, dT2tP6X0Q9azr-DPNXijsw, U97tN4xFToqQSqeDDFs8wQ, V_nPZUzuRlG3omXCF67MwA)
test-windows10-64-2004-qr/debug-mochitest-devtools-chrome-spi-nw-1
- 4 of 4 failed on the same (retriggered) task (c8WAyYoFRDGBMhslKbVYJQ, NX1U9lj1SlWWjpEP45zTuw, EN00HErpSD-KImiHjVfV5g, WCNT60ZsTCWNMrtHy6Wbrg)
test-linux1804-64-qr/debug-mochitest-devtools-chrome-1
- 4 of 4 failed on the same (retriggered) task (RHSCbUkEQ8uuLfBf9MU8AA, IQRp_kt_TbelAkL1SS1TxA, XsH47pmMTpanVelx6wYrAA, ZXHmt-EbQsqNEHhzk1UYng)
test-macosx1015-64-qr/debug-mochitest-devtools-chrome-spi-nw-1
- 4 of 4 failed on the same (retriggered) task (Ff4epyp5S1KrSekvU5aubg, JWVDfdthTW2MmGDa1IiDHQ, ZgUe4VtQRHulOLaLiKgrRg, TPWnW-W-TViQOTD4VtxkIg)

These failures could mean that the library update changed something and caused
tests to fail. You'll need to review them yourself and decide where to go from here.

In either event, I have done all I can and you will need to take it from here. If you
don't want to land my patch, you can replicate it locally for editing with
./mach vendor toolkit/components/pdfjs/moz.yaml

When reviewing, please note that this is external code, which needs a full and
careful inspection - not a rubberstamp.

Assignee: nobody → cdenizet
Flags: needinfo?(cdenizet)

This bug is being closed because a newer revision of the library is available.
This bug will be marked as a duplicate of it (because although this bug is older, it is superseded by the newer one).

Status: NEW → RESOLVED
Closed: 3 years ago
Duplicate of bug: 1807983
Resolution: --- → DUPLICATE
Attachment #9309648 - Attachment is obsolete: true
Flags: needinfo?(cdenizet)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: