Commit graph

607 commits

Author SHA1 Message Date
Andrew Kaster
7d797b2c32 CMake: Remove warning suppression for unknown attributes
We should take care of these with macros or other means instead of
suppressing them.
2025-04-15 02:19:06 -06:00
Andrew Kaster
b133c27305 CMake: Disable [[no_unique_address]] when Swift is enabled
There's an upstream bug on this already.
2025-04-15 02:19:06 -06:00
Timothy Flynn
c0ead1b01a LibIDL+LibWeb: Begin support for async iterator in IDL
This adds support for async iterators of the form:

    async iterable<value_type>;
    async iterable<value_type>(/* arguments... */);

It does not yet support the value pairs of the form:

    async iterable<key_type, value_type>;
    async iterable<key_type, value_type>(/* arguments... */);

Async iterators have an optional `return` data property. There's not a
particularly good way to know what interfaces implement this property.
So this adds a new extended attribute, DefinesAsyncIteratorReturn, which
interfaces can use to declare their support.
2025-04-14 17:43:11 -04:00
stelar7
6ec914c7f7 LibWeb/IDB: Add some debug output 2025-04-09 11:48:49 -06:00
Ali Mohammad Pur
6b883c5ccb Meta: Disable -Warray-bounds and -Wstringop-overflow on GCC
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 (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, 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
These generate what seems to be nonsense warnings on Function and
ByteBuffer; they *should* be investigated at some point, but they don't
provide anything useful at this point.
2025-04-08 14:01:28 +02:00
Ali Mohammad Pur
0a958c8e16 Meta: Add an option to disable LTO for Release builds 2025-04-08 14:01:28 +02:00
Ali Mohammad Pur
fac2ee4452 Meta: Add a link job pool with a configurable size
Parallel linking (esp. with bfd) uses a huge chunk of memory, make it
possible for users to limit the number of link jobs to at least
limit the pain.
2025-04-08 14:01:28 +02:00
Ali Mohammad Pur
396f35c41d Meta: Don't require LTO to build in release mode
check_ipo_supported() will by default fail the generation if IPO is not
available; this commit makes it so we continue the build just without
LTO.
2025-04-05 19:09:59 +02:00
Andrew Kaster
743f8a3a0a CMake: Add macro to wrap C++ command line definitions for swiftc
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 (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, 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
Similar to the existing macros for compile options and link options,
this macro wraps the command line definitions for swiftc in a way that
avoids warnings about conditional compilation flags not having values.
2025-04-04 13:06:53 -06:00
Sam Atkins
fd4f4f425d LibWeb: Generate DescriptorID enum
Add a new JSON file describing at-rule descriptors, and then use it to
generate a DescriptorID enum, and code to check if it's accepted in a
given at-rule.
2025-04-04 10:40:32 +01:00
Andrew Kaster
1ed4e64575 CMake: Refactor FindSwiftTesting to find TestingMacros dir on macOS
Turns out we need this directory to pass to the -frontend command
for creating the interop header, so refactor the whole find module
to find it on each platform.
2025-04-03 16:47:48 -06:00
Andrew Kaster
8554ee386e LibGC: Teach Swift bindings about Cell and Cell::Visitor
Add the proper annotations for the Cell and Cell::Visitor classes to be
visible in Swift. This lets us remove some OpaquePointer shinangians in
the Swift bindings.
2025-04-03 16:47:48 -06:00
Andrew Kaster
e4c88915ab LibGC+LibJS+LibWeb: Add workaround for Swift boolean bitfield issue
This patch adds a workaround for a Swift issue where boolean bitfields
with getters and setters in SWIFT_UNSAFE_REFERENCE types are improperly
imported, causing an ICE.
2025-04-03 16:47:48 -06:00
Andrew Kaster
91c1aed57f Revert "Meta: Add workaround for CMake 4.0 policy minimum changes"
This reverts commit 04d44c9b26.
2025-04-03 08:03:48 -06:00
Andrew Kaster
04d44c9b26 Meta: Add workaround for CMake 4.0 policy minimum changes
In CMake 4.0, having a minimum policy version set to less than 3.5 is
a hard error at configure time. Add an override until the issue can be
resolved in vcpkg itself.
2025-04-02 10:50:18 -06:00
Andrew Kaster
8455d23a4b Revert "Meta: Add fontconfig and freetype vcpkg overlays"
This reverts commit 20890d7b70.

The maintenance and downtime for the freedesktop GitLab is resolved.
2025-04-02 10:50:18 -06:00
Jelle Raaijmakers
3bc6870bbf Meta: Make the "Release" build type use -O3 and -flto
This doesn't affect the default preset, but the Distribution preset will
now compile with these flags instead.
2025-04-01 13:44:05 +02:00
Ali Mohammad Pur
a83145c751 AK: Don't assert things about active union members in StringBase
This involves yeeting the 'invalid' union member as it was not really
checked against properly anyway; now the 'invalid' state is simply
StringData*{nullptr}, which was assumed to not exist previously.

Note that this is still accessing inactive union members, but is
promising to the compiler that they're fine where they are (the provided
debug macro AK_STRINGBASE_VERIFY_LAUNDER_DEBUG makes the
would-be-UB-if-not-for-launder ops verify that the operation is correct)

Should fix the GCC build.
2025-03-27 15:58:57 +00:00
Timothy Flynn
a6b664d4d0 Meta: Add -Wno-unqualified-std-cast-call to GCC compile flags
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
Otherwise we get a ton of errors about unqualified calls to `move` from
clangd.
2025-03-26 18:48:28 -04:00
Sam Atkins
ffa1dba96a LibWeb: Generate pseudo-element code from JSON
Initially, this generates the enum and to/from-string functions. The
JSON itself contains more data than that, but it's unused for now.
2025-03-24 09:49:50 +00:00
Ryan Liptak
0b0f47e320 LibWeb: Make named character references more spec-compliant & efficient
There are two changes happening here: a correctness fix, and an
optimization. In theory they are unrelated, but the optimization
actually paves the way for the correctness fix.

Before this commit, the HTML tokenizer would attempt to look for named
character references by checking from after the `&` until the end of
m_decoded_input, which meant that it was unable to recognize things like
named character references that are inserted via `document.write` one
byte at a time. For example, if `&notin;` was written one-byte-at-a-time
with `document.write`, then the tokenizer would only check against `n`
since that's all that would exist at the time of the check and therefore
erroneously conclude that it was an invalid named character reference.

This commit modifies the approach taken for named character reference
matching by using a trie-like structure (specifically, a deterministic
acyclic finite state automaton or DAFSA), which allows for efficiently
matching one-character-at-a-time and therefore it is able to pick up
matching where it left off after each code point is consumed.

Note: Because it's possible for a partial match to not actually develop
into a full match (e.g. `&notindo` which could lead to `&notindot;`),
some backtracking is performed after-the-fact in order to only consume
the code points within the longest match found (e.g. `&notindo` would
backtrack back to `&not`).

With this new approach, `document.write` being called one-byte-at-a-time
is handled correctly, which allows for passing more WPT tests, with the
most directly relevant tests being
`/html/syntax/parsing/html5lib_entities01.html`
and
`/html/syntax/parsing/html5lib_entities02.html`
when run with `?run_type=write_single`. Additionally, the implementation
now better conforms to the language of the spec (and resolves a FIXME)
because exactly the matched characters are consumed and nothing more, so
SWITCH_TO is able to be used as the spec says instead of RECONSUME_IN.

The new approach is also an optimization:

- Instead of a linear search using `starts_with`, the usage of a DAFSA
  means that it is always aware of which characters can lead to a match
  at any given point, and will bail out whenever a match is no longer
  possible.
- The DAFSA is able to take advantage of the note in the section
  `13.5 Named character references` that says "This list is static and
  will not be expanded or changed in the future." and tailor its Node
  struct accordingly to tightly pack each node's data into 32-bits.
  Together with the inherent DAFSA property of redundant node
  deduplication, the amount of data stored for named character reference
  matching is minimized.

In my testing:

- A benchmark tokenizing an arbitrary set of HTML test files was about
  1.23x faster (2070ms to 1682ms).
- A benchmark tokenizing a file with tens of thousands of named
  character references mixed in with truncated named character
  references and arbitrary ASCII characters/ampersands runs about 8x
  faster (758ms to 93ms).
- The size of `liblagom-web.so` was reduced by 94.96KiB.

Some technical details:

A DAFSA (deterministic acyclic finite state automaton) is essentially a
trie flattened into an array, but it also uses techniques to minimize
redundant nodes. This provides fast lookups while minimizing the
required data size, but normally does not allow for associating data
related to each word. However, by adding a count of the number of
possible words from each node, it becomes possible to also use it to
achieve minimal perfect hashing for the set of words (which allows going
from word -> unique index as well as unique index -> word). This allows
us to store a second array of data so that the DAFSA can be used as a
lookup for e.g. the associated code points.

For the Swift implementation, the new NamedCharacterReferenceMatcher
was used to satisfy the previous API and the tokenizer was left alone
otherwise. In the future, the Swift implementation should be updated to
use the same implementation for its NamedCharacterReference state as
the updated C++ implementation.
2025-03-22 16:03:44 +01:00
Andrew Kaster
f22f6e1f5b CMake: Remove unused CMake functions 2025-03-20 11:36:09 -06:00
Andrew Kaster
89ecc75ed8 LibCore+Meta: Un-break Swift build on Linux
LibCore's list of ignored header files for Swift was missing the Apple
only files on non-Apple platforms. Additionally, any generic glue code
cannot use -fobjc-arc, so we need to rely on -fblocks only.
2025-03-18 17:15:08 -06:00
Andrew Kaster
01ac48b36f AK: Support storing blocks in AK::Function
This has two slightly different implementations for ARC and non-ARC
compiler modes. The main idea is to store a block pointer as our
closure and use either ARC magic or BlockRuntime methods to manage
the memory for the block. Things are complicated by the fact that
we don't yet force-enable swift, so we can't count on the swift.org
llvm fork being our compiler toolchain. The patch adds some CMake
checks and ifdefs to still support environments without support
for blocks or ARC.
2025-03-18 17:15:08 -06:00
Andrew Kaster
72acb1111f CMake: Add find module for BlocksRuntime on non-Apple platforms 2025-03-18 17:15:08 -06:00
Andrew Kaster
20890d7b70 Meta: Add fontconfig and freetype vcpkg overlays
Temporary until their canonical git forge is back up and running
2025-03-18 00:25:42 -06:00
Shannon Booth
f8f21319f9 LibURL/Pattern: Implement the URL Pattern Tokenizer
The tokenizer is used for both pattern string and constructor string
parsing of URL Patterns.
2025-03-15 07:39:03 -04:00
Andreas Kling
c333042e63 LibWeb: Add opt-in tracing of update_layout() calls with reason 2025-03-08 03:37:38 +01:00
R-Goc
fe26c3145d AK: Add stacktrace support using the standard lib
This commit adds support for using the standard library implementation
of <stacktrace> if libbacktrace is not found. This can also be
explicitly enabled through ENABLE_STD_STACKTRACE for platforms that have
libbacktrace available.

Co-Authored-By: Andrew Kaster <andrew@ladybird.org>
2025-03-05 10:25:12 -07:00
Timothy Flynn
58bc44ba2a LibDevTools: Introduce a Firefox DevTools server library
To aid with debugging web page issues in Ladybird without needing to
implement a fully fledged inspector, we can implement the Firefox
DevTools protocol and use their DevTools. The protocol is described
here:

https://firefox-source-docs.mozilla.org/devtools/backend/protocol.html

This commit contains just enough to connect to Ladybird from a DevTools
client.
2025-02-19 08:45:51 -05:00
Andrew Kaster
46444c89c9 Meta: Disable implicit-const-int-float-conversion for clang-cl 2025-02-12 19:13:49 -07:00
Andrew Kaster
80c259125c Meta+LibWeb: Pass IDL files to codegen using response file on Windows
It might be a good idea to do this on other platforms as well, but at
least on Windows, the command line for GenerateWindowOrWorkerInterfaces
becomes too large.
2025-02-12 19:13:49 -07:00
Andrew Kaster
06ff47749f Meta: Add a workaround for missing dllimport for skcms API
This should really be fixed by patching the skcms top level header,
but this hack works for now on Windows for linking LibGfx.
2025-02-12 19:13:49 -07:00
Undefine
0c882c441e LibCompress: Remove unused Lzma compression and decompression 2025-02-10 16:22:32 +00:00
R-Goc
4ccf165dad Meta: Add vcpkg triplet detection for Windows
Adds simple vcpkg triplet detection on Windows. This allows for the
configure step to succeed.
2025-02-07 13:48:19 -07:00
Andrew Kaster
86c5bde83f Meta: Pass C11 and C++17 flags to icu build on Windows
icu 75.x and higher requires C++17. This change is pulled from an
abandoned PR to uprev vcpkg's version to 75. Presumably the flags
should be set upstream as well in their configure.ac
2025-02-05 16:01:07 -07:00
stasoid
ac3d9739b1 Meta/CMake: Use standard attribute syntax in skia/portfile.cmake
Fixes this Skia build error on Windows: https://github.com/microsoft/vcpkg/issues/43192
2025-02-05 15:44:00 -07:00
Timothy Flynn
6a564376fc Meta+LibUnicode+LibJS: Upgrade to ICU 76.1
This updates our local ICU overlay port to use ICU 76.1. This includes
Unicode 16 and CLDR 46.

Upstream vcpkg is not able to supply versions past 74 yet due to various
dependency issues, but we are able to use this version ourselves. The
overlay port now includes a patch to revert ICU's dependence on autoconf
2.72 for now, as this version is not yet available on all systems.

All of the test changes were cross-referenced with Firefox to ensure
correctness.
2025-01-18 17:56:40 -05:00
Timothy Flynn
96558b98f9 Meta: Add an overlay port for ICU
This will allow us to upgrade to ICU 76 independent of upstream vcpkg.
2025-01-18 17:56:40 -05:00
Tim Ledbetter
00ed797627 Meta/CMake: Use simple string match to find relevant vcpkg triplets
Previously, the build would fail if the CMake source directory
contained regex special characters.
2025-01-11 23:18:16 +01:00
Andrew Kaster
223b13ae93 CMake: Enable -Wl,--no-undefined on ELF platforms
This is mostly a development helper, to move all undefined symbols
in shared libraries to link time rather than load time.

At the same time, set --no-allow-shlib-undefined and -z,defs to
further enforce the rule.
2025-01-06 12:41:47 -07:00
Andrew Kaster
5e43fec6dd CMake: Enable -Werror unconditionally 2025-01-06 12:41:47 -07:00
Andrew Kaster
2a16c58114 CMake: Also set VCPKG_HOST_TRIPLET to the dynamic triplet
This avoids Fedora 41 x86_64 machines using the x64-linux triplet
when building pkg-config. Doing so without our custom linker flags
causes the build to fail.
2024-12-31 13:42:50 -07:00
Timothy Flynn
79a2b96d1c Meta: Consolidate checking for the system audio backend
The goal here is to ensure we check for audio backends in a way that
makes sense. On macOS, let's just always use Audio Unit (and thus avoid
any checks for Pulse, to reduce needless/confusing build log noise). We
will also only use the Qt audio backend if no other backend was found,
rather than only checking for Pulse.
2024-12-25 12:00:43 +01:00
Andrew Kaster
673537b26b CMake: Rename our triplets to their canonical names
Becuase we're using dynamic libraries, our configuration is
classified as a "community triplet". To not confuse vcpkg
maintainers when developers create bug reports, name them
properly. This means that the default triplet detection is now
kind of useless, so we have to invent our own for these triplets.
2024-12-22 15:48:30 -07:00
R-Goc
9cb397914e Meta: Enable warning for the use of VLAs
This commit enables warnings when using variable length arrays. For
disabling this warning locally use -Wno-vla, as it will work both across
Clang and GCC.
2024-12-20 09:37:56 +01:00
Lucas CHOLLET
2174e5dfcc LibGfx: Remove ICC::Profile and friends
This is not really used anymore since the fork.
2024-12-16 07:39:49 +01:00
Andrew Kaster
c1596192fa CMake: Add workaround for binutils+patchelf incompatability 2024-12-12 17:22:34 -07:00
R-Goc
2ac8408fef CMake: Fix Windows exceptions flag
This commit changes the exception flag to match the description and turn
off exceptions. This matches the behavior of -fno-exceptions. However,
on Windows SEH exceptions are always available, and there's no easy way
to turn them off. This flag should also suppress previous /EHsc flags,
if they get automatically set by cmake. Reference:
https://learn.microsoft.com/en-us/cpp/build/reference/eh-exception-handling-model?view=msvc-170
2024-12-05 20:34:22 +01:00
Lucas CHOLLET
4d7b7178f9 Meta/vcpkg: Set default visibility for skcms symbols
Without this patch, as skia is compiled with -fvisibility=hidden, no
skcms function is accessible from outside skia's code.
2024-12-05 17:16:41 +01:00