Commit graph

26516 commits

Author SHA1 Message Date
kleines Filmröllchen 8bc56c7fb0 LibAudio: Prevent FLAC Rice partitions getting smaller than 1 sample
This would cause an integer underflow leading to us trying to allocate
over 4GB for residual samples.
2023-07-04 12:47:08 +02:00
kleines Filmröllchen 952c633a65 LibAudio: Fix 32-bit/64-bit mixup in FLAC sign extend
The bit magic for two's complement sign extension was only sign
extending to 32-bit signed. This issue was exposed by the last commit,
where now we actually use the 64-bit return value.
2023-07-04 12:47:08 +02:00
kleines Filmröllchen 59c7ce3d54 LibAudio: Prevent integer overflows in intermediate FLAC calculations
Since we can have up to 32 bits of input data, multiplications may need
up to 63 bits. This was accounted for in some places, but by far not in
all, and oss-fuzz found multiple integer overflows. We now use i64 in
all of the decoding, since we need to rescale samples to float later on
anyways. If a final sample value ends up out of range (and the range can
be a maximum of 32 bits), we may get samples past 1, but that then is a
non-compliant input file, and using over-range samples (and most likely
clipping audio) is considerably less weird than overflowing and
glitching audio.
2023-07-04 12:47:08 +02:00
kleines Filmröllchen 9bece0d0da LibAudio: Prevent multiple kinds of buffer overruns in FLAC picture load
The fuzzer found one heap buffer overflow here due to confusion between
u32* and u8* (the given size is for bytes, but we used it for 32-bit
elements, quadrupling it), and it looks like there's an opportunity for
several more. This commit modernizes the picture loader by using
String's built-in stream loader, and also adds several spec-compliance
checks: The MIME type must be ASCII in a specific range, and the picture
description must be UTF-8.
2023-07-04 12:47:08 +02:00
kleines Filmröllchen ab9c18c176 LibAudio: Don't try to resample FLAC frames with sample rate 0
Although this sample rate is more or less bogus, we might as well not
crash.
2023-07-04 12:47:08 +02:00
kleines Filmröllchen 2e9e0dfe61 LibAudio: Check that LPC order is smaller than subframe sample count
An LPC predictor (fixed or not) contains as many warm-up samples as its
order. Therefore, the corresponding subframe must have at least this
many samples.

This turns this fuzzer-found crash into a handleable format error.
2023-07-04 12:47:08 +02:00
MacDue ff402b1b42 file: Add a description for the image/tinyvg mime type 2023-07-04 12:04:32 +02:00
Andreas Kling fb727332f9 LibWeb: Decode linked style sheets before parsing them
This fixes an issue where a BOM at the head of a style sheet would be
passed verbatim to the parser, who would then interpret it as an ident
token and (after some confusion) fail to parse the first rule, but then
carry on with the rest of the sheet.
2023-07-04 10:45:20 +02:00
Nico Weber efad31dac1 Utilities: Add a pdf utility
This utility will learn tricks such as extracting images from PDFs and
dumping tables from PDFs so that we can create code from specs.

It also allows testing LibPDF things in lagom, and allows testing
reading large amounts of PDFs using a shell script.
2023-07-04 06:50:15 +02:00
Andreas Kling e7e454f1d6 LibWeb: Resolve used insets for grid items 2023-07-04 06:43:53 +02:00
Andreas Kling 03ec17fd37 LibWeb: Resolve used insets for flex items 2023-07-04 06:43:53 +02:00
Andreas Kling c83ae729d2 LibWeb: Resolve used insets for floating elements
This makes the game carousel work on https://null.com/ :^)
2023-07-04 06:43:53 +02:00
Carwyn Nelson a2591bc5fa LibCore: Make ArgParser::Arg::accept_value return ErrorOr<bool>
Much like the previous commit, this commit makes the
ArgParser::Arg::accept_value callback return an ErrorOr<bool> instead of
just a bool.

The aim of this is to make argument parsing more robust, especially
with the newer String api that returns an ErrorOr for many functions.
2023-07-04 04:26:58 +03:30
Carwyn Nelson abbfb00a02 LibCore: Make ArgParser::Option::accept_value return ErrorOr<bool>
This commit makes the `ArgParser::Option::accept_value` property more
error-safe by ensuring it returns an ErrorOr<bool> instead of just a
bool.
2023-07-04 04:26:58 +03:30
Jelle Raaijmakers 5c64686666 Kernel+AudioServer: Use interrupts for Intel HDA audio buffer completion
We used to not care about stopping an audio output stream for Intel HDA
since AudioServer would continuously send new buffers to play. Since
707f5ac150ef858760eb9faa52b9ba80c50c4262 however, that has changed.

Intel HDA now uses interrupts to detect when each buffer was completed
by the device, and uses a simple heuristic to detect whether a buffer
underrun has occurred so it can stop the output stream.

This was tested on Qemu's Intel HDA (Linux x86_64) and a bare metal MSI
Starship/Matisse HD Audio Controller.
2023-07-04 00:05:34 +02:00
Lucas CHOLLET 2e474e8c18 image: Add an option to tweak the quality of output JPEG 2023-07-04 00:01:06 +02:00
Lucas CHOLLET f3d15f53c9 LibCore: Add the template instantiation ArgsParser::add_option<u8>() 2023-07-04 00:01:06 +02:00
Lucas CHOLLET 1c1ba6a2bd LibCore: Be explicit about integers size
This concerns all template instantiations of `ArgsParser::add_option()`
for integers.
2023-07-04 00:01:06 +02:00
Lucas CHOLLET a58c7fe322 LibGfx/JPEG: Take the quality as an argument instead of hardcoding it 2023-07-04 00:01:06 +02:00
Lucas CHOLLET 05c8ad4e91 LibGfx/JPEG: Write quantization tables in the zigzag ordering
This is clearly something I missed during the first implementation. The
specification is crystal clear about it: "The quantization elements
shall be specified in zig-zag scan order."

This patch fixes the weird behavior we had when using the quantization
table.
2023-07-04 00:01:06 +02:00
MacDue bb5db0835d LibGfx: Allow loading a Bitmap (from bytes) with an ideal size 2023-07-03 23:54:51 +02:00
MacDue ee09ecaf42 Userland: Register MIME type/extension for .tvg
These both come from the specification.
2023-07-03 23:54:51 +02:00
MacDue ae18186905 LibGfx: Implement image decoder for TinyVG (.tvg)
This adds a decoder for the TinyVG vector format (https://tinyvg.tech/).
TinyVG is a very simple binary vector format, but it is good enough to
represent a lot of SVGs, without needing the full web engine.

The main use case for Serenity is for scalable icons (which .tvg easily
handles).
2023-07-03 23:54:51 +02:00
MacDue e7cddda7e1 LibGfx: Allow passing an ideal size to image decoders
The ideal size is the size the user will display the image. Raster
formats should ignore this parameter, but vector formats can use
it to generate a bitmap of the ideal size.
2023-07-03 23:54:51 +02:00
Lucas CHOLLET ff47223301 LibCore: Make NetworkJob::start() take a Stream::BufferedSocketBase&
It used to take a plain `Socket` and cast it to a `BufferedSocketBase`,
which can lead to unpleasant result when used with a non-buffered
`Socket`.
2023-07-03 23:29:28 +02:00
Lucas CHOLLET 5fc873f53b LibCore: Don't implement pure virtual methods in NetworkJob 2023-07-03 23:29:28 +02:00
Lucas CHOLLET 9581fe1d7d LibTLS: Remove unused methods
Affected methods are:
 - can_read_line
 - can_read
 - read_line
2023-07-03 23:29:28 +02:00
Lucas CHOLLET b46667639f LibHTTP: Make HttpRequest return its method name as a StringView 2023-07-03 23:29:28 +02:00
Timothy Flynn 163ddf1d73 LibWeb: Display the media volume in a tooltip while it is changing 2023-07-03 19:07:26 +02:00
Timothy Flynn 720d8889ad LibWeb: Allow changing media volume with keyboard controls
This allows increasing and decreasing the media volume by 10% with the
up and down arrow keys, respectively. This also allows toggling the mute
state with the M key.
2023-07-03 19:07:26 +02:00
Timothy Flynn 6a5229c2cb LibWeb: Allow seeking media elements with keyboard controls
This allows seeking backwards and forwards by 5 seconds with the left
and right arrow keys, respectively. This also allows seeking to the
beginning and end of the media track with the home and end keys.
2023-07-03 19:07:26 +02:00
Timothy Flynn a4070b1452 LibWeb: Allow toggling playback of media elements with keyboard controls
This allows pausing/playing media elements with the space bar.
2023-07-03 19:07:26 +02:00
Timothy Flynn 2c5c815f44 LibWeb: Toggle media playback when clicking anywhere on the control box
Feels nicer to click anywhere on the control box to toggle playback,
rather than needing to accurately click the playback button. Note this
does not affect other behavior-specific buttons; i.e. if the mute button
is pressed, we won't reach the playback toggle..
2023-07-03 19:07:26 +02:00
Timothy Flynn c2357a059e LibWeb: Mark media elements as focusable
This allows focusing media elements for keyboard control.
2023-07-03 19:07:26 +02:00
Timothy Flynn 3793b7c6bd LibWeb: Move helper to toggle a media element's playback to the element
This will be needed elsewhere.
2023-07-03 19:07:26 +02:00
Timothy Flynn 435ced70b8 LibWeb: Update the media element's display in a couple situations
Mostly seen on macOS, but when we toggle playing a media element, we
need to update its layout node's display to ensure the change is
reflected on the playback button. Further, when setting the element's
display time, we need to update the display to ensure the change is
refelected on the media timeline.
2023-07-03 19:07:26 +02:00
Timothy Flynn 27ca90646d WebContent: Clear Serenity's audio buffers when seeking
Without this, the already-buffered audio may continue playing after a
seek. The SoundPlayer application does the same operation here.
2023-07-03 19:07:26 +02:00
Andreas Kling 21260ea2ef LibWeb: Merge did_remove_attribute() into attribute_changed()
Instead of having two virtuals for attribute change notifications,
there is now only one. When the attribute is removed, the value is null.
2023-07-03 19:04:45 +02:00
Andreas Kling 5a74486b59 LibWeb: Rename DOM::Element::parse_attribute() => attribute_changed()
This is a first step towards merging attribute change and removal
notifications into a single function.
2023-07-03 19:04:45 +02:00
Ali Mohammad Pur e1e04884b9 LibLine: Handle any errors propagated through refresh_display()
This can only realistically happen when the terminal no longer exists,
so quitting with an error here is the better solution as the application
will soon be killed anyway.
Fixes #19742.
Fixes #19017.
2023-07-03 19:07:33 +03:30
Hendiadyoin1 b26dad3d62 LibJS: Handle Calls argument range during EliminateLoads pass
Otherwise we could forget to emit stores those registers, thinking that
they are only directly accessed.
2023-07-03 16:55:13 +02:00
Lucas CHOLLET f52e3e540f LibGfx/JPEG: Add a fast path for sequential JPEGs
Decoding progressive JPEGs involves a much more complicated logic than
sequential JPEGs. Thanks to template specialization, this patch allow us
to skip the additional cost of progressive images when it's not needed.

It gives a nice 10% improvements on sequential JPEGs :^)
2023-07-03 14:26:15 +02:00
Andreas Kling 510dfbb7e6 LibWeb: Update anonymous wrappers when applying style changes
Anonymous wrapper boxes inherit style from their layout tree parent,
and since style data is per-layout-node, we have to manually sync them
from parent to anonymous children when something changes.

This is not very elegant or efficient, so I've left a FIXME about
solving it in a nicer way.

This fixes horizontal dog alignment on https://waffles.dog/ :^)
2023-07-03 13:37:14 +02:00
Andreas Kling b918ce4022 LibWeb: Make Layout::TextNode::text_for_rendering() lazily computed
As it turns out, Layout::TreeBuilder never managed to wrap text within
table boxes in anonymous wrapper boxes, since it relied on checking
text_for_rendering(), and that was never initialized during that early
stage of tree building.

This patch fixes the issue by making text_for_rendering() compute the
(potentially collapsed) text lazily when called.

Note that the test included with this patch is still totally wrong,
but that is now a TFC problem rather than a TreeBuilder problem. :^)
2023-07-03 11:50:58 +02:00
Andreas Kling 5cdb394400 LibWeb: Make HTML parser flush all pending tokens in "in table text"
There were multiple bugs in the parsing algorithm for handling text
occurring inside a `table` element:

- When there was pending non-whitespace text inside a table, we only
  flushed one token instead of all pending tokens.

- Also, we didn't even flush one of the right tokens, but instead the
  token that caused the flush to happen.

- Once we started flushing the right tokens, it turned out we had not
  yet implemented character insertion points expressed as "before X".

- Finally, we were not exiting the "in table text" mode after flushing
  pending tokens, effectively getting us stuck in that mode until EOF.
2023-07-03 11:50:58 +02:00
Andreas Kling 8c3e5137f7 LibWeb: Add spec comments to HTML parser "in table text" insertion mode 2023-07-03 11:50:58 +02:00
Andreas Kling 87f0c1c353 LibWeb: Add spec comments to HTML parser "in table" insertion mode
Also remove some overly anxious FIXMEs about slight variance in spec
language. :^)
2023-07-03 11:50:58 +02:00
Andreas Kling bac500b9ad LibWeb: Add spec comments to HTML parser "in row" insertion mode 2023-07-03 11:50:58 +02:00
Shannon Booth 8c8b24d877 diff: Add support for writing diffs in context format 2023-07-03 10:41:30 +02:00
Shannon Booth 44f141dd24 LibDiff: Add Diff::write_context_header
This is used to write a context patch header.
2023-07-03 10:41:30 +02:00
Shannon Booth f02cf2704c LibDiff: Add support for writing formatted context hunks
There is a little bit more complexity involved here than the other
formats. In particular, this is due to the need to determine whether
an addition line or removal line is just that, or a 'change'.
2023-07-03 10:41:30 +02:00
Carwyn Nelson e7da956090 man: Change all uses of DeprecatedString to String 2023-07-03 02:05:32 +02:00
Carwyn Nelson e44abaa777 LibMarkdown: Convert render_to_terminal to String
This commit converts render_to_terminal from DeprecatedString to return
an ErrorOr<String>. This is to aid moving `man` away from
DeprecatedString.

I have opted not to convert render_to_html and render_to_inline_html for
now to keep this commit as small as possible.
2023-07-03 02:05:32 +02:00
Carwyn Nelson e247da507f LibCore: Add new String variants to ArgsParser
This commit adds the ability to use the String class with `add_option`
and `add_positional_argument`.

This should help with the transition away from DeprecatedString.
2023-07-03 02:05:32 +02:00
Daniel Bertalan d165590809 LibJS/Bytecode: Do not coerce the receiver to Object for internal_set
This makes the behavior of `Symbol` correct in strict mode, wherein if
the receiver is a symbol primitive, assigning new properties should
throw a TypeError.
2023-07-02 22:08:48 +01:00
Daniel Bertalan 0cd85ab0fc AK+LibJS: Make Number.MIN_VALUE a denormal
ECMA-262 implies that `MIN_VALUE` should be a denormalized value if
denormal arithmetic is supported. This is the case on x86-64 and AArch64
using standard GCC/Clang compilation settings.

test262 checks whether `Number.MIN_VALUE / 2.0` is equal to 0, which
only holds if `MIN_VALUE` is the smallest denormalized value.

This commit renames the existing `NumericLimits<FloatingPoint>::min()`
to `min_normal()` and adds a `min_denormal()` method to force users to
explicitly think about which one is appropriate for their use case. We
shouldn't follow the STL's confusingly designed interface in this
regard.
2023-07-02 21:19:09 +01:00
Cameron Youell 978fe3c6d5 Shell: Add option Produce symbolic output to umask
Its a standard posix option thats always nice to have :^)
2023-07-02 11:19:10 -06:00
Cameron Youell d9ff37e1b1 Utilities: Make mktemp follow the spec directory path resolution
Previously an input like this:

mktemp -d /tmp/dirtest_-XXXXX

Would result in an error when it should have created a temp directory
2023-07-02 11:19:10 -06:00
Cameron Youell 9630fe3ebc Utilities: Remove unused variable in mktemp 2023-07-02 11:19:10 -06:00
Shannon Booth ff23426b6e headless-browser: Write failed diffs in unified format with context 2023-07-02 11:18:11 -06:00
Shannon Booth 2c9db2de05 diff: Add support for writing diffs in unified format with context 2023-07-02 11:18:11 -06:00
Shannon Booth 55a3dfec10 LibDiff: Add support for generating diffs with surrounding context
While not used in normal diffs due to limitations in the format, this
may be used in context and unified format diffs.
2023-07-02 11:18:11 -06:00
Shannon Booth f528aedc85 LibDiff: Add Diff::write_unified_header
This is used to write a unified patch header.
2023-07-02 11:18:11 -06:00
Shannon Booth a4e50deeea LibDiff: Add Diff::write_unified for formatting unified hunks 2023-07-02 11:18:11 -06:00
Shannon Booth f690807c5a LibDiff: Change underlying representation of Hunk to allow context
The existing hunk data structure does not contain any way to easily
store information about context surrounding the additions and removals
in a hunk. While this does work fine for normal diffs (where there is
never any surrounding context) this data structure is quite limiting for
other use cases.

Without support for surrounding context it is not possible to:
 * Add support for unified or context format to the diff utility to
   output surrounding context.
 * Be able to implement a patch utility that uses the surrounding
   context to reliably locate where to apply a patch when a hunk range
   does not apply perfectly.

This patch changes Diff::Hunk such that its data structure more closely
resembles a unified diff. Each line in a hunk is now either a change,
removal, addition or context.

Allowing hunks to have context inside of them exposes that HackStudio
heavily relies on there being no context in the hunks that it uses for
its' git gutter implementation. The fix here is simple - ask git to
produce us a diff that has no context in it!
2023-07-02 11:18:11 -06:00
Sebastian Zaha 553694679e LibWeb: Fix alternating-sides float positioning
The "y" check for when to reset float side positioning was comparing an
offset that included the border, while the offset of the other side does
not.
2023-07-02 18:43:20 +02:00
Andreas Kling c37b204ce1 LibJS/Bytecode: Add Call opcode for fixed-argument-count calls
This avoids the overhead of allocating a new Array on every function
call, saving a substantial amount of time and avoiding GC thrash.

This patch only makes use of Op::Call in CallExpression. There are other
places we should codegen this op. We should also do the same for super
expression calls.

~5% speed-up on Kraken/stanford-crypto-ccm.js
2023-07-02 18:30:02 +02:00
Andreas Kling 7eb87dec9f LibJS/Bytecode: Rename Call and SuperCall to &WithArgumentArray
Forcing every function call to allocate a new Array just to accommodate
spread parameters is not very nice, so let's start moving towards making
this a special case rather than the general (and only) case.
2023-07-02 18:30:02 +02:00
Andreas Kling dc884aa0d3 LibJS/Bytecode: Remove unnecessary variable environment stack
The var environments will unwind as needed with the ExecutionContext
and there's no need to include it in the unwind info.

We still need to do this for lexical environments though, since they
can have short local lifetimes inside a function.
2023-07-02 18:30:02 +02:00
Niklas Lahnstein e2b0cacb89 3DFileViewer: Properly handle ENOENT errors 2023-07-02 17:35:35 +02:00
Niklas Lahnstein 8534506ab0 3DFileViewer: Use ArgsParser 2023-07-02 17:35:35 +02:00
stelar7 0fc73679f1 LibTLS: Fix typo in ecdsa_sha512 OID 2023-07-02 16:13:37 +02:00
stelar7 77080fbade LibTLS: Rename parse_version to parse_certificate_version
This is not a generic version, but specifically for certificates.
2023-07-02 16:13:37 +02:00
Torstennator 0c95564533 PixelPaint: FilterGallery fix preview
This patch fixes an issue where the preview for an filter was always
based on the content bitmap even if the edit mode was set to Mask.
Now the preview is using the content or mask bitmap based on the
current edit mode and therefore generates the correct preview of
what is going to be changed.
2023-07-02 15:23:42 +02:00
Torstennator d9d9103cbb PixelPaint: Start using Editing-Masks for some tools
This patch starts to integrate the usage of Editing-Masks for the
following tools: Spray-Tool, Brush-Tool and Erase-Tool
2023-07-02 15:23:42 +02:00
Torstennator 0a120e239a PixelPaint: Remove todo from LevelDialog
This patch removes a todo where the revert for any changes could be
optimized. Previously every single pixel was copied back from the
reference bitmap to the content bitmap. Now the editors content
bitmap is just replaced with the reference bitmap that is a copy
of the unchanged content bitmap.
2023-07-02 15:23:42 +02:00
Torstennator 1f31e72843 PixelPaint: LevelDialog enhancements
This patch adds the ability to apply slider changes only to regions
where a editing-mask was drawn.
2023-07-02 15:23:42 +02:00
Torstennator e3509efc1b PixelPaint: Introduce new mask features
This patch adds a new Editing-Mask type to layers. This kind of mask
is used to restrict changes on the content bitmap only to areas where
the mask is drawn. The intensity of a pixel change is controlled by the
alpha-value of the mask.

Furthermore a function to invert and clear masks has been introduced.
When a new mask is created for a layer the edit mode of the layer is
also changed to Mask so that the user can immediately start to draw the
mask.
2023-07-02 15:23:42 +02:00
Ali Mohammad Pur 7e5f1fa895 LibLine: Defer handling SIGWINCH and SIGINT
Performing these immediately can introduce a race condition between the
user's signal-related logic and LibLine's own, so defer the handlers to
make sure they run when our terminal IO cannot interfere with the
user's.
2023-07-02 16:27:52 +03:30
Andreas Kling fb979dcf34 LibJS/Bytecode: Make Bytecode::Interpreter participate in GC marking
Since the relationship between VM and Bytecode::Interpreter is now
clear, we can have VM ask the Interpreter for roots in the GC marking
pass. This avoids having to register and unregister handles and
MarkedVectors over and over.

Since GeneratorObject can also own a RegisterWindow, we share the code
in a RegisterWindow::visit_edges() helper.

~4% speed-up on Kraken/stanford-crypto-ccm.js :^)
2023-07-02 14:50:02 +02:00
Andreas Kling cea2071349 LibJS/Bytecode: Infer name of anonymous exported classes when possible
5 new passes on test262. :^)
2023-07-02 12:18:25 +02:00
Andreas Kling b0ae1e80fb LibJS/Bytecode: Support using MemberExpression as rest property
Also, don't assert while dumping an AST with this construct.

7 new passes on test262. :^)
2023-07-02 11:53:10 +02:00
Daniel Bertalan 0df7255fe7 LibJS/Bytecode: Do not clobber completion value with VariableDeclaration
While the completion value of a variable declaration is specified to be
empty, we might already have a completion value in the accumulator from
a previous statement. Preserve it so as to avoid clobbering it.

This fixes 6 tests on test262.
2023-07-02 10:54:35 +02:00
Andreas Kling bd2c3ace68 LibJS/Bytecode: Make sure empty with statement results in undefined
2 new passes on test262. :^)
2023-07-02 10:54:28 +02:00
kleines Filmröllchen 8ba4036bba Base: Add accept(2) man page
This man page was referenced from some places. This is mostly a
condensed version of the POSIX behavior that the system call
implementation already has, only documenting the obviously visible
errors (in source code) we do actually report.
2023-07-02 02:29:09 +02:00
kleines Filmröllchen 6cddee98a9 LibAudio: Don't overread MP3 granule samples if big_values is too large
There are at most 576 granule samples/frequency lines, but the side data
can specify that the big_values granule type take up to 1024 samples.
The spec says in 2.4.3.4.6 that we should always stop reading Huffman
data once we have 576 samples, so that is what this change does. I also
add some useful spec comments while I'm here.
2023-07-02 02:15:32 +02:00
kleines Filmröllchen 53785a9206 LibAudio: Handle bitstream errors in MP3 Huffman decode 2023-07-02 02:15:32 +02:00
MacDue 40fa07a6e1 LibWeb: Force paintable to exist for SVG <g> elements
This (along with the previous commit) fixes the missing tears on the
sad Duolingo owl.
2023-07-02 01:31:18 +02:00
MacDue 7d26383426 LibWeb: Remove SVGContext
The SVGContext is a leftover from when SVG properties were more ad-hoc.
All properties are now (for better or worse) treated as CSS properties
(or handled elsewhere). This makes the SVGContext's fill/stroke
inheritance handling unnecessary.
2023-07-02 01:31:18 +02:00
Liav A 23a7ccf607 Kernel+LibCore+LibC: Split the mount syscall into multiple syscalls
This is a preparation before we can create a usable mechanism to use
filesystem-specific mount flags.
To keep some compatibility with userland code, LibC and LibCore mount
functions are kept being usable, but now instead of doing an "atomic"
syscall, they do multiple syscalls to perform the complete procedure of
mounting a filesystem.

The FileBackedFileSystem IntrusiveList in the VFS code is now changed to
be protected by a Mutex, because when we mount a new filesystem, we need
to check if a filesystem is already created for a given source_fd so we
do a scan for that OpenFileDescription in that list. If we fail to find
an already-created filesystem we create a new one and register it in the
list if we successfully mounted it. We use a Mutex because we might need
to initiate disk access during the filesystem creation, which will take
other mutexes in other parts of the kernel, therefore making it not
possible to take a spinlock while doing this.
2023-07-02 01:04:51 +02:00
kleines Filmröllchen b4fbd30b70 AudioServer+Userland: Decouple client sample rates from device rate
This change was a long time in the making ever since we obtained sample
rate awareness in the system. Now, each client has its own sample rate,
accessible via new IPC APIs, and the device sample rate is only
accessible via the management interface. AudioServer takes care of
resampling client streams into the device sample rate. Therefore, the
main improvement introduced with this commit is full responsiveness to
sample rate changes; all open audio programs will continue to play at
correct speed with the audio resampled to the new device rate.

The immediate benefits are manifold:
- Gets rid of the legacy hardware sample rate IPC message in the
  non-managing client
- Removes duplicate resampling and sample index rescaling code
  everywhere
- Avoids potential sample index scaling bugs in SoundPlayer (which have
  happened many times before) and fixes a sample index scaling bug in
  aplay
- Removes several FIXMEs
- Reduces amount of sample copying in all applications (especially
  Piano, where this is critical), improving performance
- Reduces number of resampling users, making future API changes (which
  will need to happen for correct resampling to be implemented) easier

I also threw in a simple race condition fix for Piano's audio player
loop.
2023-07-01 23:27:24 +01:00
Sebastian Zaha d52a2ff10e LibGfx: Fix error & crash in Rect::closest_to
Assertion fails if the point is outside of the rect. This was introduced
in introduced in #18970 and causes serenity to crash when changing to 2x
resolution for a monitor, if the cursor after resizing is outside of
the new screen.

Added test to reproduce.
2023-07-01 23:27:00 +02:00
Andreas Kling 0cb9c9e81e LibJS: Add fast paths for bitwise ops on 2x Int32 JS::Value
~9% speed-up on Kraken/stanford-crypto-aes.js :^)
2023-07-01 20:29:12 +01:00
Andreas Kling 1efe4b58aa LibJS/Bytecode: Store current interpreter register window as a Span
This avoids a bunch of indirections on every single register access.

~17% speed-up on Kraken/stanford-crypto-aes.js :^)
2023-07-01 20:29:12 +01:00
Shannon Booth e7435d68b0 LibJS: Extract named vm variables in ArrayBufferPrototype::slice 2023-07-01 16:55:17 +01:00
Shannon Booth 3781948f0c LibJS: Add initial implementation for SharedArrayBuffer
None of the actual sharing is implemented yet, but this is enough for
most basic functionality.

Diff Tests:
    +260     -262    +2 💀
2023-07-01 16:55:17 +01:00
Ali Mohammad Pur 1c1aa2c0d0 Shell: Handle (most) errors in the parsers
This turns all errors into either "OOM" or a proper shell error (if
propagation is impossible or meaningless).
Fixes `echo -en '\xfe\x4a' | $SHELL` crashing.
2023-07-01 17:01:54 +03:30
Andreas Kling 3f022f4040 LibWeb: Treat non-finite containing block width as zero for percentages
Fixes an assertion when loading https://bun.sh/
2023-07-01 09:06:49 +02:00
Haikal Zain bf16618fba LibWeb: Add vertical border heights to tr
tr y offset is not being computed correctly.
This is causing errors in hit testing since
td and tr are misaligned.
2023-07-01 08:07:49 +02:00
Andi Gallo 6b649af447 LibWeb: Fix inset shadow with zero offset and blur
Before this change, we only blurred the shadows which would've been
generated without blur. This meant that we didn't generate a shadow when
the offset was zero, even with blur. However, other browsers generate a
shadow when blur is set.

Instead, always generate a rectangular contour of sufficient thickness,
blur it if needed and blit it into the right position at the very end.
Thanks to the blur radius, we'll have a shadow even when the offset is
zero.
2023-07-01 07:48:33 +02:00