1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 17:44:56 +09:00
Commit graph

4077 commits

Author SHA1 Message Date
Aliaksandr Kalenik
bb53485dea LibJS+LibWeb: Add fast path for builtin iterators in iterator_step()
We already have fast path for built-in iterators that skips `next()`
lookup and iteration result object allocation applied for `for..of` and
`for..in` loops. This change extends it to `iterator_step()` to cover
`Array.from()`, `[...arr]` and many other cases.

Makes following function go 2.35x faster on my computer:
```js
(function f() {
  let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
  for (let i = 0; i < 1000000; i++) {
    let [a, ...rest] = arr;
  }
})();
```
2025-05-13 15:14:25 +03:00
Psychpsyo
31301ef08b LibWeb: Add support for trees of pseudo-elements
This is needed for CSS view transitions.
2025-05-13 12:38:42 +01:00
Andrew Kaster
0402179331 CMake: Disable C++20 module scanning
We don't use C++20 modules, and CMake will look for clang-scan-deps in
clang builds if this setting is not disabled. This is a problem when
clang-scan-deps is not installed, as it will cause CMake to fail to link
hidden visibility libraries properly.
2025-05-12 23:43:59 -06:00
Andrew Kaster
a6d9e8acd8 CMake: Only find pthread and mman on Windows once
This reduces a lot of CMake spam when configuring
2025-05-12 03:22:23 -06:00
ayeteadoe
8f670950e2 Meta: Add opt-in explicit symbol export for libraries
On Windows, `set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)` is currently
used. But that will need to change as LibWeb exceeds the maximum
symbols that can be exported from a single executable/dll
(See LNK1189 error). So to prevent bitrot and Unix/Windows getting
out of sync, this function that generates the export header for the
target also sets the symbol visibility to hidden on Unix to ensure
Link errors also occur on Unix if the the required library components
are not annotated with the FOO_API macro.
2025-05-12 03:22:23 -06:00
Andrew Kaster
f0004fa690 AK+CMake: Remove workaround for swiftc mishandling [[no_unique_address]] 2025-05-09 23:14:27 -06:00
Ali Mohammad Pur
43defa90cc Meta: Make WPT.sh log args relative to cwd as of script invocation
This restores the behaviour from before adding parallel instance
support.
2025-05-08 23:50:04 +01:00
Sam Atkins
f0ce4f43a6 LibWeb: Make unknown webkit pseudo-elements safe to dump
This fixes a couple of crashes when dumping the style sheets on
ladybird.org
2025-05-08 16:21:32 +01:00
Ali Mohammad Pur
fbfd3e2538 IDLGenerators: Add an 'WithInitializer' attribute for an init hook
This is needed for WebAssembly.*Error (at least), which apparently
cannot be defined in webidl.
2025-05-08 03:35:11 -06:00
Ali Mohammad Pur
011982c501 Meta: Make WPT.sh run nproc/2 testrunners in parallel
This is the "intended" way of parallelism with wpt, but instead of
requiring N different systems (or VMs), this does it all on one system
with the power of namespaces.
2025-05-07 15:48:21 +01:00
Ali Mohammad Pur
79c32f33e1 Meta: Reformat WPT.sh 2025-05-07 15:48:21 +01:00
stelar7
f5eb7928d9 Meta/IDL: Add continue as a cpp keyword 2025-05-06 11:16:01 +02:00
Sam Atkins
6b762331df LibGfx: Rename WOFF[2]::try_load_from_externally_owned_memory()
Typeface::try_load_from_externally_owned_memory() relies on that
external owner keeping the memory around. However, neither WOFF nor
WOFF2 do so - they both create separate ByteBuffers to hold the TTF
data. So, rename them to make it clearer that they don't have any
requirements on the byte owner.
2025-05-03 12:01:43 +01:00
Timothy Flynn
ac1c2a956a LibWeb: Implement caching of reflected element array attributes
For attributes like Element.ariaControlsElements, which are a reflection
of FrozenArray<Element>, we must return the same JS::Array object every
time the attribute is invoked - until its contents have changed. This
patch implements caching of the reflected array in accordance with the
spec.
2025-04-26 17:29:38 -04:00
Timothy Flynn
6f894ccd77 Meta: Remove -Wno-overloaded-virtual from clang compilation
This silenced warning was added a long time ago when we were first
bringing up Lagom: a619943001

The commit message indicates we were seeing errors due to this warning
in many places. We now compile just fine with this warning enabled, so
let's remove its silencer to be a little more consistent between clang
and GCC.
2025-04-26 09:04:45 -06:00
Timothy Flynn
62167d923c LibWeb: Convert ARIA attributes to FrozenArray 2025-04-25 16:43:43 +02:00
Timothy Flynn
98f73a6b31 LibWeb: Implement FrozenArray IDL attributes
A FrozenArray is simply a sequence whose integrity level is "frozen".
2025-04-25 16:43:43 +02:00
Shannon Booth
041ff0c7ff LibWeb/HTML: Hook up a WorkerAgent for web workers 2025-04-25 14:07:51 +02:00
Shannon Booth
8263a9863f LibJS+LibWeb: Do not return error from VM::create
This never returns an error to propogate, also allowing ErrorOr
to be removed from creating the main thread VM.
2025-04-25 14:07:51 +02:00
Shannon Booth
084cceab5c LibWeb: Split out SimilarOriginWindowAgent from HTML::Agent
To allow for adding the concept of a WorkerAgent to be reused
between shared and dedicated workers. An event loop is the
commonality between the different agent types, though, there
are some differences between those event loops which we customize
on the construction of the HTML::EventLoop.
2025-04-25 14:07:51 +02:00
Timothy Flynn
13ac6c4fde LibWeb: Implement ariaActiveDescendantElement spiritually closer to spec
We are meant to store a weak reference to the element indicated by this
attribute, rather than a GC-protected strong reference. This also hoists
the "get the attr-associated element" AO into its own function, rather
than being hidden in IDL, to match "get the attr-associated elements".
2025-04-25 01:20:12 +01:00
Timothy Flynn
f985ac8884 LibWeb: Implement element-referencing ARIA attributes
There are ARIA attributes, e.g. ariaControlsElements, which refer to a
list of elements by their ID. For example:

    <div aria-controls="item1 item2">

The div.ariaControlsElements attribute would be a list of elements whose
ID matches the values in the aria-controls attribute.
2025-04-25 01:20:12 +01:00
Andrew Kaster
7b0c2da14f LibWeb: Account for LegacyNamespace attribute in constructor generator
When playing games with cross-realm construction, we need to make sure
that any calls to ensure_web_prototype for LegacyNamespace objects use
the correctly namespaced prototype name.
2025-04-23 14:09:09 +02:00
Andrew Kaster
e1369aa7d6 CMake: Explicitly set CMAKE_OSX_SYSROOT to macosx for macOS host builds
The implicit default CMAKE_OSX_SYSROOT was a workaround in CMake for
macOS ~10.8. As of CMake 4.x, CMake expects macOS host compilers to have
their own default sysroot detection logic. However, upstream llvm does
not actually do this, only Apple Clang does. To keep supporting homebrew
clang and manually compiled clang from llvm/llvm-project, we need to
set the sysroot explicitly.

The behavior difference and lack of default detection logic in the clang
driver is tracked at https://gitlab.kitware.com/cmake/cmake/-/issues/26863
2025-04-22 17:31:12 -04:00
Ali Mohammad Pur
f341bb0522 IDLGenerators: Cast wrapped references to a known reference type
They may be GC::Ref<T> objects, which should be converted to T const&
before being so nicely const-cast to T&.
2025-04-22 08:43:46 -06:00
Ali Mohammad Pur
3a6b6a732e IDLGenerators: Unbreak sequence<dictionary> codegen
This was completely busted (where it would generate a variable inside a
block, and try to access it outside the block); this commit fixes this
in the least annoying way possible.
2025-04-22 08:43:46 -06:00
Ali Mohammad Pur
51bab5b186 LibWasm: Make traps hold on to externally-managed data
...instead of specially handling JS::Completion.
This makes it possible for LibWeb/LibJS to have full control over how
these things are made, stored, and visited (whenever).

Fixes an issue where we couldn't roundtrip a JS exception through Wasm.
2025-04-22 08:43:46 -06:00
Tim Ledbetter
9cf04f40f6 LibWeb: Implement the color-mix() function
This takes 2 color values and returns the result of mixing them by a
given amount.
2025-04-22 12:19:51 +02:00
Shannon Booth
a14711a9d7 LibWeb/Bindings: Use realm's globalObject as thisValue if nullish
We were missing the step to use realm's global object if thisValue
was nullish. This is very trivial to fix, as `impl_this` already
handles everything as it should, allowing us to also remove the
special casing for WindowProxy.
2025-04-22 12:17:14 +02:00
Andreas Kling
e1777f6e79 LibWeb: Make :hover invalidation logic reusable for all pseudo classes
We achieve this by keeping track of all checked pseudo class selectors
in the SelectorEngine code. We also give StyleComputer per-pseudo-class
rule caches.
2025-04-17 19:45:55 +02:00
Andrew Kaster
d1f6f5649e LibWeb: Make storage of CSS::CalculationNodes const-correct
Now we consistently use `RefPtr<CalculationNode const>` for all
CalculationNodes.
2025-04-16 10:41:44 -06:00
Andrew Kaster
6d11414957 LibWeb: Make storage of CSS::StyleValues const-correct
Now we consistently use `RefPtr<StyleValue const>` for all StyleValues.
2025-04-16 10:41:44 -06:00
Andrew Kaster
7d797b2c32 CMake: Remove warning suppression for unknown attributes
We should take care of these with macros or other means instead of
suppressing them.
2025-04-15 02:19:06 -06:00
Andrew Kaster
b133c27305 CMake: Disable [[no_unique_address]] when Swift is enabled
There's an upstream bug on this already.
2025-04-15 02:19:06 -06:00
Timothy Flynn
c0ead1b01a LibIDL+LibWeb: Begin support for async iterator in IDL
This adds support for async iterators of the form:

    async iterable<value_type>;
    async iterable<value_type>(/* arguments... */);

It does not yet support the value pairs of the form:

    async iterable<key_type, value_type>;
    async iterable<key_type, value_type>(/* arguments... */);

Async iterators have an optional `return` data property. There's not a
particularly good way to know what interfaces implement this property.
So this adds a new extended attribute, DefinesAsyncIteratorReturn, which
interfaces can use to declare their support.
2025-04-14 17:43:11 -04:00
Timothy Flynn
296a81c4b8 LibWeb: Add Streams to the list of IDL interface namespaces
Otherwise, we are not able to generate a fully qualified name for
Streams objects.
2025-04-14 17:43:11 -04:00
Timothy Flynn
8599917188 LibWeb: Do not throw exceptions from Promise-type attributes
If an attribute's getter were to throw an exception, we must instead
return a rejected promise. We already supported this behavior for
functions.
2025-04-14 15:50:21 -04:00
Timothy Flynn
500fbcb5b8 Meta: Do not lint IDL files imported from WPT 2025-04-14 15:50:21 -04:00
Luke Wilde
9ba76ea25a Meta: Use presets, chosen clang and explicit sysroot to build fuzzers
This near enough matches what CI does to build fuzzers, with the
differences being the explicit -GNinja and setting CMAKE_OSX_SYSROOT,
as CMake 4 no longer does that for us.
2025-04-12 16:13:15 -06:00
Aliaksandr Kalenik
b53694b4c0 LibIPC+LibWeb: Delete LargeMessageWrapper workaround in IPC connection
Bring back 2d625f5c23
2025-04-10 23:40:02 +02:00
Tim Ledbetter
1ee56d34e7 Revert "LibIPC+LibWeb: Delete LargeMessageWrapper workaround in IPC…
…connection"

This reverts commit 2d625f5c23.
2025-04-10 16:24:38 +01:00
Aliaksandr Kalenik
2d625f5c23 LibIPC+LibWeb: Delete LargeMessageWrapper workaround in IPC connection
It's no longer needed because TransportSocket is now capable of properly
sending large messages.
2025-04-10 01:30:08 +02:00
stelar7
6ec914c7f7 LibWeb/IDB: Add some debug output 2025-04-09 11:48:49 -06:00
Tim Ledbetter
02d34dd021 LibWeb: Rename CSSColor to ColorFunctionStyleValue
This gives a better idea of what the class represents.
2025-04-09 12:11:33 +01:00
Timothy Flynn
f070264800 Everywhere: Remove sv suffix from format string literals
This prevents the compile-time checks that would catch errors in the
format invocation (which would usually lead to a runtime crash).
2025-04-08 20:00:18 -04:00
Aliaksandr Kalenik
ab35325003 LibIPC: Move early fd deallocation workaround to the transport layer
Reimplements c3121c9d at the transport layer, allowing us to solve the
same problem once, in a single place, for both the LibIPC connection and
MessagePort. This avoids exposing a workaround for a macOS specific Unix
domain socket issue to higher abstraction layers.
2025-04-08 21:09:24 +02:00
Ali Mohammad Pur
6b883c5ccb Meta: Disable -Warray-bounds and -Wstringop-overflow on GCC
These generate what seems to be nonsense warnings on Function and
ByteBuffer; they *should* be investigated at some point, but they don't
provide anything useful at this point.
2025-04-08 14:01:28 +02:00
Ali Mohammad Pur
0a958c8e16 Meta: Add an option to disable LTO for Release builds 2025-04-08 14:01:28 +02:00
Ali Mohammad Pur
fac2ee4452 Meta: Add a link job pool with a configurable size
Parallel linking (esp. with bfd) uses a huge chunk of memory, make it
possible for users to limit the number of link jobs to at least
limit the pain.
2025-04-08 14:01:28 +02:00
rmg-x
514233008b Meta+LibCore: Stop linking against LibCrypt
This was only be used by "Account.cpp" which was removed in:
d8c36ed458
2025-04-08 09:13:33 +02:00