Commit graph

70371 commits

Author SHA1 Message Date
Andrew Kaster
870915b594 Devcontainer: Set dynamic triplets for vcpkg cache feature
This ensures that when we set an overlay port directory for building
the vcpkg cache, we set the default (and host) triplet to match the
triplet files we have in each directory.
2025-07-16 08:36:50 +02:00
Andrew Kaster
0b854ed8eb Devcontainer: Enable vcpkg asset cache for vcpkg cache feature
This enables our vcpkg asset cache in the devcontainer setup, protecting
CI jobs against flaky upstream tarball downloads.
2025-07-16 08:36:50 +02:00
Jelle Raaijmakers
616a2af23d Tests: Enable screenshot tests on arm64
Of the available 71 screenshot tests that we have, 42 fail on macOS
arm64. Let's make it possible to skip those and run the remaining
succeeding screenshot tests on arm64 anyway.
2025-07-16 08:36:14 +02:00
Callum Law
a1c9b86ad3 LibWeb: Account for non-shorthand sub-properties when serializing border
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, 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
When parsing values in `process_a_keyframes_argument` we don't expand
properties using `StyleComputer::for_each_property_expanding_shorthands`
unlike most other places - this means that if we parse a `border` we end
up with the `border`'s sub-properties (`border-width`, `border-style`,
`border-color`) still in their unexpanded forms (`CSSKeywordValue`,
`LengthStyleValue`, `StyleValueList`, etc) rather than
`ShorthandStyleValue`s which causes a crash when serializing the
`border` value in `KeyframeEffect::get_keyframes`.

The proper fix here is to parse `border`'s sub-properties directly to
`ShorthandStyleValue`s instead of relying on
`StyleComputer::for_each_property_expanding_shorthand` to do this
conversion for us but this may be a while off.

This commit also imports the previously crashing tests.
2025-07-16 06:49:38 +01:00
Aliaksandr Kalenik
52e9dcd911 LibWeb: Assign new m_viewport_size before resizing backing store
Fixes bug when `resize_backing_stores_if_needed()` picks up previous
viewport size for allocation of new backing stores.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/5336
2025-07-15 18:39:01 -04:00
Aliaksandr Kalenik
6ddc582551 LibWeb: Delete unreachable code in Node::invalidate_style()
`if (invalidation_set.needs_invalidate_whole_subtree())` branch in the
end of the function was always false.
2025-07-15 18:31:43 -04:00
Andrew Kaster
c1ece2b4ed Meta: Clean up flatpak manifest and remove most linter warnings
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Build Dev Container Image / build (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
We now clean up installed helper tools, includes from dependencies, and
pkgconfig/CMake files. This decreases the size of the flatpak from
~206MiB to ~150 MiB on my machine.

The manifest is also mostly clean of linter warnings from the
flatpack-builder manifest linter, with the exception of the overly broad
session bus policy.

The docs at https://docs.flathub.org/docs/for-app-authors/linter list a
method for selecting the correct session bus policies, but it is unclear
how to actually get the full set.
2025-07-15 14:16:42 -06:00
Undefine
9d26caf0d5 Documentation: Add build instructions for FreeBSD 2025-07-15 13:44:54 -06:00
Undefine
060e8518b4 Meta: Workaround CMAKE_LINKER_TYPE being broken on FreeBSD
https://gitlab.kitware.com/cmake/cmake/-/issues/27037
2025-07-15 13:44:54 -06:00
Undefine
2aa8c950ca LibCore+Meta: Workaround some symbols not being exported on FreeBSD
On FreeBSD some symbols like `environ` or `__progname` are not exported
anywhere and are filled in by the dynamic loader. `environ` is
a special case because we make use of it explicitly so we need to mark
it a weak symbol so the linker doesn't complain.
2025-07-15 13:44:54 -06:00
Undefine
3056e54cd0 Meta: Update ffmpeg
This is update contains fixes for the FreeBSD build
2025-07-15 13:44:54 -06:00
Undefine
1a42fc4fcd Meta: Patch angle vcpkg to build on FreeBSD 2025-07-15 13:44:54 -06:00
Undefine
6645e4efbb Meta: Build QT with vcpkg on FreeBSD
This is a workaround for the fact that on FreeBSD the system icu has
symbol renaming disabled which causes our build to clash with the
expectations of the system QT.
2025-07-15 13:44:54 -06:00
Undefine
f51f067f23 Meta: Don't build libproxy on FreeBSD
The build for it is broken on FreeBSD and doesn't seem to be needed
anyways.
2025-07-15 13:44:54 -06:00
Undefine
f0cdf0e9b5 Meta: Fix building skia on FreeBSD 2025-07-15 13:44:54 -06:00
Undefine
515a94c49d Meta: Update vcpkg baseline 2025-07-15 13:44:54 -06:00
Undefine
48403eab21 Meta: Add vcpkg triplets for FreeBSD 2025-07-15 13:44:54 -06:00
Sam Atkins
632ce9523b LibWeb/CSS: Add :unchecked pseudo-class
This just got added to the Selectors spec:

b78c97c19d

It's thus missing from the HTML spec and WPT, but I figured it was
simple enough to add.
2025-07-15 21:27:44 +02:00
Sam Atkins
b973c8d275 LibWeb/CSS: Remove the :target-within pseudo-class
This has been removed from the spec:

03b340c34f
2025-07-15 21:27:44 +02:00
Luke Wilde
d9cb8185cc LibWeb: Include submitter name and value when constructing FormData
This fixes the SSO buttons on OpenAI's login page giving "Unknown
error"
2025-07-15 20:49:39 +02:00
Jelle Raaijmakers
144eac44fb LibGfx: Remove Font::pixel_size_rounded_up()
The remaining callsites were removed in the previous commit.
2025-07-15 19:05:36 +01:00
Jelle Raaijmakers
788d5368a7 LibWeb: Improve list item marker positioning and alpha/roman text
This commit is a three-parter that is hard to separate without breaking
marker rendering:

  1. Any marker style that results in a string, except for a literal
     string (e.g. `list-style-type: "@"`), should get the string ". "
     appended. We forgot to do this for the alpha and roman types.

  2. Instead of using the "pixel size rounded up" from a font and adding
     an arbitrary 1 to that, we now use the exact pixel size for as long
     as possible to improve our vertical positioning of markers.

  3. Instead of always adding a "default marker width" to the marker
     content width, we now only do this if we did not have text metrics
     available (i.e. the marker style is not a text type). This greatly
     improves horizontal positioning of text markers.
2025-07-15 19:05:36 +01:00
Aliaksandr Kalenik
8142c311ec LibWeb: Reset document's cursor blink timer after selection change
For contenteditable `Selection` in collapsed state represents cursor
position, so whenever it's update, we should also reset the blink timer.

Fixes bug on Discord when cursor is blinking while it is being moved by
pressing arrow keys.
2025-07-15 17:25:02 +01:00
Tim Ledbetter
e26d848dde Meta: Exit gracefully when importing multiple WPT tests is interrupted 2025-07-15 18:10:07 +02:00
Tim Ledbetter
d6f419af53 Meta: Add --wpt-base-url option to the WPT importer
This allows files to be downloaded locally by first running:
`./Meta/WPT.sh serve` then importing with
`--wpt-base-url http://web-platform.test:8000`.
2025-07-15 18:10:07 +02:00
Aliaksandr Kalenik
9b9acf0bd5 LibWeb: Delete schedule_style_update() and schedule_layout_update()
Both functions schedule HTML event loop processing but that's
unnecessary, because we schedule a rendering task that checks if
style/layout needs an update 60/s anyway.
2025-07-15 16:57:35 +02:00
Callum Law
93f957051a LibWeb: Handle serialization of invalid border in all contexts
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, 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
Previously as we handled this in `get_property_internal` there were some
contexts that we missed, for instance `CSSStyleProperties::serialized`.
2025-07-15 14:26:02 +01:00
Callum Law
927cd969b2 LibWeb: Generically serialize "positional-value-list-shorthand"s
We were previously handling this ad-hoc via logic in
`get_property_internal` but this didn't cover all contexts (for
instance `CSSStyleProperties::serialized`.

Gains us 9 more WPT tests as we now cover properties which weren't
included in the previous ad-hoc approach.
2025-07-15 14:26:02 +01:00
Callum Law
9ed85ddd63 LibWeb: Mark relevant properties as "positional-value-list-shorthands"
Some shorthand properties work differently to normal in that mapping of
provided values to longhands isn't necessarily 1-to-1 and depends on the
number of values provided, for example `margin`, `border-width`, `gap`,
etc.

These properties have distinct behaviors in how they are parsed and
serialized, having them marked allows us to implement theses behaviors
in a generic way.

No functionality changes.
2025-07-15 14:26:02 +01:00
Callum Law
48153ecf45 LibWeb: Remove duplicate logic for white-space special keywords
This is already handled in `ShorthandStyleValue::to_string`.

No functionality change.
2025-07-15 14:26:02 +01:00
Callum Law
09a5c04e5c LibWeb: Handle serialization of invalid font-variant in all contexts
Previously as we handled this in `get_property_internal` there were some
contexts that we missed, for instance `CSSStyleProperties::serialized`.
2025-07-15 14:26:02 +01:00
Luke Wilde
d08d6b08d3 LibWeb: Use enum for serialization and reimplement interface exposure
Our currently implementation of structured serialization has a design
flaw, where if the serialized/transferred type was not used in the
destination realm, it would not be seen as exposed and thus we would
not re-create the type on the other side.

This is very common, for example, transferring a MessagePort to a just
inserted iframe, or the just inserted iframe transferring a MessagePort
to it's parent. This is what Google reCAPTCHA does.

This flaw occurred due to relying on lazily populated HashMaps of
constructors, namespaces and interfaces. This commit changes it so that
per-type "is exposed" implementations are generated.

Since it no longer relies on interface name strings, this commit
changes serializable types to indicate their type with an enum,
in line with how transferrable types indicate their type.

This makes Google reCAPTCHA work on https://www.google.com/recaptcha/api2/demo
It currently doesn't work on non-Google origins due to a separate
same-origin policy bug.
2025-07-15 09:20:02 -04:00
Luke Wilde
d6b9bd306c LibWeb: Don't read from MessagePort transport if it's not entangled
If the MessagePort is not entangled, then m_transport is null, meaning
it's not valid to read from the transport.

This fixes the cross-piping streams WPT crash test crashing in the
upcoming commit.
2025-07-15 09:20:02 -04:00
Luke Wilde
cb1c388ee3 Generators/Interfaces: Refactor separate interface Vectors into a struct 2025-07-15 09:20:02 -04:00
Undefine
c60e3fb445 Meta: Fix the angle version
The version in the angle portfile, angle vcpkg and ladybird vcpkg was
not the same.
2025-07-15 14:10:30 +01:00
Shannon Booth
9054ff29f0 LibWeb/CSS: Parse the ::slotted pseudo-element 2025-07-15 13:54:17 +01:00
Shannon Booth
0151a088ad LibWeb/CSS: Fix missing ':' in debug logging for pt-name-selector 2025-07-15 13:54:17 +01:00
Shannon Booth
15657ec4c3 LibWeb: Include or declare missing definitions for PseudoElement.h
clangd was loudly complaining about this file.
2025-07-15 13:54:17 +01:00
Jelle Raaijmakers
b56d4e9bab Tests: Rebaseline Layout/input/table/th-default-text-align.html
Needed after edca2ab666.
2025-07-15 11:21:14 +02:00
Sam Atkins
b3abbeab89 LibWeb/CSS: Support inherit custom properties on :root
Make sure we have a parent element before trying to look at it!

I've also pulled out a stub function for getting a custom property's
initial value, so that there's only one place to change once we support
`@property` more.
2025-07-15 10:36:08 +02:00
Jelle Raaijmakers
edca2ab666 LibWeb: Do not create an anonymous container for table cells by default
We were always creating an anonymous container for the inline contents
of table cells, but the layout node we spawn for the table cells
themselves already is capable of dealing with inline nodes. Regular
logic should kick in for dealing with the block/inline node invariant.
2025-07-15 10:06:36 +02:00
Andreas Kling
a4fb21308d LibWeb: Don't add range data for FontCascadeList with no Unicode ranges
This fixes a bunch of WPT crashes in /html/canvas/offscreen/text/
2025-07-15 10:06:10 +02:00
Jelle Raaijmakers
9f7447f546 LibWeb: Prioritize inheriting text-align for <th>
Because we defined `th { text-align: center }` in our UA stylesheet, it
received a higher precedence than inherited (inline) styles. Firefox
deals with this by defining a custom `text-align` value that prioritizes
any inherited value before defaulting to `text-align: center`.

We now do this as well :^)
2025-07-15 10:05:48 +02:00
Tim Ledbetter
d1678e03ff LibWeb: Check parent node exists before checking its type 2025-07-15 18:37:50 +12:00
InvalidUsernameException
8002efe780 LibWeb: Don't distort replaced elements with natural size in flex layout
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, 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
When layouting a replaced element with natural width and height (e.g. a
raster graphic), the replaced element would correctly end up with its
natural size in the main-axis dimension. For the cross axis dimension
however, the replaced element was stretched or squished to the flex
containers inner cross size, which is wrong. Instead, we need to respect
the replaced elements aspect ratio.

Since the touched code does not have a direct correspondence to any spec
text, I am not fully certain that the change is completely correct.
However, tests agree with it, so the new code seems more correct than
the old one at least.

This fixes 50 WPT subtests in `css/css-flexbox`, most of which are
already in-tree. I have also created a new test for a scenario that did
not seem to be covered by WPT.
2025-07-15 00:52:50 +02:00
Andreas Kling
0fece0650e LibGfx: Let FontCascadeList quickly reject out-of-range code points
Some checks are pending
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer, 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
By keeping track of the enclosing range around all Unicode ranges of a
FontCascadeList entry, we can quickly reject any code point that's
outside all ranges.

This knocks font_for_code_point() from 7% to 3% in the profile when
scrolling on https://screenshotone.com/
2025-07-14 19:05:25 +02:00
Tim Ledbetter
488333aa4b Tests: Convert an SVG text test to a crash test
This should have been a crash test, but the test runner previously
didn't wait long enough for the test to crash.
2025-07-14 13:05:17 -04:00
Tim Ledbetter
e1f0284fba test-web: Wait longer before completing crash tests
Previously, a lot of imported WPT crash tests wouldn't wait long
enough for a crash to occur.
2025-07-14 13:05:17 -04:00
Aliaksandr Kalenik
eed47acb1f LibWeb: Expand ClipFrame into clip rectangles during display list replay
Until now, every paint phase of every PaintableBox injected its own
clipping sequence into the display list:
```
before_paint: Save
              AddClipRect (1)
              ...clip rectangles for each containing block with clip...
              AddClipRect (N)

paint:        ...paint phase items...

after_paint:  Restore
```

Because we ran that sequence for every phase of every box, Skia had to
rebuild clip stack `paint_phases * paintable_boxes` times. Worse,
usually most paint phases contribute no visible drawing at all, yet we
still had to emit clipping items because `before_paint()` has no way to
know that in advance.

This change takes a different approach:
- Clip information is now attached as metadata `ClipFrame` to each
  DisplayList item.
- `DisplayListPlayer` groups consecutive commands that share a
  `ClipFrame`, applying the clip once at the start of the group and
  restoring it once at the end.

Going from 10 ms to 5 ms in rasterization on Discord might not sound
like much, but keep in mind that for 60fps we have 16 ms per frame and
there is a lot more work besides display list rasterization we do in
each frame.

* https://discord.com/channels/1247070541085671459/1247090064480014443
  - DisplayList items:  81844  -> 3671
  - rasterize time:     10 ms  -> 5 ms
  - record time:        5 ms   -> 3 ms

* https://github.com/LadybirdBrowser/ladybird
  - DisplayList items:  7902  -> 1176
  - rasterize time:     4 ms  -> 4 ms
  - record time:        3 ms  -> 2 ms
2025-07-14 15:48:28 +02:00
Aliaksandr Kalenik
7e333cdcf7 LibWeb: Separate device pixel conversion helpers from PaintContext
In the upcoming change, device pixel conversion of ClipFrame will
happen during display list replay, where PaintContext is not available,
so let’s move it out of PaintContext.
2025-07-14 15:48:28 +02:00