Commit graph

52110 commits

Author SHA1 Message Date
Andreas Kling
db5bde01dc LibWeb: Resolve % top and bottom insets against containing block height
This makes cookie banner buttons show up on Linktree again. :^)

Regressed in fd37ad3a84
2023-07-08 10:51:12 +02:00
Sebastian Zaha
fd37ad3a84 LibWeb: Fix absolute positioning issues
Make sure the insets and margins calculated according to the spec are
not later ignored and ad-hoc recomputed in
layout_absolutely_positioned_element.

Use the static position calculation in a couple of places where the
spec (and comment) was indicating it should be used.

Fixes #19362
2023-07-08 06:13:56 +02:00
Sebastian Zaha
61fe7c230f LibWeb: Implement abspos for replaced elements
Added implementation and spec comments for sections 10.3.8 and 10.6.5,
with an implementation similar to the existing ones for non-replaced
elements.
2023-07-08 06:13:56 +02:00
Sebastian Zaha
6a66a05809 LibWeb: Adjust 4 abspos tests to highlight errors
The tests still pass, but opening the files in Ladybird and Safari or
Firefox shows clearly where the layouting in Ladybird is incorrect
for some absolute positioned elements. The previous 1px border was
subtly hiding some issues.
2023-07-08 06:13:56 +02:00
Sebastian Zaha
d77986f01c headless-browser: Ensure IPC::File is closed after sending
On systems with the default ulimit for open files <= 256 (default
on some systems) the LibWeb tests were crashing because the
input file handles are not closed in headless-browser.
2023-07-08 06:11:08 +02:00
Sebastian Zaha
59c862cab9 Documentation: Debugging Ladybird in CLion 2023-07-08 06:09:18 +02:00
Aliaksandr Kalenik
71c54dd37b LibJS: Always init arguments stored in locals for generator functions
Since AST interpreter switches to bytecode to execute generator
functions, arguments stored in local variables always need to be
initialized for such functions.
2023-07-08 05:38:45 +02:00
Lucas CHOLLET
e5b70837de LibGfx: Remove ImageDecoder::set_[non]volatile()
These methods are unused so let's remove them.
2023-07-08 01:45:46 +01:00
Daniel Bertalan
210448b6ed LibC: Relax memmove() to memcpy() in more cases
`memcpy()` and `memmove()` are functionally equivalent if the source and
destination memory regions do not overlap. If this is the case, we
should prefer `memcpy()` as it's implemented in a simpler and faster
way. As our `memcpy()` starts copying from the lowest address first,
relaxing a `memmove()` call to `memcpy()` is safe if the destination:
- starts at a lower address than the source
- starts at a higher address than the source's end
2023-07-07 23:46:54 +02:00
Nicolas Ramz
176baf7cdb LibWeb: Support background attribute on table elements 2023-07-07 19:09:55 +01:00
Aliaksandr Kalenik
b1af91d8c4 LibJS: Use local variables to store function parameters in some cases
Using local variables to store function parameters makes Kraken tests
run 7-10% faster.

For now this optimization is limited to only be applied if:
- Parameter does not use destructuring assignment
- None of the function params has default value
- There is no access to "arguments" variable inside function body
2023-07-07 19:35:08 +02:00
Aliaksandr Kalenik
2e81cc4cf7 LibJS: Use Identifier to represent FunctionParameter name
Using identifier instead of string allows to store supplemental
information about whether it can be represented as local variable.
2023-07-07 19:35:08 +02:00
Timothy Flynn
2f1d6c0b9a LibJS/Bytecode: Ensure we do not generate bytecode for super expressions
Similar to AST mode, super expressions are handled elsewhere.
2023-07-07 18:11:51 +02:00
Timothy Flynn
23daf5097b LibJS/Bytecode: Generate bytecode for deleting super properties 2023-07-07 18:11:51 +02:00
Timothy Flynn
0d50e5eeee LibJS/Bytecode: Extract code to generate a super reference to a helper
This code is already repeated twice, and would be repeated a third time
for the `delete` operator.
2023-07-07 18:11:51 +02:00
Timothy Flynn
d5ca51b461 LibJS: Forward declare the MemberExpression AST node 2023-07-07 18:11:51 +02:00
Timothy Flynn
621d55ad65 LibJS/Bytecode: Do note coerce referenced values to an Object too early
Converting a base value to an Object is performed by Reference::delete_.
Doing this early in the bytecode operator could be observable, although
it would likely be the first observable step in Reference::delete_
anyways. This will just align these operators with upcoming operators
for super references, where doing this coercion first will be observable
(we need to throw an exception for deleting a super property before this
coercion).
2023-07-07 18:11:51 +02:00
Timothy Flynn
a2e245fa97 LibJS: Allow converting a reference to an object to fail in delete
This is (part of) a normative change in the ECMA-262 spec. See:
https://github.com/tc39/ecma262/commit/d09532c

We recently implemented other parts of that commit in LibJS, but missed
this change:
442ca4f9b4
2b19d1b5ab
2023-07-07 18:11:51 +02:00
Zaggy1024
888af08638 LibVideo/VP9: Implement lossless residual decoding 2023-07-07 06:44:04 -04:00
Andrew Kaster
2a4f2110b9 Ladybird: Move the AudioThread class into its own file
This implementation detail of audio support in ladybird is a QObject
that needs moc'd by the moc tools. Putting it in its own file follows
the pattern we have for all the other QObjects in Ladybird.
2023-07-07 06:41:51 -04:00
Andrew Kaster
450b4336b3 LibWeb: Ensure prototype of CSSKeyframe{s}Rule 2023-07-07 06:41:51 -04:00
Andrew Kaster
ab9ae8ead3 Ladybird: Add missing QUrl include to WebContentView 2023-07-07 06:41:51 -04:00
Andrew Kaster
fdefb4104b LibWeb: Add prototype header to CustomElementRegistry.cpp 2023-07-07 06:41:51 -04:00
Andrew Kaster
aa329cb2f8 IPCCompiler: Add option to pass output file path
Instead of requiring the caller to redirect stdout, let's be nice
citizens and add an option for the output file.
2023-07-07 06:41:51 -04:00
kamp
5338eba39a LibCore: Remove some dead code in wait_for_events
Since max_fd_added and max_fd are initialized to -1 and 0 respectively
the former could never be greater than the latter.
2023-07-07 09:47:30 +02:00
Luke Wilde
71f6e5c942 LibWeb: Implement loading=lazy for <img> elements 2023-07-07 05:27:25 +02:00
Luke Wilde
165abafb80 LibWeb: Add initial implementation of IntersectionObserver
The main missing features are rootMargin, proper nested browsing
context support and content clip/clip-path support.

This makes images appear on some sites, such as YouTube and
howstuffworks.com.
2023-07-07 05:27:25 +02:00
Luke Wilde
6f8afd8cd9 LibWeb: Implement DOMRect(ReadOnly)#fromRect
This will also be used by IntersectionObserver.
2023-07-07 05:27:25 +02:00
Fabian Dellwing
1d426df262 Ports: Add poppler 2023-07-07 00:43:42 +02:00
Ali Mohammad Pur
72b9f47bb1 Ports: Add jakt 2023-07-07 00:04:15 +02:00
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