Commit graph

58399 commits

Author SHA1 Message Date
Lucas CHOLLET
c2c7365494 LibGfx/TIFF: Accept images with a single strip and no RowsPerStrip tag
This tag is required by the specification, but some encoders (at least
Krita) don't write it for images with a single strip.

The test file was generated by opening deflate.tiff in Krita and saving
it with the DEFLATE compression.
2024-01-19 14:13:44 +01:00
Lucas CHOLLET
284e785053 LibGfx/TIFF: Accept the PixarDeflate compression tag
I would have liked to avoid adding a deprecated tag but this is the one
currently in use in Krita.
2024-01-19 14:13:44 +01:00
kleines Filmröllchen
3afbf66295 LoginServer: Use new GML compiler 2024-01-19 10:50:15 +00:00
kleines Filmröllchen
8ee014a437 CertificateSettings: Use new GML compiler 2024-01-19 10:50:15 +00:00
kleines Filmröllchen
63687c46ff CalendarSettings: Use new GML compiler 2024-01-19 10:50:15 +00:00
kleines Filmröllchen
14a99bb22d Calendar: Use new GML compiler 2024-01-19 10:50:15 +00:00
kleines Filmröllchen
15a539a5b0 Calculator: Use new GML compiler 2024-01-19 10:50:15 +00:00
kleines Filmröllchen
182126dfda BrowserSettings: Use new GML compiler 2024-01-19 10:50:15 +00:00
kleines Filmröllchen
6f554af9c5 Run: Use new GML compiler 2024-01-19 10:50:15 +00:00
Andrew Kaster
05ea3d6be0 headless-browser: Navigate after attaching new callbacks for ref tests 2024-01-19 11:47:59 +01:00
Andrew Kaster
1358fe85b0 LibWeb: Add option to TemporaryExecutionContext to prepare for callbacks
In the cases where spec authors have us directly interact with promises
in a task source context, we need to prepare the backup settings object
stack as well as push an actual execution context to the JS VM.
2024-01-19 11:47:59 +01:00
Andrew Kaster
2cd93e6b58 LibWeb: Pump the task queue when spinning until a goal condition
This prevents goal conditions that rely on tasks that are currently in
flight on the task queue (or were just submitted) from blocking the
event loop until an IPC event fires to kick the native event loop.
2024-01-19 11:47:59 +01:00
Andrew Kaster
7d2635355d LibWeb: Respect the trusted state of input events when submitting forms
This involves passing the UserNavigationInvolvement from each form
associated element that triggers a submit through to the methods that
perform the actual navigation. While here, refactor HTMLFormElement to
use the new Bindings::NavigationHistoryBehavior enum.
2024-01-19 11:47:59 +01:00
Andrew Kaster
a5e1364938 LibWeb: Respect the trusted state of input events when clicking links 2024-01-19 11:47:59 +01:00
Andrew Kaster
32fe7db69f LibWeb: Make UIEvents from the chrome the only default trusted Events 2024-01-19 11:47:59 +01:00
Andrew Kaster
567bb0f6a2 LibWeb: Implement user navigation involvement helper for MouseEvents 2024-01-19 11:47:59 +01:00
Andrew Kaster
aef5932235 LibJS: Add method to VM to clear the execution context stack
This is needed for the spin the event loop AO in LibWeb
2024-01-19 11:47:59 +01:00
Andrew Kaster
682a6d5882 Tests: Add tests for navigation.navigate() 2024-01-19 11:47:59 +01:00
Andrew Kaster
19e802d09c LibWeb: Remove invalid assertion in API method tracker promotion AO 2024-01-19 11:47:59 +01:00
Andrew Kaster
4f088aff3d LibWeb: Implement synchronous session history steps 2024-01-19 11:47:59 +01:00
Andrew Kaster
d6d1485720 LibWeb: Bring destroy the child navigable comments closer to spec 2024-01-19 11:47:59 +01:00
Andrew Kaster
7576e9dcd2 LibWeb: Set the UserNavigationInvolvement for UI initiated navigations 2024-01-19 11:47:59 +01:00
Andrew Kaster
3441b37de5 LibWeb: Store Promise::wait_for_all state in a JS-heap allocated object
The one current caller of this function always defers microtask
checkpoints before calling wait_for_all, ensuring that the promise
accept/reject handlers will always be called later in the Web event loop
processing. We need to store all the state for the closures in a heap
allocated object with HeapFunctions to keep it around while there are
still promises to resolve.
2024-01-19 11:47:59 +01:00
Andrew Kaster
346eb02659 LibWeb: Remove last substantial FIXMEs from Navigation API 2024-01-19 11:47:59 +01:00
Andrew Kaster
52a9a8146b LibWeb: Remove old FIXMEs about not setting up the navigation API's NHEs 2024-01-19 11:47:59 +01:00
Andrew Kaster
6c1944ee61 LibWeb: Flesh out apply the history step to setup the navigation API
We now populate the navigation history entries in the navigation API and
fire more navigation events as appropriate.
2024-01-19 11:47:59 +01:00
Andrew Kaster
a8091c009b LibWeb: Add assorted AOs related to populating the navigation API's SHEs 2024-01-19 11:47:59 +01:00
Andrew Kaster
49e0466a3d LibWeb: Add state field to History
This is the "classic history API state" referenced in the current HTML
spec.
2024-01-19 11:47:59 +01:00
Andrew Kaster
2c27b4e63c LibWeb: Ensure an ESO is pushed before doing structured deserialization
We need to make sure that the given target realm is at the top of the
VM's execution context stack before doing any JS object construction
based on the data in our serialized buffer.
2024-01-19 11:47:59 +01:00
Andreas Kling
9f6841a65c LibWeb: Update layout before looking at overflow in window.scroll()
Fixes a crash seen on https://www.ekioh.com/
2024-01-19 09:16:54 +01:00
Tim Ledbetter
0d8a013ee1 SoundPlayer: Don't drop the unix pledge
Without it, `SoundPlayer` crashes as soon as you try to open a file.
2024-01-19 09:08:37 +01:00
Andrew Kaster
2505cecc0f LibWeb: Exclude [Global] interfaces from legacy platform object methods
Window and other global objects are not technically legacy platform
objects, and have other ways to override their setters and getters.

However, Window does need to share some code with the legacy platform
object paths, and simply adding another bool check to the mix seems
the shortest putt.
2024-01-19 09:02:00 +01:00
Timothy Flynn
2b22402c6a LibWeb: Correctly categorize Fetch responses as network errors
The condition here is flipped. From the spec:

     A network error is a response whose ... body is null ...
2024-01-18 23:10:56 +01:00
Aliaksandr Kalenik
b317620486 LibWeb: Resolve relpos fragment offsets only for inline paintables
Prior to this change, we iterated through all fragments within each
PaintableWithLines to resolve the relative position offset. This
happened before transferring the fragments to their corresponding
inline paintables.

With this change, we significantly reduce amount of work by attempting
to resolve relative position offsets only for those contained within
inline paintables.

Performance improvement on https://html.spec.whatwg.org/
2024-01-18 19:41:34 +01:00
implicitfield
de9fa25e11 cksum: Use the POSIX cksum algorithm rather than vanilla CRC32 2024-01-18 18:01:26 +03:30
implicitfield
05ee5ffa36 LibCrypto: Add support for the POSIX cksum algorithm 2024-01-18 18:01:26 +03:30
Tim Ledbetter
459fa8b840 LibPDF: Ensure that xref subsection numbers are u32
Previously, parsing an xref entry with a floating point subsection
number would cause a crash.
2024-01-18 15:11:42 +01:00
Nico Weber
d2f3288666 LibPDF: Apply text matrix to each glyph's position
We still don't apply it to the glyph itself, so they don't show up
scaled or rotated, but they're at the right spot now.

One big thing this here hsa going for it is that the final glyph
position is now calculated with just
`ext_rendering_matrix.map(glyph_position)`.

Also, character_spacing and word_spacing are now used unmodified
in the SimpleFont::draw_string() loop. This also means we no longer
have to undo a scale when updating the position in
`Renderer::show_text()`.

Most of the rest stays pretty yucky though. The root cause of many
problems is that ScaledFont has its rendering sized baked into the
object. We want to render fonts at size font_size times scale from
text matrix times scale from current transformation matrix (but
not size from hotizontal_scaling). So we have to make that the
font_size, but then we have to undo that in a bunch of places to
get the actualy font size.

This will eventually get better when LibPDF moves off ScaledFont.
2024-01-18 14:01:30 +01:00
Nico Weber
09a91e54c0 Tests: Add a pdf with text rotation
As usual, lovingly hand-written, with offsets fixed up with

    mutool clean Tests/LibPDF/rotate.pdf  Tests/LibPDF/rotate.pdf
2024-01-18 14:01:30 +01:00
Nico Weber
f54b0e7c22 LibPDF: Don't accidentally put horizontal_scaling in places
Fonts should have size font_size times total scaling. We tried to
get that by computing text_rendering_matrix.x_scale() * font_size,
but text_rendering_matrix.x_scale() also includes
horizontal_scaling, which shouldn't be part of font size.

Same for character_spacing and word_spacing.

This is all a big mess that's caused by LibPDF using ScaledFont,
which requires scaling to be aprt of the text type. I have an
in-progress local branch that moves LibPDF to directly use VectorFont,
which will hopefully make this (and other things) nicer. But first,
let's get this right, and then make sure we don't regress it when
things change :^)
2024-01-18 14:01:30 +01:00
Nico Weber
abda5e66f6 LibPDF: Scale delta_x by horizontal_scaling in Renderer::show_text()
While PDFFont::draw_string() already returns a position scaled by
horizontal_scaling, the division by text_rendering_matrix.x_scale()
(which also contains the scaling factor) undid it. Reapply it.

Fixes the horizontal layout of the line
"should be the same on all lines: super" in Tests/LibPDF/text.pdf.
2024-01-18 14:01:30 +01:00
Nico Weber
470d1d8dcf LibPDF: Fix order of parameter, text, and current transform matrix
PDF spec 1.7 5.3.3 Text Space Details gives the correct multiplication
order: parameters * textmatrix * ctm.

We used to do text * ctm * parameters
(AffineTransform::multiply() does left-multiplication).

This only matters if `text_state().rise` is non-zero. In practice,
it's almost always zero, in which case the paramter matrix is a
diagonal matrix that commutes.

Fixes the horizontal offset of "super" in Tests/LibPDF/text.pdf.
2024-01-18 14:01:30 +01:00
Nico Weber
6c65c18c40 LibPDF: Add spec ref to Renderer::calculate_text_rendering_matrix() 2024-01-18 14:01:30 +01:00
Nico Weber
8507151850 Tests/LibPDF: Make text.pdf also use Tz, Tc, Tw, Ts operators
These set the horizontal scale factor, character spacing, word
spacing, and text rise respectively.

Also add a global scale transform, and set a text transform matrix
with a scale for some of the text.
2024-01-18 14:01:30 +01:00
Lucas CHOLLET
75d87ccf5f LibGfx/TIFF+CCITT: Start to decode CCITT Group 3 images
We currently only support 1D Group 3, but that's a start.

The test case was generated with GIMP (it happens to be 1D by chance).
2024-01-18 14:00:56 +01:00
Lucas CHOLLET
1cc10a6245 LibGfx/CCITT: Extract the code to decode a single CCITT3 1D line
This will be handy for the pure CCITT Group 3 decoder too :^)
2024-01-18 14:00:56 +01:00
Lucas CHOLLET
6a94b09029 LibGfx/TIFF: Make strip decoders take the strip height
While most decoders do not require it, it is necessary for the CCITT
Group 3 decoder.
2024-01-18 14:00:56 +01:00
Lucas CHOLLET
26494600c4 LibGfx/TIFF: Parse the T4Options CCITT field
This field is described in: Section 11: CCITT Bilevel Encodings.
2024-01-18 14:00:56 +01:00
Lucas CHOLLET
edffdc35a9 LibGfx/TIFF+CCITT: Clarify naming of compression type 2
Type 2 <=> One-dimensional Group3, customized for TIFF
Type 3 <=> Two-dimensional Group3, uses the original 1D internally
Type 4 <=> Two-dimensional Group4

So let's clarify that this is not Group3 1D but the TIFF variant, which
is called `CCITTRLE` in libtiff. So let's stick with this name to avoid
confusion.
2024-01-18 14:00:56 +01:00
Lucas CHOLLET
9b50b5793b LibGfx/TIFF: Factorize code to verify that CCITT images are correct 2024-01-18 14:00:56 +01:00