Commit graph

52130 commits

Author SHA1 Message Date
Timothy Flynn
2b19d1b5ab LibJS: Do not coerce nullish references to unresolvable references
These are not strictly unresolvable references. Treating them as such
fails an assertion in the `delete UnaryExpression` semantic (which is
Reference::delete_ in our implementation) - we enter the unresolvable,
branch, which then asserts that the [[Strict]] slot of the reference is
false.
2023-07-06 21:36:13 +01:00
Timothy Flynn
f57310999d LibWeb: Update workarounds for the empty execution context stack
Use the new helper class to perform this workaround.
2023-07-06 15:18:50 -04:00
Timothy Flynn
8ec7b4401a LibWeb: Add a helper class to work around empty execution context stack
We've peppered this workaround around the code base as needed in a few
different ways. This adds a helper class to perform this workaround in
order to simplify doing so, and ensure cleanup occurs in a RAII fashion.
This also makes it easier to grep for places where this workaround is
employed.
2023-07-06 15:18:50 -04:00
kleines Filmröllchen
10edd38543 LibCore: Keep track of file offset to avoid system call for tell()
This optimization makes the new test run 2x faster.
2023-07-06 21:05:57 +02:00
kleines Filmröllchen
111fd1e5fe LibAudio: Optimize FlacLoader by avoiding allocations
- Pre-allocate and reuse sample decompression buffers. In many FLAC
  files, the amount of samples per frame is either constant or the
  largest frame will be hit within the first couple of frames. Also,
  during audio output, we need to move and combine the samples from the
  decompression buffers into the final output buffers anyways. Avoiding
  the reallocation of these large buffers provides an improvement from
  16x to 18x decode speed on strongly compressed but otherwise usual
  input.
- Leave a FIXME for a similar improvement that can be made in the
  residual decoder.
- Pre-allocate audio chunks if frame size is known.
- Use reasonable inline capacities in several places where we know the
  maximum or usual capacity needed.
2023-07-06 19:13:36 +01:00
Tim Schumacher
60ac254df6 AK: Use hashing to accelerate searching a CircularBuffer 2023-07-06 15:06:20 +01:00
Tim Schumacher
4a10cf1506 AK: Make CircularBuffer::read_with_seekback const
Compared to the other read and write functions, this doesn't modify the
internal state of the circular buffer.
2023-07-06 15:06:20 +01:00
Tim Schumacher
42d01b21d8 AK: Rewrite the hint-based CircularBuffer::find_copy_in_seekback
This now searches the memory in blocks, which should be slightly more
efficient. However, it doesn't make much difference (e.g. ~1% in LZMA
compression) in most real-world applications, as the non-hint function
is more expensive by orders of magnitude.
2023-07-06 15:06:20 +01:00
Tim Schumacher
3526d67694 AK: Add Span<T>::matching_prefix_length 2023-07-06 15:06:20 +01:00
Tim Schumacher
2109f61b0d AK: Add search-related helpers to CircularBuffer
This factors out a lot of complicated math into somewhat understandable
functions.

While at it, rename `next_read_span_with_seekback` to
`next_seekback_span` to keep the naming consistent and to avoid making
function names any longer.
2023-07-06 15:06:20 +01:00
Tim Schumacher
d12036132e AK: Allow passing an offset to CircularBuffer::next_read_span() 2023-07-06 15:06:20 +01:00
Tim Schumacher
046a9faeb3 AK: Split up CircularBuffer::find_copy_in_seekback
The "operation modes" of this function have very different focuses, and
trying to combine both in a way where we share the most amount of code
probably results in the worst performance.

Instead, split up the function into "existing distances" and "no
existing distances" so that we can optimize either case separately.
2023-07-06 15:06:20 +01:00
Tim Schumacher
9e82ad758e AK: Move parts for searching CircularBuffer into a new class
We will be adding extra logic to the CircularBuffer to optimize
searching, but this would negatively impact the performance of
CircularBuffer users that don't need that functionality.
2023-07-06 15:06:20 +01:00
Lucas CHOLLET
40c0dd67dd Ports/backward-cpp: Update to the latest available commit
backward-cpp 1.6 wasn't compatible with the latest version of binutils
(which we are using). This is now fixed upstream, but it forces us to
build with the latest commit and not a published version.
2023-07-06 15:01:17 +01:00
Lucas CHOLLET
b8bc1ac5d0 Ports: Fix a typo in .port_include.sh 2023-07-06 15:01:17 +01:00
Andre Herbst
703ac59b27 Ports/acpica-tools: Prevent dangling pointer compiler warning 2023-07-06 14:59:14 +01:00
Shannon Booth
d18cae7301 LibJS: Add spec comments to RawBytesToNumeric AO 2023-07-06 14:55:46 +01:00
Shannon Booth
4186fcab9a LibJS: Implement GetValueFromBuffer AO closer to spec
No functional changes intended, just some extra asserts added, and a
whole bunch of spec comments.
2023-07-06 14:55:46 +01:00
Shannon Booth
b1870bc47b LibJS: Propagate OOM from SetValueInBuffer AO 2023-07-06 14:55:46 +01:00
Shannon Booth
3bb15d3dae LibJS: Propagate OOM from GetValueFromBuffer AO 2023-07-06 14:55:46 +01:00
Shannon Booth
49c8d22f50 LibJS: Propagate OOM in GetModifySetValueInBuffer AO 2023-07-06 14:55:46 +01:00
Shannon Booth
81c8e642b9 LibJS: Handle OOM in NumericToRawBytes AO 2023-07-06 14:55:46 +01:00
Zaggy1024
ddb7b59af0 LibAudio: Always add a seek point once the FLAC header has parsed 2023-07-06 14:27:57 +01:00
Zaggy1024
9d5819e9e2 LibAudio: Seek accurately to the target frame in the FLAC loader
Instead of using a seek tolerance value to get close enough to the
target, we can skip frames forward until we pass the target, then seek
back to the previous frame. That puts us in a position to immediately
decode the frame containing the target sample.
2023-07-06 14:27:57 +01:00
Zaggy1024
f2d9280342 LibAudio: Skip FLAC samples even if already close to seek target
Previously, the FLAC loader would not skip samples to reach its seek
target if it saw that the current sample in the loader is closer to the
target than the seek point it finds. This prevents seeking forward when
there are no seek points past the current position.
2023-07-06 14:27:57 +01:00
Zaggy1024
ee1903e641 LibAudio: Always insert a seek point at sample 0 if not present
Previously, the calculation of the distance to the previous seekpoint
would always behave as if a seek point existed at sample 0, meaning
that it would never place a seek point there. If we instead treat it as
the maximum distance if no sample is present, a seek point will be
placed.
2023-07-06 14:27:57 +01:00
Zaggy1024
a8dc97d95d LibAudio: Don't return a seek point if it is after the desired sample
If the seek table was incomplete, without any seek points available
before the target point, `SeekTable::seek_point_before()` would instead
return the first seek point after the target. Check whether the seek
point is before the target before returning it.
2023-07-06 14:27:57 +01:00
Andreas Kling
42675971e2 LibWeb: Resolve inline-block percentage padding against 0, not infinity
When the containing block has an indefinite width, any descendants with
a percentage size should resolve that against 0, not infinity.

Fixes an assertion failure when loading https://www.gnu.org/
2023-07-06 14:25:40 +01:00
Andreas Kling
5955a504e0 LibWeb: Allow font-family names to start with -
We achieve this by making properties that accept a custom-ident value
skip the "someone else's vendor prefix" check for values that start with
a `-` character.

This fixes an issue where e.g `font-family: Arial, -apple-system` would
be rejected by the parser completely. We now treat `-apple-system` like
an identifier in such cases.

Also add `valid-types` metadata for the `font-family` property so this
actually works. :^)
2023-07-06 14:30:06 +02:00
Andreas Kling
dfdb31f5b0 LibWeb: Accept MIME types starting with "application/font" for CSS fonts
Although "application/font-woff" is apparently "deprecated", it's very
much still in use on the web, so we should not be rejecting it.
2023-07-06 14:30:06 +02:00
volovikariel
541bf17a4a Meta: Add missing package in Devcontainer
When using Ladybird in a Devcontainer, the qt6-multimedia-dev package is
missing from the install.sh file.
2023-07-06 13:28:19 +02:00
volovikariel
0498f8dabe Ladybird: Add ccache as a build requirement
As ccache is nice to have when rebuilding Ladybird, adding it to the
build instructions may improve the experience for newcomers.
2023-07-06 13:28:19 +02:00
volovikariel
7cd8c3f708 Ladybird: Replace gcc-12 requirement with g++-12
The build instructions include build-essential,
which installs gcc and g++.
However, build-essential's currently stable version (v12.9) depends on
a version of g++ < 12, thus, Ladybird doesn't build.
2023-07-06 13:28:19 +02:00
Shannon Booth
696c92882a LibDiff: Add a forwarding header 2023-07-06 13:22:37 +02:00
Shannon Booth
84b187e375 diff: Only output a unified/context header if there is a diff 2023-07-06 13:22:37 +02:00
Daniel Bertalan
c6c20d3bf3 LibJS/Bytecode: Use CopyDataProperties AO for destructuring
The previous ad-hoc implementation ignored the non-enumerable flag.
2023-07-06 12:11:02 +01:00
Jonah
afb07281ad Browser+LibWebView: Load and Display ARIA Properites and State
The inspector widget now has a new ARIA tab which displays an
individual element's ARIA properties and state. The view itself
is pretty basic for now, just being a table- there is definitely room
for some better UX here but it's enough for a first cut.
2023-07-06 11:21:36 +01:00
Jonah
e9840bfd4e LibWeb: Build out the ARIA role model
We now have implemented the ARIA role model. These classes will
control which states and properties are exposed to end users.
2023-07-06 11:21:36 +01:00
Jonah
125792e5ff LibWeb: Add helper functions for handling ARIA state and properties
These will make serializing and calculating default values easier.
2023-07-06 11:21:36 +01:00
Jonah
57a6d577ad LibWeb: Add AriaData object to parse ARIAMixin data
This provides an easily serializeable interface for us to use in IPC.
2023-07-06 11:21:36 +01:00
kleines Filmröllchen
10931dceb8 SystemMonitor: Only read process command line once
Process command line reading took up 50% (!) of all of SystemMonitor's
work. However, a process's command line per definition never changes, so
we can read it once and carry it over. Also, if we couldn't read a
process's command line once, it is close to impossible that we'll ever
be able to read it in the future. Therefore, skip reading such command
lines again as well.

This commit also converts the command line itself to use String, while
we're at it.
2023-07-06 11:07:45 +01:00
kleines Filmröllchen
7d53767ce8 SystemMonitor: Don't reopen process statistics file on every update
This file can just remain open; we seek to its start anyways.
This previously accounted for over 5% of SystemMonitor runtime.
2023-07-06 11:07:45 +01:00
kleines Filmröllchen
26d8ac844c Terminal: Modernize
- Replace C with C++
- Use Core::System, Core::Account and Core::Process wrappers
- Remove DeprecatedString
- Remove invalid close() call to the pts file descriptor in the shell
  child (the fd cannot be valid there anymore since it's an
  automatically-closing fd, we just previously ignored this error)
2023-07-06 11:07:11 +01:00
kleines Filmröllchen
8258618caf LibAudio: Mix multi-channel files more properly
We downsample multi-channel files into stereo for now, which at least
makes the other channels listenable. The new multi-channel downmix
helper is intended to be used for other formats with the same or similar
channel arrangement, such as QOA.
2023-07-06 10:44:42 +01:00
kleines Filmröllchen
fc70d88367 LibAudio: Handle unknown-sized streams better
Especially FLAC had an issue here before, but the loader infrastructure
itself wouldn't handle end of stream properly if the "available samples"
information didn't match up.
2023-07-06 10:44:42 +01:00
kleines Filmröllchen
e9e95b1899 LibAudio: Fix escaped partitions
A missing sign extension and a wrong data type broke these before.
2023-07-06 10:44:42 +01:00
Linus Groh
69c42eaf8b Base: Stop generating strace(1) manpage 2023-07-06 10:41:49 +01:00
Andre Herbst
4844e8869e Ports/imagemagick: Replace --host=... with --with-sysroot
... to prevent linking against libs from build host. I.e. if
Ports/fontconfig is already installed imagemagick tries to
link against it in /usr/local/lib and fails to build.
--host=... will already be passed by ../.port_include.sh
2023-07-06 10:17:29 +01:00
kleines Filmröllchen
a3f6236bec LibC: Convert semaphore and termcap to String 2023-07-06 10:15:37 +01:00
kleines Filmröllchen
bd13cc0732 GamesSettings+LibCards: Get rid of DeprecatedString 2023-07-06 10:15:37 +01:00