1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-08 05:27:14 +09:00
Commit graph

69603 commits

Author SHA1 Message Date
Ruben
3263b629c6 LibWeb: Correct the calculation for right float intrusion
We used to subtract the maximum right margin of any containing box,
but we want to subtract the entire right margin instead. This yielded
incorrect intrusions for right floats not placed in the root.
2025-05-27 17:31:47 +02:00
Timothy Flynn
8e5cc74eb1 LibJS: Add notation to Intl.PluralRules
This is a normative change in the ECMA-402 spec. See:
a7ff535
2025-05-27 10:39:25 -04:00
Tim Ledbetter
b16f34767e LibWeb: Ensure discrete interpolated properties are non-transitionable
If a property is uses discrete interpolation and TransitionBehavior is
not set to `AllowDiscrete` that property should be non-transitionable.

This is now true for properties whose animation type is not discrete,
but the animation type falls back to discrete.
2025-05-27 13:33:29 +02:00
Jelle Raaijmakers
922bf2033f CI: Use Blacksmith's drop-in replacement for actions/cache
Their caches have better locality with their own runners and offer
higher potential throughput speeds (up to 400 MB/s).
2025-05-27 12:10:55 +02:00
Jelle Raaijmakers
090a7a90c3 CI: Switch over remaining runners to Blacksmith.sh
Everything that's not self-hosted or macOS is now pointing to
Blacksmith.sh. Nightly jobs and JS artifact builds use 8VCPU machines,
while regular integration builds & tests use 16VCPU machines.
2025-05-27 12:10:55 +02:00
Jelle Raaijmakers
8e9bf01917 CI: Rename os input to runner
This more clearly describes what the value is being used for, and avoids
some confusion between `os` and `os_name` in `lagom-template.yml`.
2025-05-27 12:10:55 +02:00
Jelle Raaijmakers
08b81b37b1 CI: Reindent inputs in lagom-template.yml 2025-05-27 12:10:55 +02:00
Jelle Raaijmakers
be766ecb30 CI: Switch over some workflows to Blacksmith.sh runners
The people over at Blacksmith.sh have generously offered usage of their
runners for our organization, so let's try to switch over some simple
workflows. The runners should be drop-in replacements.
2025-05-27 09:50:24 +02:00
Khaled Lakehal
9a071c9e89 LibWeb/HTML: Fix behavior when removing multiple from select element
This change ensures correct behavior when the `multiple` attribute is
removed from a `select` element, reducing the number of selected
`option` elements to one.

Fixes a failing WPT test:
https://wpt.live/html/semantics/forms/the-select-element/select-multiple.html
2025-05-27 18:58:31 +12:00
Shannon Booth
937994cfaa LibWeb: Make Environment's top level origin nullable
This matches the definition in the spec, and is also a step towards
removing the default constructor of URL::Origin.
2025-05-27 14:48:43 +12:00
Shannon Booth
556acd82ee LibWeb/Editing: Handle no active range in queryCommandState
Fixes a crash when this is invoked if no range is active for the
document.
2025-05-26 23:36:44 +02:00
Shannon Booth
7c7fec5e00 LibWeb/Editing: Pass normalized command name to editing AOs
As the internal algorithms perform case sensitive matching.
Fixes a crash in the included test, seen on gmail.com.
2025-05-26 23:36:44 +02:00
Rocco Corsi
70abe99bfd Tests: Add test for MimeType sniffing from filenames 2025-05-26 14:23:43 -06:00
Rocco Corsi
9281baffd8 LibCore: Recognize filenames .shellrc and CMakeLists.txt as text
There was a missing comma in the array, so these two entries were
concatenated accidentally.
2025-05-26 14:23:43 -06:00
Aliaksandr Kalenik
1647d7b34c LibJS: Use CallBuiltin for Math.tan() 2025-05-26 21:52:43 +02:00
Aliaksandr Kalenik
878cc16d7a LibJS: Use CallBuiltin for Math.cos() 2025-05-26 21:52:43 +02:00
Aliaksandr Kalenik
c02535e9f9 LibJS: Use CallBuiltin for Math.sin()
Improves performance on https://pierre.co/
2025-05-26 21:52:43 +02:00
Daniel Bertalan
04fac0031c AK: Add fast path for formatting common types
This commit changes `AK::TypeErasedParameter` to store integer,
floating-point and string types as well as characters and booleans
directly instead of through a type-erased `void const*`.

This is advantageous for binary size:
- The compiler no longer needs to push both the parameter value and a
  pointer to it to the stack (which contains the argument array);
  storing just the value is enough.
- Instead of instantiating `__format_value` for these types and taking
  its address (which generates a GOT entry and an ADRP+LDR pair in
  assembly), we just store a constant `TypeErasedParameter::Type` value.
- The biggest saving comes from the fact that we used to instantiate a
  distinct `__format_value` for each length of string literal. For
  LibJS, this meant 69 different functions! We can now just store them
  as a `char const*`.

I opted to use a manual tagged union instead of `Variant`: the code
wouldn't be much shorter if we used a `Variant` since we'd have to
handle converting the standard integer types to `u64`/`i64` and custom
types to the type erased wrapper via explicit constructors anyway. And
compile time overhead is smaller this way.

This gives us some nice binary size savings (numbers are from arm64
macOS LibJS):

     FILE SIZE        VM SIZE
  --------------  --------------
    +52% +10.3Ki   +52% +10.3Ki    [__TEXT]
   +5.2%    +768  +5.2%    +768    [__DATA_CONST]
   -0.0%      -7  -0.0%      -7    __TEXT,__cstring
   -3.0%    -144  -3.0%    -144    __TEXT,__stubs
   -1.2%    -176  -1.2%    -176    Function Start Addresses
  -11.6%    -432 -11.6%    -432    Indirect Symbol Table
   -1.0%    -448  -1.0%    -448    Code Signature
  -18.1%    -768 -18.1%    -768    __DATA_CONST,__got
   -0.8% -6.83Ki  -0.8% -6.83Ki    Symbol Table
   -1.0% -11.2Ki  -1.0% -11.2Ki    String Table
   -0.9% -26.1Ki  -0.9% -26.1Ki    __TEXT,__text
   -7.2% -20.9Ki  -9.6% -28.9Ki    [__LINKEDIT]
   -1.0% -56.0Ki  -1.1% -64.0Ki    TOTAL
2025-05-26 13:02:39 -06:00
Daniel Bertalan
9aaa4fd022 AK: Remove the formatter for unsigned char[N]
This is not used anywhere and its semantics are questionable.
2025-05-26 13:02:39 -06:00
blukai
3ab50be36a LibGfx: Improve logical separation of font_directories' ifdefs
in addition to what was proposed in
https://github.com/LadybirdBrowser/ladybird/pull/4830#discussion_r2101301978
2025-05-26 12:14:29 -06:00
blukai
e356a4bd01 LibGfx: Rely on fontconfig(if enabled) for font directory resolution
this commit also introduces GlobalFontConfig class that is now
responsible for fontconfig initialization. it seems sane, even thought
FcInit's docs state that if the default configuration has already been
loaded, this routine does nothing.
2025-05-26 12:14:29 -06:00
blukai
4b3691ff39 LibCore+LibGfx: Move font_directories from LibCore to LibGfx
the goal is to rely on fontconfig for font directory resolution. it
doesn't seem like it would be appropritate to call to fontconfig funcs
from within the LibCore.

i'm not 100% confident that FontDatabase is the correct place.. seems
okay?
2025-05-26 12:14:29 -06:00
blukai
6e00a38099 LibGfx: Enable otf fonts 2025-05-26 12:14:29 -06:00
Andreas Kling
ce33376b56 LibWeb: Make SVGGradientPaintStyle be atomically ref-counted
This was the only remaining data type used in display lists that wasn't
atomically ref-counted.

Now that it is, we no longer crash when scrolling on https://vercel.com/
2025-05-26 19:46:05 +02:00
Manuel Zahariev
addff9e35d LibJS: Unit tests for non-standard date formats 2025-05-26 18:48:09 +02:00
Manuel Zahariev
973110c046 LibJS: Convert date_parse_string to use DateParser 2025-05-26 18:48:09 +02:00
Manuel Zahariev
8263e7fa51 LibJS: DateParser for simplified ISO8601 and non-standard date strings 2025-05-26 18:48:09 +02:00
Manuel Zahariev
666c323577 AK/Error: Add value_or convenience method
- In the style of Optional::value_or
- Only const& flavor
- WARNING: no unit test (no unit tests for Error), but seems benign
2025-05-26 18:48:09 +02:00
Jelle Raaijmakers
47e1aa054b CI: Use explicit run IDs to download JS binary and call webhook
When we try to retrieve benchmark results in the webhook call, we cannot
use the `head_sha` parameter since the workflow run might have a
different `head_sha` associated with it than the upstream workflow run.
This can happen when the JS repl binary workflow runs, a new commit is
pushed to master, followed by a JS benchmarks workflow run causing this
latter run to be associated with a different commit ID.

This extends the webhook payload to include the current run ID, which
can eventually be used by the webhook script to specifically download
the benchmark results associated with the current run.

Additionally, this changes the JS artifact download to use the upstream
run ID which seems nicer to do anyway.
2025-05-26 17:18:40 +02:00
Luke Wilde
89762e2ff3 LibWeb/WebGL: Free back buffer texture when context is destroyed 2025-05-26 17:16:42 +03:00
Luke Wilde
38713d7c14 LibWeb/WebGL: Return vertex shader from Program::attached_vertex_shader 2025-05-26 17:16:42 +03:00
Aliaksandr Kalenik
dcfc515cd0 LibJS: Fix arrow function parsing bug
In the following example:
```js
const f = (i) => ({
    obj: { a: { x: i }, b: { x: i } },
    g: () => {},
});
```

The body of function `f` is initially parsed as an arrow function. As a
result, what is actually an object expression is interpreted as a formal
parameter with a binding pattern. Since duplicate identifiers are not
allowed in this context (`i` in the example), the parser generates an
error, causing the entire script to fail parsing.

This change ignores the "Duplicate parameter names in bindings" error
during arrow function parameter parsing, allowing the parser to continue
and recognize the object expression of the outer arrow function with an
implicit return.

Fixes error on https://chat.openai.com/
2025-05-26 12:44:21 +03:00
Chris Mulder
09463f147d LibWeb: Do not clear the selection, when query is not found
Fixes #4743
2025-05-26 11:22:48 +02:00
Timothy Flynn
ad4634d0ed LibMedia: Use a simple locked vector to handle audio commands on macOS
The SharedSingleProducerCircularQueue used here has dubious value, This
queue is used to pass commands to the audio thread, such as play/pause/
seek/volume change/etc. We can make do with a simple locked vector, as
we were blocking to enqueue tasks anyways. We can also use an atomic
bool to tell the audio thread when it needs to take a lock on the task
queue, to keep the thread lock-free most of the time.
2025-05-25 08:45:50 -04:00
Shannon Booth
172556db74 LibWeb/HTML: Don't log FIXME messages for location.ancestorOrigins
This is quite a frequent FIXME log on quite a few sites which
does not serve much value at this stage. So instead of marking it
with a FIXME extended IDL attribute, let's just comment it out.
2025-05-25 08:45:30 -04:00
Andrew Kaster
8095663f86 LibIPC: Chunk sent file descriptors by MAX_TRANSFER_FDS
This limitation of the underlying Unix socket implementation can
cause IPC failures on pages with tons of images and network requests.

Modify the code called from TransportSocket's send thread to limit the
number of fds to MAX_TRANSFER_FDS, and ensure that we will keep sending
as long as we have either bytes or file descriptors to send.
2025-05-24 19:15:06 +03:00
Andrew Kaster
87fbfcadd1 LibIPC: Refactor message header encoding to use a helper method
Manually memcpying into a Vector in the body of post_message is
a bit much.
2025-05-24 19:15:06 +03:00
Andrew Kaster
087cbf2b0a LibCore: Expose Unix socket fd transfer limit publicly 2025-05-24 19:15:06 +03:00
Shannon Booth
8ccb89877a LibWeb/HTML: Return an opaque origin for data URLs for Workers 2025-05-24 09:51:44 -04:00
Shannon Booth
9aabe88795 WebWorker: Ensure global object has URL set before fetching
As explained by the comment in the code. I believe this to be a
spec issue, which I will report.
2025-05-24 09:51:44 -04:00
Shannon Booth
40d21e343f LibURL: Add FIXME's for testing equality of opaque origins
The spec seems to indicate in its wording that while opaque
origins only serialize to 'null', they can still be tested
for equality with one another. Probably we will need to
generate some unique ID which is unique across processes.
2025-05-24 09:51:44 -04:00
Aliaksandr Kalenik
ceaeea3c26 RequestServer: Use write notifier instead of busy waiting for socket
...to become writable.

Solves triangular deadlock problem that happened in the following case
(copied from https://github.com/LadybirdBrowser/ladybird/issues/1816):
- The WebContent process is spinning on
   `send_sync_but_allow_failure` waiting for the UI process to respond
- The UI process is spinning on `send_sync_but_allow_failure`, waiting
   for RequestServer to respond
- RequestServer is stuck in this loop, trying to write to the
  WebContent's socket file (when I attach to RS, we are always in the
  sched_yield call, so we're spinning on EAGAIN).

For me the issue was reliably reproducible on Google Maps and with this
change we no longer deadlock there.
2025-05-24 16:28:48 +03:00
Timothy Flynn
522d13b0fb Revert "Meta: Update skia to version 134"
This reverts commit 51d189198d.

This neglected to update the overlay port, thus had no effect.
2025-05-24 06:55:15 -06:00
Andrew Kaster
228211205a LibCore: Atomically ref-count SharedSingleProducerCircularQueue guts
This fixes two race conditions and ASAN crashes in the test for the
same.

The first comes from destroying the internals struct, which was
previously using the standard, thread-unsafe RefCounted CRTP. The
second is from destroying the name, which is secretly another
RefCounted object, in a thread-unsafe manner.
2025-05-24 06:52:25 -06:00
Sam Atkins
f5cd853597 LibWeb/CSS: Avoid calling to_font_weight() when serializing font
This function attempts to resolve `lighter` and `bolder`, which we don't
want to do when serializing - that should happen in style computation.

This has the unexpected bonus of 37 more WPT passes!
2025-05-24 13:35:30 +01:00
Gingeh
3fe148f2d4 LibWeb: Implement the :default pseudo-class 2025-05-24 10:31:34 +01:00
Gingeh
7acc0f4a42 LibWeb: Implement :required/:optional pseudo-classes 2025-05-24 10:31:34 +01:00
Timothy Flynn
fbd1f77161 LibWeb: Disentangle both ends of a MessagePort at once
Otherwise, the remote end believes it is still entangled and may try to
access its own (now null) remote port. This fixes a crash in WPT.
2025-05-24 10:47:06 +12:00
Sam Atkins
ea44a1c2c7 LibWeb/CSS: Don't treat "-foo" as vendor-prefixed
To be vendor-prefixed, an ident has to start with a '-', then have
another '-' later. If the ident simply starts with a '-' then that's
perfectly fine.

Fixes 62 in-tree WPT subtests. :^)
2025-05-23 19:39:23 +01:00
Sam Atkins
f5825ab18c LibWeb/CSS: Stop erasing font-variant-css2 value in font shorthand
We don't want to reset the values of `font-variant-*` here, as that will
override whatever our parsed font-variant-css2 was, so stop doing that.

Also, font-stretch is mentioned in the spec, but it's a legacy name
alias for font-width, so we don't need to do anything for it.

Gets us 319 WPT passes!
2025-05-23 19:39:23 +01:00