Commit graph

49050 commits

Author SHA1 Message Date
Lucas CHOLLET cfaa51203f LibGfx/JPEG: Use a smaller type to store coefficients
No need to store them in `i32`, the JPEG norm specifies that they are
not bigger than 16 bits for extended JPEGs. So, in this patch, we
replace `i32` with `i16`. It almost divides memory usage by two :^)
2023-04-06 12:00:08 +01:00
Luke Wilde a744ae79ff LibWeb: Implement the :defined pseudo class
This selects an element if it is either a built-in element, or an
upgraded custom element.
2023-04-06 11:36:56 +02:00
Luke Wilde 6ebdb9f824 LibWeb: Implement the HTMLConstructor extended attribute 2023-04-06 11:36:56 +02:00
Luke Wilde e3c3cc9e19 LibWeb: Implement the CEReactions extended attribute 2023-04-06 11:36:56 +02:00
Luke Wilde 32e27bc7fa LibWeb: Add a bunch of missing CEReactions
This is almost guaranteed not to be all CEReactions we need to add, but
this puts us in a much better situation.
2023-04-06 11:36:56 +02:00
Luke Wilde 034aaf3f51 LibWeb: Introduce CustomElementRegistry and creating custom elements
The main missing feature here is form associated custom elements.
2023-04-06 11:36:56 +02:00
Luke Wilde 083b547e97 LibWeb/WebIDL: Add the construct abstract operation
This will be used by custom elements to upgrade an element to a custom
element.
2023-04-06 11:36:56 +02:00
Luke Wilde 9b8b363445 LibWeb/WebIDL: Move call_user_object_operation out of line
This makes it in line with `invoke_callback`.
2023-04-06 11:36:56 +02:00
Luke Wilde 686e3a0d94 LibWeb: Support returning a callback function in IDL 2023-04-06 11:36:56 +02:00
Evan Smal 5b906d9a40 HackStudio: Add configuration domain pledge for FileManager
This fixes a bug where clicking the "Save" button would crash the
application because 'FileManager' was a pledged domain.
2023-04-06 08:56:57 +01:00
Julian Offenhäuser 602f5459bf LibGfx: Fix out of bounds read in BitmapFont::masked_character_set()
When creating a copy of the font containing only the glyphs that are in
use, we previously looped over all possible code points, instead of the
range of code points that are actually in use (and allocated) in the
font. This is a problem, since we index into the array of widths to find
out if a given glyph is used. This array is only as long as the number
of glyphs the font was created with, causing an out of bounds read when
that number is less than our maximum.
2023-04-06 08:26:22 +01:00
Cameron Youell 0c98cde18e GMLPlayground: Pledge Calendar domain
This now allows for the preview of `@GUI::Calendar` without
crashing the whole program.
2023-04-06 08:24:25 +01:00
Kenneth Myhra 1080281e58 LibWeb: Port AbstractBrowsingContext to String 2023-04-06 08:41:43 +02:00
Kenneth Myhra 03d6cb88ff LibWeb: Port KeyboardEvent to new String 2023-04-06 08:41:43 +02:00
Kenneth Myhra e14be3927a LibWeb: Port FocusEvent to new String 2023-04-06 08:41:43 +02:00
stelar7 d527edf0ab LibTLS: Change Certificate parsing to use ErrorOr
Loads of changes that are tightly connected... :/
* Change lambdas to static functions
* Add spec docs to those functions
* Keep the current scope around as a parameter
* Add wrapping classes for some Certificate members
* Parse ec and ecdsa data from certificates
2023-04-06 09:57:31 +03:30
stelar7 b1d80b35af LibCrypto: Add ability to rewrite current tag kind
This is used for IMPLICIT tags where the expected kind is overriden
by the encoding instructions.
2023-04-06 09:57:31 +03:30
stelar7 8273fc230c LibCrypto: Add missing ASN1 tag kinds 2023-04-06 09:57:31 +03:30
stelar7 6163f607c0 AK: Add to_string() for IPv4Address 2023-04-06 09:57:31 +03:30
Nico Weber 73c291f5ae LibGfx: Pass in format and size to webp image decoding function 2023-04-06 00:16:52 +01:00
Nico Weber 48f88b3cdd LibGfx: Teach webp image reading function to read entropy coded images 2023-04-06 00:16:52 +01:00
Nico Weber 4bd7090bc5 LibGfx: Move webp image decoding function up a bit
Pure code move, no changes (except that this allows removing the
explicit prototype for this function, so it removes that).
2023-04-06 00:16:52 +01:00
Nico Weber f21af311c2 LibGfx: Move webp bitmap decoding code into its own function 2023-04-06 00:16:52 +01:00
Nico Weber e5e9d3b877 LibGfx: Implement hopefully correct max_symbol handling in webp decoder
The spec is at best misleading here, suggesting that max_symbol should
be set to "num_code_lengths" if it's not explicitly stored.

But num_code_lengths doesn't mean the num_code_lengths mentioned a few
lines further up in the spec, but alphabet_size!

(I had to cheat and look at libwebp instead of the spec for this: See
vp8l_dec.c, ReadHuffmanCode() which passes alphabet_size to
ReadHuffmanCodeLengths() as num_symbols, and ReadHuffmanCodeLengths()
then sets max_symbol to that.)

I haven't yet found a file that uses max_symbol, so this isn't actually
tested. But it's close to what's in libwebp, so maybe it works!
2023-04-06 00:16:52 +01:00
Nico Weber e8f5e699fe LibGfx: Read transform type in webp lossless decoder
Doesn't do anything with it yet, so this only makes the
"not yet implemented" message a bit more detailed.
2023-04-06 00:16:52 +01:00
Nico Weber 8e6911c8f6 LibGfx: Remove some noisy dbgln_if()s in webp decoder
Pixel decoding mostly works, so there's no need to log all this data.
2023-04-06 00:16:52 +01:00
matcool cc33a57620 LibWeb: Use intrinsic aspect ratio when calculating max content height 2023-04-05 16:23:56 +02:00
Tim Schumacher 9b4b12f133 tar: Use BufferedFile for reading inputs 2023-04-05 07:30:38 -04:00
Tim Schumacher 081cd9f9af lzcat: Use BufferedFile for reading inputs 2023-04-05 07:30:38 -04:00
Tim Schumacher 3ec513ecf2 xzcat: Use BufferedFile for reading inputs
This improves the decompression time of `clang-15.0.7.src.tar.xz` from
41 seconds down to about 5 seconds.

The reason for this very significant improvement is that LZMA, the
underlying compression of XZ, fills its range decompressor one byte at a
time, causing a lot of overhead at the syscall barrier.
2023-04-05 07:30:38 -04:00
Tim Schumacher 7000ccf89f LibCompress: Copy LZMA repetitions from the buffer in sequence
This improves the decompression time of `clang-15.0.7.src.tar.xz` from
5.2 seconds down to about 2.7 seconds.
2023-04-05 07:30:38 -04:00
Tim Schumacher b88c58b94c AK+LibCompress: Break when seekback copying to a full CircularBuffer
Otherwise, we just end up infinitely looping while waiting for more
space in the destination.
2023-04-05 07:30:38 -04:00
Tim Schumacher 767fb01a8c AK: Report copied bytes when seekback copying from CircularBuffer
Otherwise, we have no way of determining whether our copy was truncated
by accident.
2023-04-05 07:30:38 -04:00
Tim Schumacher 997e745e87 AK: Properly limit the internal seekback span for CircularBuffer
I was originally thinking in the wrong direction when adding this limit,
we can at most read from the buffer until we reach the current write
head. Since that write head is the reference point for the distance,
we need to limit ourselves to that instead of the seekback limit (which
is the maximum of how far back the distance can be).
2023-04-05 07:30:38 -04:00
Nico Weber 09dd9c4fad Tests: Add test for webp lossless decoding 2023-04-05 13:24:00 +02:00
Nico Weber c84968dafd LibGfx: Add some support for decoding lossless webp files
Missing:
* Transform support (used by virtually all lossless webp files)
* Meta prefix / entropy image support

Working:
* Decoding of regular image streams
* Color cache

This happens to be enough to be able to decode
Tests/LibGfx/test-inputs/extended-lossless.webp

The canonical prefix code is very similar to deflate's, enough so that
this can use Compress::CanonicalCode (and take advantage of all the
recent performance improvements there).
2023-04-05 13:24:00 +02:00
Nico Weber c24e4acd19 LibGfx: Add Bitmap::begin() / Bitmap::end()
Useful for accessing a bitmap like a linear container.
2023-04-05 13:24:00 +02:00
Nico Weber 830fd0d5b2 LibGfx: Read webp lossless header using LittleEndianInputBitStream
No behavior change. Covered by existing webp decoder tests :^)
2023-04-05 13:24:00 +02:00
Pankaj Raghav a65b0cbe4a Kernel/NVMeQueue: Use waitqueue in submit_sync_sqe
The current way we handle sync commands is very ugly and depends on lot
of preconditions. Now that we have an end_io handler for a request, we
can use WaitQueue to do sync commands more elegantly.

This does depend on block layer sending one request at a time but this
change is a step forward towards better IO handling.
2023-04-05 12:45:27 +02:00
Pankaj Raghav 0096eadf40 Kernel/NVMe: Redesign the tracking of requests in an NVMe Queue
There was a private variable named m_current_request which was used to
track a single request at a time. This guarantee is given by the block
layer where we wait on each IO. This design will break down in the
driver once the block layer removes that constraint.

Redesign the IO handling in a completely asynchronous way by maintaining
requests up to queue depth. NVMeIO struct is introduced to track an IO
submitted along with other information such whether the IO is still
being processed and an endio callback which will be called during the
end of a request.

A hashmap private variable is created which will key based on the
command id of a request with a value of NVMeIO. endio handler will come
in handy if we are doing a sync request and we want to wake up the wait
queue during the end.

This change also simplified the code by removing some special condition
in submit_sqe function, etc that were marked as FIXME for a long time.
2023-04-05 12:45:27 +02:00
Pankaj Raghav 3fe7bda021 Kernel/NVMe: Use an Atomic for command id instead of sq index
Using sq_tail as cid makes an inherent assumption that we send only
one IO at a time. Use an atomic variable instead for command id of a
submission queue entry.

As sq_tail is not used as cid anymore, remove m_prev_sq_tail which used
to hold the last used sq_tail value.
2023-04-05 12:45:27 +02:00
Andreas Kling e219662ce0 Kernel: Mark sys$setpgid as not needing the big lock
This function is already serialized by access to process protected data.
2023-04-05 11:37:27 +02:00
Andreas Kling 84ac957d7a Kernel: Make Credentials the authority on process SID
The SID was duplicated between the process credentials and protected
data. And to make matters worse, the credentials SID was not updated in
sys$setsid.

This patch fixes this by removing the SID from protected data and
updating the credentials SID everywhere.
2023-04-05 11:37:27 +02:00
Andreas Kling f764b8b113 Kernel: Mark sys$setsid as not needing the big lock
This function is now serialized by access to the process group list,
and to the current process's protected data.
2023-04-05 11:37:27 +02:00
Andreas Kling 3e30d9bc99 Kernel: Make ProcessGroup a ListedRefCounted and fix two races
This closes two race windows:

- ProcessGroup removed itself from the "all process groups" list in its
  destructor. It was possible to walk the list between the last unref()
  and the destructor invocation, and grab a pointer to a ProcessGroup
  that was about to get deleted.

- sys$setsid() could end up creating a process group that already
  existed, as there was a race window between checking if the PGID
  is used, and actually creating a ProcessGroup with that PGID.
2023-04-05 11:37:27 +02:00
Andreas Kling 37bfc36601 Kernel: Make SlavePTY store pointer to MasterPTY as NonnullRefPtr
No need for LockRefPtr here, as the pointer never changes after
initialization.
2023-04-05 11:37:27 +02:00
Andreas Kling e69b2572a6 Kernel: Move Process's TTY pointer into protected data 2023-04-05 11:37:27 +02:00
Andreas Kling 1e2ef59965 Kernel: Move Process's process group pointer into protected data
Now that it's no longer using LockRefPtr, we can actually move it into
protected data. (LockRefPtr couldn't be stored there because protected
data is immutable at times, and LockRefPtr uses some of its own bits
for locking.)
2023-04-05 11:37:27 +02:00
Andreas Kling 1c77803845 Kernel: Stop using *LockRefPtr for TTY
TTY was only stored in Process::m_tty, so make that a SpinlockProtected.
2023-04-05 11:37:27 +02:00
Andreas Kling 350e5f9261 Kernel: Remove ancient InterruptDisabler in sys$setsid
This was some pre-SMP historical artifact.
2023-04-05 11:37:27 +02:00