Commit Graph

61240 Commits

Author SHA1 Message Date
Lucas CHOLLET
54f33b43c6 LibCompress: Add an LZW compressor 2024-05-14 12:33:53 -06:00
Lucas CHOLLET
ff33fa7e8b LibCompress/Lzw: Name a magic variable 2024-05-14 12:33:53 -06:00
Lucas CHOLLET
945e09e46d LibCompress/Lzw: Move shareable code to a base class 2024-05-14 12:33:53 -06:00
Lucas CHOLLET
70a3f1f02b LibCompress: Rename LZWDecoder => LzwDecompressor
This is more idiomatic for LibCompress' decoders.
2024-05-14 12:33:53 -06:00
Lucas CHOLLET
11f53ba9cc LibCompress: Rename LZWDecoder.h => Lzw.h 2024-05-14 12:33:53 -06:00
Andrew Kaster
60b3436ea3 LibWeb: Support loading FontFaces constructed with binary data 2024-05-14 12:31:10 -06:00
Shannon Booth
452ffa56dc LibWeb: Implement BaseAudioContext.createDynamicsCompressor 2024-05-14 13:45:43 -04:00
Shannon Booth
2a56df8ecd LibWeb: Add scaffolding for DynamicsCompressorNode 2024-05-14 13:45:43 -04:00
Nico Weber
e2336e2099 LibGfx+animation: Only store changed pixels in animation frames
For example, for 7z7c.gif, we now store one 500x500 frame and then
a 94x78 frame at (196, 208) and a 91x78 frame at (198, 208).

This reduces how much data we have to store.

We currently store all pixels in the rect with changed pixels.
We could in the future store pixels that are equal in that rect
as transparent pixels. When inputs are gif files, this would
guaranteee that new frames only have at most 256 distinct colors
(since GIFs require that), which would help a future color indexing
transform. For now, we don't do that though.

The API I'm adding here is a bit ugly:

* WebPs can only store x/y offsets that are a multiple of 2. This
  currently leaks into the AnimationWriter base class.
  (Since we potentially have to make a webp frame 1 pixel wider
  and higher due to this, it's possible to have a frame that has
  <= 256 colors in a gif input but > 256 colors in the webp,
  if we do the technique above.)

* Every client writing animations has to have logic to track
  previous frames, decide which of the two functions to call, etc.

This also adds an opt-out flag to `animation`, because:

1. Some clients apparently assume the size of the last VP8L
   chunk is the size of the image
   (see https://github.com/discord/lilliput/issues/159).

2. Having incremental frames is good for filesize and for
   playing the animation start-to-end, but it makes it hard
   to extract arbitrary frames (have to extract all frames
   from start to target frame) -- but this is mean tto be a
   delivery codec, not an editing codec. It's also more vulnerable to
   corrupted bytes in the middle of the file -- but transport
   protocols are good these days.
   (It'd also be an idea to write a full frame every N frames.)

For https://giphy.com/gifs/XT9HMdwmpHqqOu1f1a (an 184K gif),
output webp size goes from 21M to 11M.

For 7z7c.gif (an 11K gif), output webp size goes from 2.1M to 775K.

(The webp image data still isn't compressed at all.)
2024-05-14 13:43:03 -04:00
Nico Weber
6c79efcae4 LibGfx: Move AnimationWriter to its own file
No behavior change.
2024-05-14 13:43:03 -04:00
Nico Weber
58cbecbe0c LibGfx/WebP: Move some code shared by loader and writer to WebPShared.h
Has (no-op) the effect of adding a few missing default-initializers for
the copy in WebPLoader.cpp.

No behavior change.
2024-05-14 13:43:03 -04:00
Nico Weber
a19589649d LibGfx/WebPWriter: Add some checks to write_ANMF_chunk()
The function's implementation makes these assumptions, so check
that they are true instead of silently doing the wrong this when
they're not true.
2024-05-14 13:43:03 -04:00
Nico Weber
cf4bad31f0 LibGfx/WebPWriter: Add debug logging for ANMF chunks 2024-05-14 13:43:03 -04:00
Nico Weber
437fd9ae2b LibGfx/GIFLoader: Add debug logging for image descriptors 2024-05-14 13:43:03 -04:00
Shannon Booth
27242c6be6 LibWeb: Implement Document.dir
This was seen getting called on stuff.co.nz (before it crashes due to an
unrelated navigation bug)
2024-05-14 13:35:36 -04:00
Andreas Kling
ed50eb0aaa LibJS/Bytecode: Add environment coordinate caching to SetVariable
This means that SetVariable instructions will now remember which
(relative) environment contains the targeted binding, letting it bypass
the full binding resolution machinery on subsequent accesses.
2024-05-14 06:39:27 +02:00
Aliaksandr Kalenik
caffd485b8 LibJS: Replace SetLocal instruction usage with Mov
No need for separate instuction to set a local.
2024-05-14 06:39:16 +02:00
Matthew Olsson
46ee2b5f06 ClangPlugins: Add LLVM lit test suite 2024-05-13 16:50:54 -06:00
Matthew Olsson
6587c1f350 Lagom: Remove LibJSGCVerifier 2024-05-13 16:50:54 -06:00
Matthew Olsson
4ae7bbda52 Lagom: Add ClangPlugins to the build system 2024-05-13 16:50:54 -06:00
Matthew Olsson
c3ed1a7995 Lagom: Add ClangPlugins
This is a more general and robust replacement of the LibJSGCVerifier.
We want to add more generic static analysis, and this new plugin will
be built in a way that integrates into the rest of the system.
2024-05-13 16:50:54 -06:00
Tim Ledbetter
a8c60d65fc LibWeb: Specify the correct argument type in IDL for AbortSignal::any()
This allows some boilerplate code to be generated automatically.
2024-05-13 23:45:45 +01:00
Lucas CHOLLET
ff2c6cab55 LibGfx: Correctly round values when computing the luminosity of a Color
Truncating the value is mathematically incorrect, this error made the
conversion to grayscale unstable. In other world, calling `to_grayscale`
on a gray value would return a different value. As an example,
`Color::from_string("#686868ff"sv).to_grayscale()` used to return
#676767ff.
2024-05-13 23:43:58 +02:00
Andrew Kaster
bd4f516e64 LibWeb: Stub out FontFaceSet.status and .ready attributes
WPT wants to check these properties before running ref tests.
This fixes a ton of crashes in our CI WPT runs.
2024-05-13 20:20:39 +00:00
Aliaksandr Kalenik
d79438a2a6 LibJS: Join locals, constants and registers into single vector
Merging registers, constants and locals into single vector means:
- Better data locality
- No need to check type in Interpreter::get() and Interpreter::set()
  which are very hot functions

Performance improvement is visible in almost all Octane and Kraken
tests.
2024-05-13 19:54:11 +02:00
Andreas Kling
59cb7994c6 LibWeb: Use memcpy() in CanvasRenderingContext2D.getImageData()
Instead of copying the image data pixel-by-pixel, we can memcpy full
scanlines at a time.

This knocks a 4% item down to <1% in profiles of Another World JS.
2024-05-13 17:29:37 +02:00
Andreas Kling
6f5201b759 LibJS: Add fast paths in TypedArrayPrototype.fill()
Filling a typed array with an integer shouldn't have to go through the
generic Set for every element.

This knocks a 7% item down to <1% in profiles of Another World JS at
https://cyxx.github.io/another_js/
2024-05-13 17:29:37 +02:00
Andreas Kling
d79353a477 LibJS/Bytecode: Add fast paths for compare-and-jump with 2 numbers
When comparing two numbers, we can avoid a lot of implicit type
conversion nonsense and go straight to comparison, saving time in the
most common case.
2024-05-13 17:29:37 +02:00
Hugh Davenport
9772590e9a MouseSettings: Only allow valid cursor themes
To align the cursor theme tab to how DisplaySettings themes tab works,
this change forces the theme combo box to not allow free-text. Currently
on a click it puts the text cursor in the box to allow typing anything
rather than acting as a dropdown when clicking anywhere on the field.

Fixes #24306
2024-05-13 08:26:16 +01:00
Andreas Kling
855f6417df LibJS/Bytecode: Move environment variable caches into instructions
These were out-of-line because we had some ideas about marking
instruction streams PROT_READ only, but that seems pretty arbitrary and
there's a lot of performance to be gained by putting these inline.
2024-05-13 09:22:14 +02:00
Andreas Kling
a06441c88c LibJS/Bytecode: Defer GetGlobal identifier lookup until cache misses
This way we avoid looking up the identifier when the cache hits.
2024-05-13 09:22:14 +02:00
Andreas Kling
6ec4d6f668 LibJS/Bytecode: Cache the running execution context in interpreter 2024-05-13 09:22:14 +02:00
Andreas Kling
8447f6f6da LibJS: Inline more of cached environment variable access in interpreter
And stop passing VM strictness to direct access, since it doesn't care
about strictness anyway.
2024-05-13 09:22:14 +02:00
Shannon Booth
9b6a1de777 LibWeb: Implement URL.parse
This was an addition to the URL spec, see:

https://github.com/whatwg/url/commit/58acb0
2024-05-13 09:21:12 +02:00
Shannon Booth
67ea56da59 LibWeb: Factor out an 'initialize a URL' AO
This is a small refactor in the URL spec to avoid duplication as part of
the introduction of URL.parse, see:

https://github.com/whatwg/url/commit/58acb0
2024-05-13 09:21:12 +02:00
Abuneri
4ea1e26aee LibLocale: Move includes below #pragma once in generated headers 2024-05-13 09:20:22 +02:00
Kenneth Myhra
0950d6ed97 Ports/dosbox-staging: Enable mt32emu 2024-05-13 00:15:21 +02:00
Kenneth Myhra
36511d23ef Ports: Add libmt32emu 2024-05-13 00:15:21 +02:00
Kenneth Myhra
95bd69cec5 Ports/dosbox-staging: Enable saving screenshots in .png format 2024-05-13 00:15:21 +02:00
Kenneth Myhra
02590ff5b9 Ports/dosbox-staging: Enable fluidsynth 2024-05-13 00:15:21 +02:00
Kenneth Myhra
6cc8c34e4e Ports: Add fluidsynth 2024-05-13 00:15:21 +02:00
Timothy Flynn
4bf0ddad4c Meta: Remove the generated bindings forwarding header from the GN build
This was removed in commit 22705e3065.
2024-05-12 18:10:05 -04:00
Shannon Booth
5a0f7c5f63 LibWeb/Tests: Add a basic test for a blob URL given to a Worker 2024-05-12 15:46:29 -06:00
Shannon Booth
53eb9af42f LibWeb: Use URL's 'blob URL entry' for blob fetches
Performing a lookup in the blob URL registry does not work in the case
of a web worker - as the registry is not shared between processes.
However - the URL itself passed to a worker has the blob attached to it,
which we can pull out of the URL on a fetch.
2024-05-12 15:46:29 -06:00
Shannon Booth
2457fdc7a4 LibWeb: Attach blob to URL on DOMURL::parse
On a non-basic URL parse, we are meant to perform a lookup on the blob
URL registry and attach any blob to that URL if present. Now - we do
that :^)
2024-05-12 15:46:29 -06:00
Shannon Booth
4f30d50dc9 LibIPC: Remove uneeded NumericLimit<u32>::max check for ByteString
This is no longer needed now that ByteString does not have a null state.
2024-05-12 15:46:29 -06:00
Shannon Booth
55cd53e4ed LibIPC: Also encode URL::blob_url_entry over IPC 2024-05-12 15:46:29 -06:00
Shannon Booth
27e1f4762c LibURL: Add BlobURLEntry to URL 2024-05-12 15:46:29 -06:00
Shannon Booth
ec381c122e LibWeb: Implement "Resolve a Blob URL"
Which performs a lookup to find a blob (if any) corresponding to the
given blob URL.
2024-05-12 15:46:29 -06:00
Shannon Booth
c071720430 LibWeb: Handle blob URLs in Document::parse_url
Implement this function to the spec, and use the full blown URL parser
that handles blob URLs, instead of the basic-url-parser.

Also clean up a FIXME that does not seem relevant any more.
2024-05-12 15:46:29 -06:00