Commit graph

3454 commits

Author SHA1 Message Date
Andrew Kaster e7a9126f81 CMake: Silence the loudest warnings for generating Swift interop headers
And modernize the cmake_parse_arguments() call at the top.

Ideally, we would pull these flags from the target we're generating
for, but the current CMake setup makes that prohibitively infeasible.
2024-08-06 18:28:10 -06:00
Andrew Kaster 1dff3ca0c4 CMake: Apply C++ compile options to Swift compilations
This ensures that we can get all the proper warnings on/off to get the
same diagnostics and other options when loading C++ headers into the
Swift frontend.
2024-08-06 18:28:10 -06:00
Andrew Kaster 15f25d56b8 AK: Disable -Wunqualified-std-cast-call explicitly in CMake
When importing libraries with swiftc, the pragma to ignore this
warning isn't respected. So apply it on the command line.
2024-08-06 18:28:10 -06:00
Will Hawkins 4f4fdce62a Meta: Script to configure clangd according to build type
Add a simple shell script to update the local clangd configuration
according to the type of build selected by the user. Include
documentation on where the script might be useful when building
under different configurations.
2024-08-05 23:44:03 -06:00
Shannon Booth a342370dfb LibWeb: Rename SharedImageRequest to SharedResourceRequest
For the SVG <use> element, we want to support loading HTML documents
that have a SVG element inside of it pointed to by the URL fragment.

In this situation we would need to fetch and parse the entire document
in SharedImageRequest (so that we can still cache the SVGs). Rename
SharedImageRequest to SharedResourceRequest to make the class a little
more generic for future usecases.
2024-08-05 11:26:41 +02:00
Colin Reeder 14267b5d63 LibWeb: Add stub implementation of performance.navigation 2024-08-04 10:38:42 +02:00
Timothy Flynn 96bb8fe944 UI/Qt: Add a debug menu item to dump RequestServer connection info 2024-08-03 15:53:07 -04:00
Shannon Booth ad32227c83 BindingsGenerator: Support nullable integral attributes
Previously we were assuming that the attribute return value was never
nullable and going to be returned in an Optional<IntegralType>, causing
complile errors for something such as: `attribute unsigned long?`.
2024-08-01 11:42:39 +02:00
Shannon Booth d6243abec3 BindingsGenerator: Factor out code to generate JS::Value from an integer
Mirroring the pre-existing `generate_from_integral` function. This will
allow us to fix a bug that all of these if statements have in common -
no handling of nullable types.

This also adjusts the type casted for each integral to fully match that
stated by the spec.
2024-08-01 11:42:39 +02:00
Andrew Kaster 743c71faa7 Meta: Let Wasm test pass without INCLUDE_WASM_SPEC_TESTS 2024-07-30 18:38:02 -06:00
Andrew Kaster 2fa6c445cb CMake: Work around two upstream CMake issues for Swift files
https://gitlab.kitware.com/cmake/cmake/-/issues/26174
https://gitlab.kitware.com/cmake/cmake/-/issues/26175
2024-07-30 18:38:02 -06:00
Andrew Kaster 7afe183172 CMake: Add proper sanitizer options for Swift files
Apparently UBSAN + Swift doesn't work on Linux :<
2024-07-30 18:38:02 -06:00
Andrew Kaster 07d387af96 Meta: Create a common Swift settings flow 2024-07-30 18:38:02 -06:00
Andrew Kaster 7f8103da7a CMake: Move GenerateSwiftHeader.cmake to Meta/CMake 2024-07-30 18:38:02 -06:00
Andrew Kaster 45301e8169 Everywhere: Remove AK_DONT_REPLACE_STD macro
Let's just always include `<utility>`. Placing our own incompatible with
the STL declaration of these functions in AK was always fishy to begin
with.
2024-07-30 18:38:02 -06:00
Aliaksandr Kalenik 0bfcf73524 LibWeb: Inline apply_backdrop_filter function into paint_backdrop_filter
No need to have a separate file for this small function.
2024-07-29 17:48:56 +02:00
Jamie Mansfield 75216182c9 LibWeb: Implement DOMStringList 2024-07-29 11:19:00 +02:00
bbb651 779e3072f9 WebAudio: Stub AudioDestinationContext
And expose it through `BaseAudioContext::destination`
2024-07-28 21:41:15 +02:00
Diego Frias 48f1861ce9 Meta: No longer ignore test-wasm results during testing
Since the Wasm runtime should be fully spec-compliant, we want to make
sure that the spec-tests always pass.
2024-07-27 15:02:37 +02:00
Aliaksandr Kalenik 1bd0871ed8 LibWeb+LibGfx: Use Skia for text rasterization
The main incentive is much better performance. We could have gone a bit
further in optimizing the Skia painter to blit glyphs produced by LibGfx
more efficiently from the glyph atlas, but eventually, we also want Skia
to improve correctness.

This change does not completely replace LibGfx in text handling. It's
still used at all stages, including layout, up until display list
replaying.
2024-07-27 08:18:54 +02:00
Andreas Kling 2daaa22a15 LibWeb: Stop trying to guess include paths in IDL codegen
It turns out we were already generating all the necessary include
statements, and we can simply remove all this goofy code soup that
uses the C preprocessor to speculatively look for include files.
2024-07-26 17:33:29 +02:00
Shannon Booth 9b59dc5e8b Bindings: Remove exception handling for named_item_value 2024-07-26 14:26:16 +02:00
Sam Atkins 576a431408 LibWeb: Implement CounterStyleValue
This is `counter(name, style?)` or `counters(name, link, style?)`. The
difference being, `counter()` matches only the nearest level (eg, "1"),
and `counters()` combines all the levels in the tree (eg, "3.4.1").
2024-07-26 11:04:30 +01:00
Andrew Kaster 24ff698914 ClangPlugins: Don't build plugins with sanitizers 2024-07-25 18:35:57 -06:00
Andrew Kaster f314f58fca LibJS+ClangPlugins: Add escape hatch for GCPtr checks 2024-07-25 18:35:57 -06:00
Andrew Kaster 7f953a8519 ClangPlugins: Enable building in release mode with current warnings 2024-07-25 18:35:57 -06:00
Tim Schumacher cf6929fef3 Meta: Guard everything that installs headers with an option 2024-07-25 13:25:09 -06:00
bbb651 64663d53fa WebAudio: Stub BiquadFilterNode 2024-07-23 09:02:43 +02:00
bbb651 6672fb4b47 WebAudio: Stub AudioBufferSourceNode 2024-07-23 09:02:43 +02:00
Aliaksandr Kalenik 2ead999f2b LibGfx+LibWeb: Remove typeface classes for WOFF fonts
This change removes wrappers inherited from Gfx::Typeface for WOFF and
WOFF2 fonts. The only purpose they served is owning of ttf ByteBuffer
produced by decoding a WOFF/WOFF2 font. Now new FontData class is
responsible for holding ByteBuffer when a font is constructed from
non-externally owned memory.
2024-07-22 15:05:04 +02:00
Andrew Kaster 922c6bde87 CMake: Enable policy 0157 for more control over Swift compile mode 2024-07-21 15:55:47 -06:00
Andrew Kaster 68ce5f8290 Ladybird/AppKit: Port TaskManager window to Swift
This is just a direct port of the Objective-C++ code to Swift 6.
A future patch should probably update it to actually use SwiftUI.
2024-07-21 15:55:47 -06:00
Andrew Kaster 4066ce2c7e CMake: Ensure C/C++ compile options only applied when compiling C/C++ 2024-07-21 15:55:47 -06:00
Aliaksandr Kalenik f3b3b3f5b9 LibWeb: Delete DisplayListPlayerCPU
No longer used after switching to Skia as a default.
2024-07-21 10:36:17 +02:00
Andrew Kaster 8e5d28de3c CMake: Force vcpkg to use CMAKE_CXX_COMPILER as specified to CMake
Override the vcpkg/scripts/detect_compiler behavior of always pulling
$CC and $CXX at the time that vcpkg install is determined to need called
by forcing $ENV{CXX} and $ENV{CC} to our CMake-determined compiler.

This prevents strange behavior such as running the following:

./Meta/ladybird.sh run
    make changes...
ninja -C Build/ladybird

Where the second build step would be run without CC or CXX set in the
environment, causing a total cache miss from vcpkg and a full rebuild.

It also helps prevent full rebuilds when an IDE passes a slightly
different compiler to the build step than ladybird.sh.
2024-07-18 14:48:20 +02:00
Timothy Flynn 7c813d3992 Meta+CI: Hook up the Lagom tools build with vcpkg
AK will depend on some vcpkg dependencies, so the Lagom tools build will
need to know how to use vcpkg. We can do this by sym-linking vcpkg.json
to Meta/Lagom (as vcpkg.json has to be in the CMake source directory).
We also need a CMakePresets.json in the source directory, which can just
include the root file. The root CMakePresets then needs to define paths
relative to ${fileDir} rather than ${sourceDir}.
2024-07-18 14:46:25 +02:00
Daniel Bertalan a4645060e6 CMake: Add hardening flags
- `-fstack-protection-strong` enables stack canaries for functions where
  addresses of local variables are taken or arrays/structures
  containing arrays are allocated on the stack.
- `-fstrict-flex-arrays=2` causes the compiler to only treat arrays with
  unknown bounds (`[]`) or zero-length-arrays (`[0]`) as *flexible array
  members*, allowing the sanitizers to emit bounds checks for structs
  with proper arrays as their last member.

More rigorous options (such as AArch64 pointer authentication, Control
Flow Integrity, _FORTIFY_SOURCE) should be investigated in the future,
however this is a good baseline.
2024-07-17 21:51:29 +02:00
Daniel Bertalan c62240aa80 Everywhere: Warn on function definitions without prototypes
If no header includes the prototype of a function, then it cannot be
used from outside the translation unit it was defined in. In that case,
it should be marked as `static`, in order to avoid possible ODR
problems, unnecessary exported symbols, and allow the compiler to better
optimize those.

If this warning triggers in a function defined in a header, `inline`
needs to be added, otherwise if the header is included in more than one
TU, it will fail to link with a duplicate definition error.

The reason this diff got so big is that Lagom-only code wasn't built
with this flag even in Serenity times.
2024-07-17 21:51:29 +02:00
Daniel Bertalan 7fe82a1cda CMake: Add back stricter warnings used in Serenity builds
These used to be enabled in `serenity_compile_options.cmake` for
Serenity builds and were removed in 9b05fb98. This is a slightly more
conservative subset of those, with ones that are enabled by default
omitted.

This should prevent our code quality regressing in the long run.
2024-07-17 21:51:29 +02:00
Jamie Mansfield e8fe7c0ee3 LibWeb: Prevent infinite loop in create_an_inheritance_stack
This would continually loop on the same interface.

Co-authored-by: Matthew Olsson <matthewcolsson@gmail.com>
2024-07-17 18:19:09 +01:00
circl a443f50807 Base: Move config files out of home/anon and into default-config 2024-07-17 09:57:46 -06:00
sideshowbarker 15d67f0da2 Meta: Make check-debug-flags.sh runnable in Bash 3.2
This change updates the Meta/check-debug-flags.sh script to avoid an
apparent Bach 3.2 parser bug. Specifically, it takes a comment and some
code of a process substitution and moves it into a separate function.

Otherwise, without this change, trying to run the check-debug-flags.sh
script with Bash 3.2 fails with the following error:

line 39: bad substitution: no closing `)' in <(

...apparently because Bash 3.2 chokes on the comment (and doesn’t choke
if the comment is completely removed).

Relates to https://github.com/LadybirdBrowser/ladybird/issues/283
2024-07-16 09:13:14 -06:00
sideshowbarker 570814a31e Meta: Make all pre-commit CI scripts work with Bash 3.2
This change makes all the pre-commit CI scripts runnable under Bash 3.2,
by replacing “mapfile” invocations in them code that first explicitly
creates an array, and then uses a while loop to populate the array.

Otherwise, without this change, the scripts all fail to run under Bash
3.2 — due to lack of support for “mapfile”.

Fixes https://github.com/LadybirdBrowser/ladybird/issues/283

This also drops bash from the list of homebrew dependencies in the build
instructions — because with this change, homebrew bash (v4) is no longer
needed; things will now work with the Apple-provided bash (v3.2)
2024-07-16 08:56:22 -06:00
Timothy Flynn 58dfe5424f AK: Make the AK library's CMake a bit more standard
We no longer have multiple locations including AK (e.g. LibC). So let's
avoid awkwardly defining the AK library across multiple CMake files.

This is to allow more easily adding third-party dependencies to AK in
the future.
2024-07-16 10:27:39 +02:00
Diego Frias f63a945ba0 LibWeb: Implement the :has() pseudo-class
See https://drafts.csswg.org/selectors-4/#relational.
2024-07-15 11:52:03 +01:00
Andrew Kaster 31eec0a145 Documentation+Toolchain: Don't try to build CMake from source
This build step is a bit excessive. Let's require people to have an
up-to-date CMake from their system package manager instead.
2024-07-15 10:15:40 +02:00
Kotaro Ichihara 0307095f52 Meta: Make ladybird.sh old bash compatible 2024-07-14 19:55:50 -06:00
Diego 3a0f80bbae LibWasm: Ignore tests that check that we don't support 2+ memories
Since we support the multi-memory proposal, we should skip tests that
validate that we have only one memory. Once multi-memory gets included
in the main WebAssembly specification (and the testsuite is updated), we
can revert this commit.
2024-07-14 11:26:52 +02:00
Jamie Mansfield d4a7cfb68f LibWeb: Stub BroadcastChannel interface
This is enough to get the 1Password login page to load :^)
2024-07-13 19:53:02 +02:00
Aliaksandr Kalenik c09b5b8df0 LibGfx+LibWeb: Rename Gfx::WOFF2::Font to Gfx::WOFF2::Typeface
It's a leftover from VectorFont -> Typeface renaming
2024-07-13 09:31:02 +02:00