Commit graph

68652 commits

Author SHA1 Message Date
Andreas Kling
16662ab230 LibWeb: Account for collapsed top margins in BFC root height calculation
By the time we're measuring the height of a BFC root, we've already
collapsed all relevant margins for the root and its descendants.
Given this, we should simply use 0 (relative to the BFC root) as the
lowest block axis coordinate (i.e Y value) for the margin edges.

This fixes a long-standing issue where BFC roots were sometimes not tall
enough to contain their children due to margins.
2025-02-22 18:41:42 +01:00
devgianlu
7eace6af66 LibTLS: Notify on_ready_to_read after handling fatal errors
The `on_ready_to_read` callback on the underlying socket will be called
for various reasons which do not always guarantee that the next read
operation will be successful. For example, the server might have sent an
alert or a TCP RST.

We handle fatal errors on the SSL connection before calling to the user
so that `can_read_without_blocking` does not falsely advertise. The same
checks should be performed there, but it is not possible due to the
function being const.
2025-02-22 18:39:58 +01:00
devgianlu
1563054a63 LibTLS: Close connection on fatal error
The OpenSSL documentation mentions that after `SSL_ERROR_SYSCALL` or
`SSL_ERROR_SSL` no further operations should be performed and
`SSL_shutdown` should not be called.

When a fatal error occurs, close the underlying socket and free the
`SSL` struct.
2025-02-22 18:39:58 +01:00
devgianlu
f74131d50a LibTLS: Pass socket address as const reference 2025-02-22 18:39:58 +01:00
devgianlu
752f5b18fd LibWebSocket: Ensure TLS connection is opened as non-blocking 2025-02-22 18:39:58 +01:00
devgianlu
85d46a71d9 LibDNS: Ensure non-blocking socket is used for TCP connections 2025-02-22 18:39:58 +01:00
devgianlu
7d692711cb LibTLS: Support opening connection as non-blocking
For OpenSSL to work properly, the socket must be non-blocking since
before the SSL connection is established.
2025-02-22 18:39:58 +01:00
devgianlu
ad6d0f6014 LibTLS: Forward non blocking errors to caller 2025-02-22 18:39:58 +01:00
rmg-x
2b32f94527 CodeGenerators: Fix clang-18 crash by specifying types explicitly
clang 18.1.8 was crashing during the build without this change.

Filed a bug report here:
https://github.com/llvm/llvm-project/issues/128359

Co-authored-by: Tim Flynn <trflynn89@pm.me>
2025-02-22 12:38:11 -05:00
Sam Atkins
ff1ef07160 LibWeb/HTML: Update HTMLButtonElement.type to match spec changes
Some checks are pending
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, 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 part of https://github.com/whatwg/html/pull/9841 and then
https://github.com/whatwg/html/pull/11047

Adding `Auto` as a type state feels a little odd, as it's not an actual
type allowed in HTML. However, it's the default state when the value is
missing or invalid, which works out the same, as long as we never
serialize "auto", which we don't.
2025-02-22 14:59:39 +00:00
Sam Atkins
03bccb5ff1 LibWeb/HTML: Add spec comment to CRC2D::put_image_data()
Also rename imagedata -> imageData, as done here:
6a3787f6cf
2025-02-22 14:59:39 +00:00
Sam Atkins
54d41cfea3 LibWeb/HTML: Update navigation API when a same-document reload occurs
Corresponds to 3a2a05ddf8
2025-02-22 14:59:39 +00:00
Sam Atkins
d54753e9c6 LibWeb/HTML: Correct spec numbers in inner_navigate_event_firing_algo
I forgot to do this in 26b7946123, oops!
2025-02-22 14:59:39 +00:00
Sam Atkins
4374bf2202 LibWeb/HTML: Fix dialog focus restoring descendant check
Corresponds to 82135842dc
2025-02-22 14:59:39 +00:00
Psychpsyo
89f36168b7 LibWeb: Import WPT tests for view-transition-name parsing 2025-02-22 14:52:13 +00:00
Psychpsyo
c0eb072645 LibWeb: Add CSS view-transition-name 2025-02-22 14:52:13 +00:00
Psychpsyo
b833168b74 LibWeb: Add view transition UA styles 2025-02-22 14:52:13 +00:00
Tim Ledbetter
7ee33529e8 IDLGenerators: Throw TypeError if custom element is already constructed
Throwing a TypeError instead of an InvalidStateError DOMException
follows the current specification steps.
2025-02-22 05:39:23 -05:00
Tim Ledbetter
08b5cae199 LibWeb: Don't prepare script when src attribute is removed 2025-02-22 10:14:57 +01:00
Jelle Raaijmakers
63b451cb46 LibWeb: Add SVGFilterElement 2025-02-22 10:14:29 +01:00
Jelle Raaijmakers
aeef179668 LibWeb: Add SVGAnimatedEnumeration 2025-02-22 10:14:29 +01:00
Jelle Raaijmakers
1aa50ac34a LibWeb: Combine SVG tag names into a single list
We have no need to separate these tags into "SVG graphics tags" and "SVG
tags".
2025-02-22 10:14:29 +01:00
Aliaksandr Kalenik
0ab61a94d7 LibWeb: Bucket hover rules using RuleCache
Analysis of selectors on modern websites shows that the `:hover`
pseudo-class is mostly used in the subject position within relatively
simple selectors like `.a:hover`. This suggests that we could greatly
benefit from segregating them by id/class/tag name, this way reducing
number of selectors tested during hover style invalidation.

With this change, hover invalidation on Discord goes down from 70ms to
3ms on my machine. I also tested GMail and GitHub where this change
shows nice 2x-3x speedup.
2025-02-22 10:12:24 +01:00
Aliaksandr Kalenik
ff8826d582 LibWeb: Prepare RuleCache for being reusable to store hover rules
Moves code that allows to add and iterate over rules in cache into
methods defined for RuleCache.
2025-02-22 10:12:24 +01:00
Tim Ledbetter
d3c51ea05e LibWeb: Apply nowrap attribute as presentational hint 2025-02-22 09:12:08 +00:00
Tim Ledbetter
a4ee3fb1f0 LibWeb: Use type attribute to determine HTMLLinkElement mime type
Some checks are pending
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, 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, the type attribute was ignored on link elements.
2025-02-21 13:52:27 +01:00
Luke Wilde
cae0ab2139 LibWeb: Make PolicyContainer GC allocated
This is required to store Content Security Policies, as their
Directives are implemented as subclasses with overridden virtual
functions. Thus, they cannot be stored as generic Directive classes, as
it'll lose the ability to call overridden functions when they are
copied.
2025-02-21 12:43:48 +00:00
Tim Ledbetter
2e27ffab6c LibWeb: Exclude inert elements from find in page queries 2025-02-21 12:41:57 +00:00
Tim Ledbetter
d410fa8381 LibWeb: Ensure inert elements are not selectable 2025-02-21 12:41:57 +00:00
Tim Ledbetter
cb405c773b LibWeb: Ensure inert elements are not visible for hit testing 2025-02-21 12:41:57 +00:00
Tim Ledbetter
8547c1a743 LibWeb: Ensure inert contenteditable elements are not editable 2025-02-21 12:41:57 +00:00
Tim Ledbetter
1e691bd26d LibWeb: Ensure inert elements are unfocusable 2025-02-21 12:41:57 +00:00
Tim Ledbetter
a9ffc6359a LibWeb: Set inertness of HTMLElement when inert attribute is changed 2025-02-21 12:41:57 +00:00
Andrew Kaster
893e9e3eac CI: Add nightly builds for the Distribution preset 2025-02-21 12:05:18 +01:00
Andrew Kaster
b7f7f58e5f LibMedia: Don't link null PlaybackStream::create eagerly
This avoids static builds putting the "no-op" implementation of
PlaybackStream::create() in the static archive before the strong
implementation later. On ELF (and probably PE/COFF too), a weak
definition in a static archive is chosen and locked-in as the
definition before a strong definition later in the archive.

Before this change, static builds would have no audio support
at all.
2025-02-21 12:05:18 +01:00
Andrew Kaster
d64566f19e CI: Add a nightly arm64 linux CI build
This requires setting VCPKG_FORCE_SYSTEM_BINARIES to 1, per vcpkg
documentation.
2025-02-21 12:05:18 +01:00
Andrew Kaster
13338a9532 CMake: Ensure build and test presets for Distribution and Debug 2025-02-21 12:05:18 +01:00
Andrew Kaster
af5f23cdda CI: Use CMake build preset directly instead of a fuzzer flag 2025-02-21 12:05:18 +01:00
Andrew Kaster
34bf42cffa CI: Use arch variable in ci.yml instead of always using 'Lagom'
This was a relic from the SerenityOS CI, where architecture meant
what architecture to build Serenity for. For just ladybird, we might
want to build ladybird for multiple architectures per OS.
2025-02-21 12:05:18 +01:00
Andreas Kling
d8f95c5050 LibWeb: Don't neglect DOM range updates on CharacterData changes
Regressed in 036327332f.

This commit moves the optimization a little later in replaceData(),
still avoiding relayout (the important part).

Recovers 480 points on WPT. :^)
2025-02-21 11:54:00 +01:00
sideshowbarker
4396dbb88e LibWeb: Sync AriaRoles.json w/ Characteristics data in current spec
This change updates the contents of the AriaRoles.json file to match the
data in the Characteristics tables in the ARIA spec — at, for example,
https://w3c.github.io/aria/#application.

Most of the changes are to match the “Supported States and Properties”
and “Inherited States and Properties” data — but some changes are to
match the “Name From” data and “Accessible Name Required” data.

This change also intentionally removes all states and properties the
Characteristics tables list as “deprecated on this role in ARIA 1.2”.
2025-02-21 09:08:56 +00:00
Glenn Skrzypczak
0750513993 LibWeb: Support reversed ordered lists
Some checks are pending
CI / Lagom (false, NO_FUZZ, macos-15, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, FUZZ, ubuntu-24.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, 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 PR adds support for the `reversed` attribute of
ordered lists.
2025-02-21 04:23:28 +00:00
Tim Ledbetter
2550b602ab LibWeb: Apply type presentational hint for HTMLLIElement 2025-02-21 01:25:30 +00:00
Tim Ledbetter
74bf7bc28e LibWeb: Apply type presentational hint for HTMLUListElement 2025-02-21 01:25:30 +00:00
Tim Ledbetter
7612f2161c LibWeb: Apply type presentational hint for HTMLOListElement 2025-02-21 01:25:30 +00:00
Andreas Kling
1b46a52cfc LibWeb: Always align inline text content to the alphabetic baseline
This fixes an issue where `vertical-align: middle` would incorrectly
shift the text away from the natural alphabetic baseline.

Fixing this makes many WPT table tests work correctly, so I'm also
importing one of them here. :^)
2025-02-21 01:16:38 +00:00
Andreas Kling
20c859519b LibWeb: Support cellpadding=0 and invalidate table cells when it changes
We were incorrectly treating cellpadding=0 as if the attribute was
missing. This commit fixes it so it behaves as `padding: 0` on cells.

When adding a test, I discovered that we were not invalidating style for
cells when their containing table's cellpadding attribute changed.
So this commit fixes that as well.
2025-02-21 01:16:38 +00:00
Timothy Flynn
fe2dff4944 AK+Everywhere: Convert JSON value serialization to String
This removes the use of StringBuilder::OutputType (which was ByteString,
and only used by the JSON classes). And it removes the StringBuilder
template parameter from the serialization methods; this was only ever
used with StringBuilder, so a template is pretty overkill here.
2025-02-20 19:27:51 -05:00
Timothy Flynn
2c03de60da AK+Everywhere: Remove now-unecessary use of ByteString with JSON types
This removes JsonObject::get_byte_string and JsonObject::to_byte_string.
2025-02-20 19:27:51 -05:00
Timothy Flynn
4791ec35bf LibDevTools+LibWebView: Port DevTools to String 2025-02-20 19:27:51 -05:00