Commit graph

70447 commits

Author SHA1 Message Date
Veeti Paananen
c834c594ac LibWeb: Set correct content and document types in DOMParser
It appears this was removed by accident in an earlier commit, regressing
the included WPT test.
2025-07-09 20:10:11 +12:00
Aliaksandr Kalenik
bfa978c501 LibWeb: Remove unnecessary save/restore generated for stacking context
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
2025-07-08 23:54:35 +02:00
Aliaksandr Kalenik
8d9920af16 LibWeb: Account for natural aspect ratio in calculate_min_content_height
By the time we calculate the min-content height, the width is already
known, so we can use it to calculate the height based on the natural
aspect ratio.
2025-07-08 22:35:04 +02:00
Andrew Kaster
44d2e22b93 CMake: Add a flatpak build for org.ladybird.Ladybird
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This build depends on the KDE Flatpak SDK, and builds any missing
dependencies manually as source modules.

The flatpak can be built with the following command:

```sh
flatpak-builder --user --force-clean --install-deps-from=flathub \
    --ccache --repo=Build/repo --install Build/flatpak \
    Meta/CMake/flatpak/org.ladybird.Ladybird.json
```

After building, the flatpak can be run with:

```sh
flatpak run --user --devel org.ladybird.Ladybird
```

If there are issues launching RequestServer, the .pid and .sock files
under $XDG_RUNTIME_DIR may need removed.

```sh
flatpak run --user --command=sh --devel org.ladybird.Ladybird
rm -f $XDG_RUNTIME_DIR/Ladybird.*
```
2025-07-08 11:45:32 -06:00
Andrew Kaster
204e787131 CMake: Add service, desktop, and icon files for Linux-like systems
These files are lifted from the ladybird-gtk4 repository and adapted
to work with the Qt UI port. They are installed by default on Linux, but
can be installed via a CMake option on other platforms.

Co-Authored-By: Sergey Bugaev <bugaevc@serenityos.org>
Co-Authored-By: Nicolas Ramz <nicolas.ramz@adevinta.com>
Co-Authored-By: Beckett Normington <beckett@b0ba.dev>
Co-Authored-By: Xexxa <93391300+Xexxa@users.noreply.github.com>
2025-07-08 11:45:32 -06:00
Sam Atkins
69d4811ef7 LibWeb: Generate logical property mappings
To support this, how we declare logical property aliases has changed.
Instead of `logical-alias-for` being a list of properties, it's now an
object with a `group` and `mapping`. The group is the name of a logical
property group in LogicalPropertyGroups.json. The mapping is which
side/dimension/corner this property is. Hopefully it's self-explanatory
enough.

The generated code is very much a copy of what was previously in
`StyleComputer::map_logical_alias_to_physical_property_id()`, so there
should be no behaviour change.
2025-07-08 11:45:15 -06:00
Andrew Kaster
4c48a51860 Tests: Disable TestTLSHandshake on Windows
This test can't find the default certs on Windows.
2025-07-08 10:27:05 -06:00
Callum Law
36e2d25efa LibWeb: Parse grid track placements closer to spec
This brings parsing of grid-row-* and grid-column-* properties (and
their associated shorthands) more inline with spec.

Changes:
- Only set omitted properties for combined-value shorthands (e.g.
  `grid-row: a` rather than `grid-row: a / b`) if the single value is
  `<custom-ident>`.

- `[ [ <integer [-∞,-1]> | <integer [1,∞]> ] && <custom-ident>? ]`:
  - Properly resolve `calc`s for `<integer>` that rely on compute-time
    information.

- `[ span && [ <integer [1,∞]> || <custom-ident> ] ]`
  - Allow `calc`s for `<integer>`
  - Allow `<custom-ident>`

There is still work to be done to properly use these parsed values.

Gains us 46 WPT tests.
2025-07-08 17:26:16 +01:00
Sam Atkins
a424a06d45 LibWeb/DOM: Copy document's allow declarative shadow roots when cloning
Corresponds to 77920094a4
2025-07-08 17:08:39 +01:00
Sam Atkins
5c365884dd LibWeb/HTML: Update HTMLScriptElement.idl to match current spec
Corresponds to e21d9ff0d6

As far as I can tell, none of the rest of this change requires
modifications on our end.
2025-07-08 17:08:39 +01:00
Sam Atkins
0cfa243baa LibWeb/HTML: Update "create policy container from fetch response" spec
Corresponds to 83cc45b9c5
2025-07-08 17:08:39 +01:00
Sam Atkins
0d34f70d95 LibWeb/HTML: Queue a task to resolve createImageBitmap
Corresponds to e288a0efe5
2025-07-08 17:08:39 +01:00
Sam Atkins
df2b2d2c14 LibWeb/HTML: Fix return value checking for unload cancellation
Corresponds to 4467ddf323
2025-07-08 17:08:39 +01:00
Sam Atkins
91e8a19391 LibWeb: Always set [[ErrorToRethrow]] for import validation errors
Corresponds to f6fb04a11f
2025-07-08 17:08:39 +01:00
Sam Atkins
4e854ca44a LibWeb/HTML: Provide a fallback for validation anchor
Corresponds to daa3016b40

Also import a related test.
2025-07-08 17:08:39 +01:00
Sam Atkins
da8a29376f LibWeb: Use ThrowCompletion AO to create throw completions
Corresponds to 4989b3457f
2025-07-08 17:08:39 +01:00
Sam Atkins
b05fe0127b LibWeb/HTML: Allow more characters in custom element names
Corresponds to 78d2678789

And import a related test.
2025-07-08 17:08:39 +01:00
Sam Atkins
af17f38bbf LibWeb/HTML: Implement and use "optional value"
Corresponds to f3444c23ff

Also import a test.
2025-07-08 17:08:39 +01:00
Sam Atkins
22cc36eeaa LibWeb/HTML: Replace "zero" with "0" in some places
Corresponds to 706b986010
2025-07-08 17:08:39 +01:00
Sam Atkins
e74afec9c5 LibWeb: Capitalize "No Popover state" consistently
Corresponds partly to 8035a256bf
2025-07-08 17:08:39 +01:00
Sam Atkins
31b302fc73 WebContent: Include pseudo-elements and custom properties in styles dump
Pseudo elements are only dumped if they have computed style.

Custom properties are only dumped on their originating element, because
of how we currently store them.
2025-07-08 16:49:22 +01:00
Timothy Flynn
8cec9e7557 LibJS+LibUnicode: Remove unused FormatNumericToString AO 2025-07-08 11:19:27 -04:00
Jelle Raaijmakers
b019633558 Meta: Disable clang-tidy's const correctness checks
Using `const` should not be warned about everywhere if it does not have
a clear advantages. Compilers are able to deduce constness in most cases
and on top of that, it's generally accepted that using `const`
communicates developer intent above all else.
2025-07-08 11:04:15 -04:00
Jelle Raaijmakers
e96fd53eda Revert "LibWebView: Add Arial Unicode MS to the list of Sans Serif (...)
(...) fallbacks"

This reverts commit 9e7b40747f. This
caused most bold headings to display as regular headings, since Arial
Unicode MS does not support other styles (as opposed to Arial).

We need a better font selection algorithm to properly support selecting
fonts for specific glyphs. Issue #2332 exists to keep track of
supporting less frequently used glyphs.
2025-07-08 09:17:32 -04:00
Jelle Raaijmakers
ead0a2c78a Everywhere: Rename serenity_main to ladybird_main
No functional changes.
2025-07-08 09:17:16 -04:00
Timothy Flynn
af671f58ed LibCore: Revert change to simplify tracking of notifers and poll structs
The issue with that refactor was that the same fd can be used in more
than one notifier. This reverts us back to using 2 members to track the
notifiers in play.
2025-07-08 13:53:27 +01:00
Sam Atkins
b711b01f76 LibWeb/CSS: Remove comment that free space is distributed
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Corresponds to 24c1b60e9a
2025-07-08 10:24:49 +01:00
Sam Atkins
d9aeffa302 LibWeb/CSS: Adjust grammar definitions
Corresponds to:
e2903b127e
1b4ea44fc8
2025-07-08 10:24:49 +01:00
Aliaksandr Kalenik
b87e01e304 LibWeb: Skip recording display list items with color.alpha() == 0
Cuts display list size, mostly because now we avoid lots of FillRect
previusly recorded for boxes with transparent background.

Website      | DisplayList Items Before | DisplayList Items After
-------------|--------------------------|-------------------------
ladybird.org | 1431                     | 1117
null.com     | 4714                     | 4484
discord.com  | 5360                     | 4992
2025-07-08 10:24:11 +02:00
Aliaksandr Kalenik
46097c6753 LibWeb: Avoid unnecessary save/restore in paint_background()
`paint_background()` is invoked for each PaintableBox, so by avoiding
save/restore pair emitted for each call, we substantially decrease
display list size.

Website      | DisplayList Items Before | DisplayList Items After
-------------|--------------------------|-------------------------
ladybird.org | 2753                     | 1431
null.com     | 5298                     | 4714
discord.com  | 6598                     | 5360
2025-07-08 10:24:11 +02:00
Andrew Kaster
62c5f4b822 CMake: Remove unconditional Qt linkage from WebContent and WebWorker
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
WebContent only needs it when using QtMultimedia for audio playback, and
WebWorker never needs it.
2025-07-07 15:53:15 -06:00
Timothy Flynn
a9f7579738 LibCore: Awaken read notifiers when we receive POLLHUP events
POLLHUP is set when the remote end of the monitored fd is closed. There
may still be some buffered data to read from the socket, however. Some
systems do not set POLLIN in these cases. So we should just always try
to read from fds when we receive this event.
2025-07-07 15:53:15 -06:00
Timothy Flynn
f46b721c57 LibCore: Always reset the polled revents field back to 0
One benefit of using `poll` over `select` is that we can re-use the poll
structure list. But there's no guarantee that the underlying system will
reset the `revents` field back to 0. So let's explicitly do so.
2025-07-07 15:53:15 -06:00
Timothy Flynn
0499d216b8 LibCore: Simplify tracking of notifiers and poll structures
We don't need 2 vectors and a hash map to track these structures. We can
store the poll structures in a list and just track notifiers by the fd.
2025-07-07 15:53:15 -06:00
Andrew Kaster
6264d303af RequestServer: Simplify library creation for implementation library
Using ladybird_lib() adds all sorts of extra goodies to the target, such
as installation, soname setting, a custom target name, adding lagom- to
the name of the library, etc. All we need for this impl lib is the
generated sources support, so move to a bare add_library() call instead.

The previous call was also wrong, and always created liblagom-TYPE.so.
2025-07-07 15:49:32 -06:00
Aliaksandr Kalenik
9ac685b948 LibWeb: Remove unnecessary const_cast in ViewportPaintable 2025-07-07 22:04:25 +02:00
Aliaksandr Kalenik
5a874cc62a LibWeb: Remove ClippableAndScrollable mixin
Initially ClippableAndScrollable was introduced, because we had
PaintableBox and InlinePaintable and both wanted to share clipping and
scrolling logic. Now, when InlinePaintable is gone, we could inline
ClippableAndScrollable implementation into PaintableBox.
2025-07-07 22:04:25 +02:00
Shannon Booth
d5e41f1f72 LibWeb: Handle null namespace in prefix map serializing XML
A "namespace prefix map", see:

https://w3c.github.io/DOM-Parsing/#the-namespace-prefix-map

Is meant to also hold null namespaces:

> where namespaceURI values are the map's unique keys
> (which can include the null value representing no namespace)

Which we previously neglected. This resulted in a crash for
the updated WPT test.
2025-07-07 20:24:47 +01:00
Shannon Booth
8bd43f2cb9 AK: Add hash traits for Optional<T>
To enable storing it in a hashmap. 13 is a somewhat arbitrary
value, something like 0 is not appropriate since a lot of types
return 0 as a hash for an invalid / empty state.
2025-07-07 20:24:47 +01:00
edvwib
8ca956e6f1 LibWeb: Implement 'no-validate state' concept 2025-07-07 20:12:11 +01:00
Aliaksandr Kalenik
edfae02680 LibWeb: Make apply{clear}_clip_overflow_rect non-virtual
Some checks are pending
Push notes / build (push) Waiting to run
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
2025-07-07 18:55:30 +02:00
Aliaksandr Kalenik
c0526b085d LibWeb: Make apply_scroll_offset and reset_scroll_offset non-virtual 2025-07-07 18:55:30 +02:00
Aliaksandr Kalenik
773d19b406 LibWeb: Apply either enclosing or own clip rect depending on PaintPhase
Previously, we always applied the enclosing clip rectangle for all paint
phases except overlays, and the own clip rectangle for the background
and foreground phases. The problem is that applying a clip rectangle
means emitting an AddClipRect display list item for each clip rectangle
in the containing block. With this change, we choose whether to include
the own clip based on the paint phase and this way avoid emitting
AddClipRect for enclosing clip rectangles twice.
2025-07-07 18:55:30 +02:00
Luke Wilde
05ee3f1876 RequestServer: Wait until initial connection is open for multiplexing
By default, if multiple requests start to a newly seen origin, curl
will not wait for a connection to open to figure out if the server
supports multiplexing and will instead open a new connection for each
request (including a new TLS session and such)

This is particularly an issue for initial page load, where a complex
website could, for example, request tens of items at once (e.g. a bunch
of scripts).

We can be kinder to servers that support multiplexing by telling curl
to wait till an initial connection is established to determine if
multiplexing is supported.

On my machine and internet connection, this reduces the amount of
connections to github.githubassets.com on initial load of
https://github.com/LadybirdBrowser/ladybird from 12 to 2.
2025-07-07 14:11:26 +02:00
Tim Ledbetter
6ef96ba170 Revert "Tests: Replace background-near-zero-svg test with WPT import"
The unmodified test is flaky on CI.

This reverts commit 8fce09f521.
2025-07-07 06:53:21 -04:00
Shannon Booth
e6235210ff LibURL: Convert to scalar string before URL parsing
URL parsing is expected to take place on well formed unicode
strings.
2025-07-07 06:50:57 -04:00
Andrew Kaster
ad1938086d AK: Add missing find_package command for fast_float
This was missed in 62d9a84b8d
2025-07-07 06:47:06 -04:00
Andrew Kaster
5523158b95 CMake: Install files for fonts, internal, about-settings on non-macOS
The corresponding install commands were missed when these file groups
were added.
2025-07-07 06:47:06 -04:00
Andrew Kaster
5878715889 CMake: Set SKCMS_API to default visibility for non-vcpkg skia as well 2025-07-07 06:47:06 -04:00
Andrew Kaster
9df7eb2e1b LibWeb: Support linking custom-built ANGLE libraries not from vcpkg
This is a similar approach to what we're using for skia.
2025-07-07 06:47:06 -04:00