Commit Graph

18264 Commits

Author SHA1 Message Date
Calixte Denizet
91eda77f63 [Editor] Fix the colors in HCM when hovering a button in the editor toolbar
It fixes few errors in the CSS for HCM.
It now complies to the specs from UI/UX.
Only the foreground must change in HCM and not the background, similarly to what
we had for the alt-text button before moving it.
2023-11-29 19:53:03 +01:00
calixteman
59cf2ee5a9
Merge pull request #17338 from Snuffleupagus/rm-FirefoxCom-requestSync
[Firefox] Remove the `FirefoxCom.requestSync` method
2023-11-28 16:26:32 +01:00
Jonas Jenwald
b03ce96605 [Firefox] Remove the FirefoxCom.requestSync method, since it's unused
After the two previous commits, which removed the remaining call-sites, this method is no longer used and can thus be removed.
As mentioned in the JSDocs for the now removed method, synchronous communication between the viewer and the platform code isn't really a good idea.

Once this patch has landed in mozilla-central some additional clean-up of the platform code will also be possible.
2023-11-28 16:19:58 +01:00
Jonas Jenwald
9ca504e538 [Firefox] Don't send the "abortLoading" message synchronously
Despite the comment, I believe that changing this should be fine for two separate reasons:
 - The platform code has an "unload" event listener, see [this code](https://searchfox.org/mozilla-central/rev/edb2612db13e89f1c44ab95b1e4d4366c16eb9fb/toolkit/components/pdfjs/content/PdfStreamConverter.sys.mjs#533-538), that invokes the same method. Hence we should still be guaranteed that the relevant platform method will run.

 - The `FirefoxComDataRangeTransport.abort` method is never actually invoked in the Firefox PDF Viewer.
   Note that the [`PDFDataRangeTransport.abort` method](f4b396f6c8/src/display/api.js (L759)) is only invoked via the [`PDFDataTransportStream.cancelAllRequests` method](f4b396f6c8/src/display/transport_stream.js (L167-L175)), which in turn is only invoked via the [`WorkerTransport.destroy` method](f4b396f6c8/src/display/api.js (L2485-L2487)). That method is invoked via the [`PDFDocumentLoadingTask.destroy` method](f4b396f6c8/src/display/api.js (L630)), which in the viewer is only invoked via the [`PDFViewerApplication.close` method](f4b396f6c8/web/app.js (L919)) which is never actually called in the Firefox PDF Viewer.

All-in-all, given the existing platform code *and* the current viewer-implementation it should thus be safe to not wait for the "abortLoading" message to complete.
2023-11-28 16:19:58 +01:00
Jonas Jenwald
ddebb0f954 [Firefox] Don't send the "initPassiveLoading" message synchronously
The return value is not, nor has it ever been, used for anything and we should thus be able to just send the message.
Note that the responses are already handled by the "message" event listener registered above.
2023-11-28 16:19:58 +01:00
calixteman
f4952399a4
Merge pull request #17329 from calixteman/move_alt_text_button
[Editor] Move the alt text button in the editor toolbar
2023-11-28 15:57:35 +01:00
Calixte Denizet
59112a7730 [Editor] Move the alt text button in the editor toolbar 2023-11-28 15:36:29 +01:00
calixteman
8e2507e0e8
Merge pull request #17317 from calixteman/editor_highlight
[Editor] Add a new editor to highlight some text in a pdf (bug 1866119)
2023-11-28 15:12:43 +01:00
Calixte Denizet
1ea6293923 [Editor] Add a new editor to highlight some text in a pdf (bug 1866119)
This patch is first big step for the new highlight feature.
Few patches will follow in order to conform to the specs UX/UI gave us.
2023-11-28 14:21:53 +01:00
calixteman
4bf7ff2027
Merge pull request #17344 from calixteman/issue17342
[Editor] Avoid to add a new ink editor when we aren't editing anymore
2023-11-27 16:53:48 +01:00
Calixte Denizet
2be136ab70 [Editor] Avoid to add a new ink editor when we aren't editing anymore 2023-11-27 16:18:31 +01:00
calixteman
b7e943bc7d
Merge pull request #17340 from calixteman/issue17332
Don't throw when there isn't enough data to get block info in flate stream
2023-11-26 19:23:25 +01:00
Calixte Denizet
52ea20eda4 Don't throw when there isn't enough data to get block info in flate stream
but just ends the stream.
2023-11-26 18:12:22 +01:00
Tim van der Meij
02a0189795
Merge pull request #17339 from timvandermeij/bump
Bump the stable version in `pdfjs.config`
2023-11-26 13:50:08 +01:00
Tim van der Meij
dd07267da6
Bump the stable version in pdfjs.config 2023-11-26 13:46:23 +01:00
Tim van der Meij
f4b396f6c8
Merge pull request #17334 from timvandermeij/updates
Update dependencies and translations to the most recent versions
2023-11-25 19:42:40 +01:00
Tim van der Meij
ab692f805a
Update translations to the most recent versions 2023-11-25 19:34:44 +01:00
Tim van der Meij
dd7ff7e662
Update the JSDoc comments for the new TypeScript version
This commit fixes the JSDoc comment for the `annotationEditorMode` setter.
The types tests fail on that now because the input value was changed from
a number to an object with various properties in recent patches, but the
JSDoc comment was not updated accordingly.

Moreover, the types tests also fail because TypeScript 5.3 assumes that
getters and setters have equal return and input value types, which is
arguably also what one would expect, but our `annotationEditorMode`
getter and setter deviate from that because the getter returns a number
while the setter accepts an object. Given that it seems more important
to document the setter entirely, including the meaning and types of its
properties, and the type of the getter can easily be inferred from this
comment and the other JSDoc comments that have `annotationEditorMode` in
it, we remove the getter type to make the types tests pass again.
2023-11-25 19:34:44 +01:00
Tim van der Meij
8aa26fad24
Update the code style for the new Prettier version
This patch is automatically generated using `gulp lint --fix`.
2023-11-25 18:15:09 +01:00
Tim van der Meij
7381515e20
Update dependencies to the most recent versions 2023-11-25 17:25:35 +01:00
calixteman
9d863f5180
Merge pull request #17331 from calixteman/lang_marker
Remove language codes from text strings.
2023-11-25 16:43:37 +01:00
Calixte Denizet
eb5f610d18 Remove language codes from text strings.
And take care to have an even number of bytes with utf16 strings.
2023-11-25 15:09:31 +01:00
Tim van der Meij
4b1de1537f
Merge pull request #17320 from tamuratak/fix_webpack_readme
Fix examples/webpack/README.md.
2023-11-25 12:49:04 +01:00
Jonas Jenwald
3d9f68cb97
Merge pull request #17328 from Snuffleupagus/fetchData-blob
Use the `fetchData` helper function in more cases
2023-11-25 08:31:12 +01:00
calixteman
58316369e5
Merge pull request #17330 from calixteman/issue17327
[Editor] Only focus the canvas for mouse events when drawing in the canvas
2023-11-24 19:09:18 +01:00
Calixte Denizet
42147e8839 [Editor] Only focus the canvas for mouse events when drawing in the canvas
And if we've to focus it, we must prevent scrolling to avoid to draw at an
unexpected position.
2023-11-24 16:00:04 +01:00
Jonas Jenwald
fd7a7e2859 Use the fetchData helper function in more cases
- Extend the `fetchData` helper function to also support fetching of "blob" data.

 - Use the `fetchData` helper function more in the code-base, when fetching non-PDF data. Given that the Fetch API isn't supported for all protocols, this should improve compatibility for the PDF.js library.
2023-11-24 13:05:57 +01:00
calixteman
d679078beb
Merge pull request #17318 from calixteman/bug1864136_2
Make sure that only one radio button is checked in its group (bug 1864136)
2023-11-24 08:40:23 +01:00
Calixte Denizet
1f0f51613a Make sure that only one radio button is checked in its group (bug 1864136)
When the first checked radio is met, the others in the group are set to false.
2023-11-23 17:01:49 +01:00
Takashi Tamura
6e7381bc20 Fix examples/webpack/README.md. The .mjs extension is necessary. Close #17319 2023-11-23 09:25:20 +09:00
Jonas Jenwald
5781e722bf
Merge pull request #17294 from Snuffleupagus/toolbarViewerRight-reorder
Move the editor-buttons in the main toolbar
2023-11-22 14:06:24 +01:00
Jonas Jenwald
5df7c97074 Move the editor-buttons in the main toolbar
By introducing a CSS variable for the editor-toolbars we're able to handle resizing of the viewer without complicating the code too much.
2023-11-22 13:04:05 +01:00
calixteman
09ff1b98ee
Merge pull request #17304 from calixteman/editor_highlight2
[Editor] Add support for saving/printing a newly added Highlight annotation (bug 1865708)
2023-11-22 12:23:27 +01:00
Calixte Denizet
f8f4432961 [Editor] Add support for saving/printing a newly added Highlight annotation (bug 1865708) 2023-11-22 10:41:55 +01:00
Jonas Jenwald
83f0029212
Merge pull request #17287 from Snuffleupagus/CSS-loading-icon
Re-factor the loading-icons used in the viewer toolbars
2023-11-21 14:11:55 +01:00
Jonas Jenwald
625d4f794e Re-factor the loading-icons used in the viewer toolbars
Currently the SVG images for the loading-icons exist in two versions, for the light- respectively dark-theme, which nowadays are the only "duplicated" icons left.
The reason for this is that these icons are being used in `input`-elements, where the regular `mask-image` approach used for all buttons don't work.

To address this we add containers for the `input`-elements, such that we have a "regular" DOM-element where we can use `mask-image`.
2023-11-21 13:55:36 +01:00
calixteman
02ccdbb2b1
Merge pull request #17291 from calixteman/editor_highlight1
[Editor] Add a way to extract the outlines of a union of rectangles
2023-11-21 10:56:18 +01:00
Jonas Jenwald
086a5921dc
Merge pull request #17303 from Snuffleupagus/issue-17302
Throw a `JpegError` when a JPEG image has no frame data (issue 17302)
2023-11-20 18:53:35 +01:00
Calixte Denizet
31d9b9f574 [Editor] Add a way to extract the outlines of a union of rectangles
The goal is to be able to get these outlines to fill the shape corresponding
to a text selection in order to highlight some text contents.
The outlines will be used either to show selected/hovered highlights.
2023-11-20 18:45:19 +01:00
Jonas Jenwald
a6f0609a6e Throw a JpegError when a JPEG image has no frame data (issue 17302)
Given that there's nothing to parse in this case, since we're dealing with an invalid JPEG image, throwing an *explicit* Error makes sense here.
2023-11-20 17:33:49 +01:00
calixteman
d8424a43ba
Merge pull request #17300 from calixteman/issue17299
[Editor] Make the alt-text button large enough to display correctly whatever string
2023-11-20 15:45:53 +01:00
Calixte Denizet
bd6c2a192c [Editor] Make the alt-text button large enough to display correctly whatever string 2023-11-20 13:22:02 +01:00
calixteman
3459615ec3
Merge pull request #17293 from calixteman/dark
Restore the option to set light/dark mode for chromium and generic builds
2023-11-18 21:48:09 +01:00
Calixte Denizet
53101b379b Restore the option to set light/dark mode for chromium and generic builds 2023-11-18 21:32:25 +01:00
calixteman
ffbfd680ec
Merge pull request #17281 from calixteman/delete_button_tooltip
[Editor] Add a tooltip to the delete button
2023-11-15 12:59:52 +01:00
Calixte Denizet
b7d28a3bf6 [Editor] Add a tooltip to the delete button 2023-11-15 10:51:39 +01:00
Jonas Jenwald
1df648733e
Merge pull request #17277 from Snuffleupagus/L10n-fetchData
Re-factor how the `GenericL10n` class fetches localization-data
2023-11-14 16:09:05 +01:00
Jonas Jenwald
5099dc4699
Merge pull request #17273 from Snuffleupagus/L10n-lowercase-locales
Re-factor the `L10n`-implementations to use lowercase language-codes internally
2023-11-14 15:59:13 +01:00
Jonas Jenwald
709d89420e Re-factor how the GenericL10n class fetches localization-data
- Re-factor the existing `fetchData` helper function such that it can fetch more types of data, and it now supports "arraybuffer", "json", and "text".
   This only needed minor adjustments in the `DOMCMapReaderFactory` and `DOMStandardFontDataFactory` classes.[1]

 - Expose the `fetchData` helper function in the API, such that the viewer is able to access it.

 - Use the `fetchData` helper function in the `GenericL10n` class, since this should allow fetching of localization-data even if the default viewer is run in an environment without support for the Fetch API.

---
[1] While testing this I also noticed a minor inconsistency when handling standard font-data on the worker-thread.
2023-11-14 13:45:14 +01:00
Jonas Jenwald
1f9533bae9 Re-factor the L10n-implementations to use lowercase language-codes internally
This is consistent with the implementation used in the (now removed) webL10n-library, and by only using lowercase language-codes internally in the `L10n`-implementations we should avoid future issues e.g. when users manually set the `locale`-option (in the default viewer).
2023-11-13 21:06:03 +01:00