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

68973 commits

Author SHA1 Message Date
Sam Atkins
a1fb34d7f2 LibWeb/CSS: Alphabetize Enums.json 2025-05-03 23:22:40 +01:00
Andreas Kling
edb5547e37 LibJS: Don't incrementally delete PropertyNameIterator while iterating
We were spending a lot of time removing each property name from the
iterator's underlying HashMap while iterating over it. This wasn't
actually necessary, so let's stop doing it and instead just iterate
over the property names with a stored HashTable iterator.

1.10x speedup on MicroBench/for-in-indexed-properties.js
2025-05-03 22:00:51 +02:00
Andreas Kling
c8edd37741 Meta: Add Shannon Booth to maintainers list :^) 2025-05-03 20:58:23 +02:00
Andreas Kling
570d1e8811 LibJS: Use PrimitiveString more instead of Utf16String in String code
This avoids a whole lot of unnecessary roundtrips from UTF8 <=> UTF16.
2025-05-03 20:01:20 +02:00
Andreas Kling
98fef16972 LibJS: Use PrimitiveString more instead of Utf16String in RegExp code
PrimitiveString has an internal UTF-16 string cache anyway, and so this
actually avoids repeatedly converting between UTF-8 and UTF-16.
2025-05-03 20:01:20 +02:00
Jess
897c83cbcb Docs: Link the external Nix devshell 2025-05-03 16:40:50 +01:00
Andreas Kling
7c26354563 LibJS: Avoid Value->PropertyKey->Value roundtrip in for..in iteration
Before this change, we would call [[OwnPropertyKeys]] on the target
objects, then convert the returned keys from Value into PropertyKey.
Then, when actually iterating, we'd convert them back into Value again.
This was particularly costly for numeric property keys, since we had
to go through string-from-number construction.

Now, we simply keep the original values returned by [[OwnPropertyKeys]]
around and use them for the enumeration.

1.09x speedup on MicroBench/for-in-indexed-properties.js
1.01x speedup on MicroBench/for-in-named-properties.js
2025-05-03 17:33:54 +02:00
Andreas Kling
11ece7de10 LibGC: Add GC::RootHashMap<...> template container
This is a GC-aware wrapper around AK::HashMap. Entry values are treated
as GC roots, much like the GC::RootVector we already had.

We also provide GC::OrderedRootHashMap as a convenience.
2025-05-03 17:33:54 +02:00
Andreas Kling
a453da2906 AK: Allow specifying HashSetExistingEntryBehavior in HashMap::set() 2025-05-03 17:33:54 +02:00
Timothy Flynn
8a80ff7b3b AK+LibJS: Use simdutf for all base64 operations
We were previously unable to use simdutf for base64 decoding operations
other than "loose". Upstream has added support for the "strict" and
"stop-before-partial" operations, so let's make use of them!
2025-05-03 11:21:10 -04:00
Timothy Flynn
e04545979f Meta: Update simdutf to version 7.0.0 2025-05-03 11:21:10 -04:00
Timothy Flynn
6b6dd9c998 Meta: Update vcpkg baseline 2025-05-03 11:21:10 -04:00
Shannon Booth
e476d21ed0 LibJS: Add and use PrimitiveString::length_in_utf16_code_units
I was investigating an optimization in this area, and while it
didn't seem to have a noticable improvement, it still seems
useful to apply this change.
2025-05-03 16:18:47 +02:00
Sam Atkins
560317b3d0 LibWeb/CSS: Update spec comment in calc() simplification algorithm
This was corrected in 8bcf3ada9e
2025-05-03 14:54:33 +01:00
Sam Atkins
1cb1526178 LibWeb/CSS: Remove document-URL hack from create_a_style_sheet()
We no longer need this, because we don't complete URLs during parsing,
and the location is set elsewhere when needed.
2025-05-03 12:01:43 +01:00
Sam Atkins
bc1d323ba0 LibWeb/CSS: Remove URL parameter to the CSS Parser
We no longer complete any URLs during parsing.
2025-05-03 12:01:43 +01:00
Sam Atkins
9e2e796f2d LibWeb/CSS: Use CSS::URL for font-fetching
ParsedFontFace and FontLoader now both keep track of which
CSSStyleSheet (if any) was the source of the font-face, so the URLs can
be completed correctly.
2025-05-03 12:01:43 +01:00
Sam Atkins
14fb567a0f LibWeb/CSS: Stop overwriting style sheet location after construction 2025-05-03 12:01:43 +01:00
Sam Atkins
981ede900a LibWeb/DOM: Create style element style sheets with document's base URL
This is the simplest fix I could find that resolves a buggy interaction
between this and the CSS fetch algorithms, which also doesn't regress
anything. (As far as I can tell.)
2025-05-03 12:01:43 +01:00
Sam Atkins
7a4854732a LibWeb/CSS: Make CSS::URL formattable 2025-05-03 12:01:43 +01:00
Sam Atkins
efad6e96aa LibWeb/CSS: Set CSSFontFaceDescriptors' parent rule 2025-05-03 12:01:43 +01:00
Sam Atkins
ffc01626f7 LibWeb/CSS: Load fonts using fetch
Convert FontLoader to use fetch_a_style_resource(). ResourceLoader used
to keep its downloaded data around for us, but fetch doesn't, so we use
Gfx::Typeface::try_load_from_temporary_memory() so that the font has a
permanent copy of that data.
2025-05-03 12:01:43 +01:00
Sam Atkins
1967d5bc75 LibGfx: Add a helper for constructing a TTF font from temporary bytes
Once we switch from ResourceLoader to Fetch, nobody is going to be
holding onto the downloaded data, so we need to make a permanent copy
of it.
2025-05-03 12:01:43 +01:00
Sam Atkins
f76f8dcce1 LibWeb/CSS: Return the FetchController from fetch_a_style_resource() 2025-05-03 12:01:43 +01: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
Tim Ledbetter
23009779e1 LibWeb: Interpolate font-style values correctly
These are interpolated by computed value, except a value of `normal` is
treated as `oblique 0deg`.
2025-05-03 12:05:22 +02:00
Tim Ledbetter
c0f9b11070 LibWeb: Parse oblique font-style with an angle value 2025-05-03 12:05:22 +02:00
Andreas Kling
e537e426c1 LibJS: Teach for..in iterator to use IteratorNextUnpack optimization
Even though this code was already optimized to re-use a single result
object, returning { value, done } directly in output parameters still
provides a substantial speedup.

1.21x speedup on MicroBench/for-in-indexed-properties.js
2025-05-03 11:43:57 +02:00
Andreas Kling
0ef6444824 LibJS: Replace some use of ByteString with String
1.19x speedup on MicroBench/for-in-indexed-properties.js
2025-05-03 08:08:04 +02:00
Andreas Kling
2ef2e75cdc LibJS: Reduce HashTable rehashing in get_object_property_iterator()
Apply a little ensure_capacity() to avoid excessive rehashing of the
property key table when enumerating a large number of properties.

1.23x speedup on MicroBench/for-in-indexed-properties.js
2025-05-03 08:08:04 +02:00
Timothy Flynn
ea77092100 LibWeb: Begin implementing SharedWorker
Shared workers are essentially just workers that may be accessed from
scripts within the same origin. There are plenty of FIXMEs here (mostly
building on existing worker FIXMEs that are already in place), but this
lets us run the shared worker variants of WPT tests.
2025-05-02 17:48:02 -04:00
Timothy Flynn
469d5ccc4b LibWeb: Add FIXME about Worker's constructor's scriptURL parameter
TrustedScriptURL is its own interface that we haven't implemented yet.
2025-05-02 17:48:02 -04:00
Timothy Flynn
56f047119c LibWeb: Alphabetically sort LibWeb sources
I sorted this list when added shared worker sources, and this is the
fallout.
2025-05-02 17:48:02 -04:00
Timothy Flynn
912009f6b3 LibWeb: Implement navigator.clipboard.read 2025-05-02 17:46:16 -04:00
Timothy Flynn
a4e9a27343 LibWeb: Implement navigator.clipboard.write 2025-05-02 17:46:16 -04:00
Timothy Flynn
a1985e57e7 LibWeb: Implement navigator.clipboard.readText 2025-05-02 17:46:16 -04:00
Timothy Flynn
7f8f72556a headless-browser: Implement a stubbed clipboard API
We currently rely on UI-specific APIs to interact with the system
clipboard from AppKit and Qt. We do not have access to these from
headless-browser.

We should ultimately implement these APIs without relying on the UI as
a middle-man. For now, store a clipboard item so that we may exercise
the clipboard WPT tests.
2025-05-02 17:46:16 -04:00
Timothy Flynn
61c0f67c8c LibWeb+LibWebVew+WebContent+UI: Add IPC to retrieve the system clipboard
We currently have a single IPC to set clipboard data. We will also need
an IPC to retrieve that data from the UI. This defines system clipboard
data in LibWeb to handle this transfer, and adds the IPC to provide it.
2025-05-02 17:46:16 -04:00
Timothy Flynn
5fb5066e89 LibWeb: Initialize plain boolean in ClipboardItem::Representation 2025-05-02 17:46:16 -04:00
Timothy Flynn
4a9ed67e9d LibWeb: Do not store clipboard items in an unprotected vector 2025-05-02 17:46:16 -04:00
Andreas Kling
cf6e2531d9 AK: Make String::number() much faster for integer types
Instead of going through String::formatted(), we now have a specialized
code path for base-10 serialization directly to UTF-8.

This is roughly 5-10x faster than the previous implementation, depending
on how many digits we end up outputting.

1.07x speedup on MicroBench/for-in-indexed-properties.js
2025-05-02 19:13:03 +02:00
Bastiaan van der Plaat
4d84e1a8bc Base: Add about:settings and about:processes to about:about page 2025-05-02 12:21:37 +02:00
Bastiaan van der Plaat
832bb978f5 LibWeb: Reject CSS values with unprocessed tokens / extra semicolons 2025-05-02 11:10:02 +01:00
Bastiaan van der Plaat
b99f4872d1 LibWeb: Allow transform calculated length properties 2025-05-02 11:10:02 +01:00
Tim Ledbetter
542c3cbe51 LibWeb: Implement the transition-behavior CSS property
This specifies whether transitions should be started for transitions
whose animation behavior is discrete.
2025-05-02 11:07:19 +01:00
Jelle Raaijmakers
e57e38dafc LibWeb: Use as_if<T> in TreeNode methods
Using `as<T>` calls into `as_if<T>`, so let's just immediately use
that for the "node of type" iterators. No functional changes.
2025-05-02 11:02:20 +02:00
Aliaksandr Kalenik
6426586052 LibJS: Skip "return" method call while closing built-in iterators
"return" method is not defined on any of builtin iterators, so we could
skip it, avoiding method lookup.

I measured 10% improvement in array-destructuring-assignment.js micro
benchmark with this change.
2025-05-01 18:17:06 +02:00
Sam Atkins
6d2f393f2b LibGC: Make GC::Root formattable 2025-05-01 17:16:04 +01:00
Sam Atkins
06d62e5b5a LibGC: Make GC::Ptr and GC::Ref formattable
This is a copy of the Formatters we have for AK's pointer types.
2025-05-01 17:16:04 +01:00
Aliaksandr Kalenik
60bd5012fe LibJS: Optimize array destructuring assignment for builtin iterators
...by avoiding `{ value, done }` iterator result value allocation. This
change applies the same otimization 81b6a11 added for `for..in` and
`for..of`.

Makes following micro benchmark go 22% faster on my computer:
```js
function f() {
    const arr = [];
    for (let i = 0; i < 10_000_000; i++) {
        arr.push([i]);
    }
    let sum = 0;
    for (let [i] of arr) {
        sum += i;
    }
}

f();
```
2025-05-01 16:57:56 +03:00