Commit graph

3507 commits

Author SHA1 Message Date
Andreas Kling ddbfac38b0 LibWeb: Note what's causing a style invalidation to happen
You can now build with STYLE_INVALIDATION_DEBUG and get a debug stream
of reasons why style invalidations are happening and where.

I've rewritten this code many times, so instead of throwing it away once
again, I figured we should at least have it behind a flag.
2024-09-08 09:45:31 +02:00
Andreas Kling 1f5c49f40d LibWeb: Make CSS::is_inherited_property(PropertyID) go fast
Instead of switching on the PropertyID and doing a boatload of
comparisons, we reorder the PropertyID enum so that all inherited
properties are in two contiguous ranges (one for shorthands,
one for longhands).

This replaces the switch statement with two simple range checks.

Note that the property order change is observable via
window.getComputedStyle(), but the order of those properties is
implementation defined anyway.

Removes a 1.5% item from the profile when loading https://hemnet.se/
2024-09-08 09:45:31 +02:00
Jamie Mansfield 48366ddddf LibWeb/WebAssembly: Use a debug flag for dbgln calls
This prevents the horrendous console spam when functions are resolved,
e.g. on the Royal Albert Hall website.
2024-09-07 19:44:23 +02:00
Timothy Flynn 28f27ff1c4 LibWebView+LibUnicode: Remove (nearly) unused GeneratorUtil header
This header held a bunch of utility functions shared across several code
generators. The only user of any of these utilities now is the public
suffix generator. Move the one used function to that generator, and
remove the common header.
2024-09-06 16:36:20 -04:00
Aliaksandr Kalenik 4e9d6a543a Everywhere: Remove bitmap emojis inherited from SerenityOS
These are no longer used since we switched to using the system emoji
font.
2024-09-06 08:30:30 -04:00
Sam Atkins 1c6133aa52 LibWeb/CSS: Add CSSOM types for @layer rules
Depending on usage, `@layer` has two forms, with two different CSSOM
types. One simply lists layer names and the other defines a layer with
its contained rules.
2024-09-06 07:49:55 +02:00
Aliaksandr Kalenik a9d5a99568 LibGfx+LibWeb: Replace remaining OpenType implementation with Skia
This change should move us forward toward emoji support, as we are no
longer limited by our own OpenType implementation, which was failing
to parse the TrueType Collection format used to store emoji fonts
(at least on macOS).
2024-09-05 19:21:52 +02:00
Jamie Mansfield 4c5a176354 LibWeb: Stub MediaCapabilities IDL interface 2024-09-05 14:52:26 +01:00
Sam Atkins 8cbc211616 Meta: Make embed_as_string_view.py produce Strings instead
This is only used for CSS style sheets. One case wants it as a String,
and the others don't care, but will in future also want to have the
source as a String.
2024-09-03 10:12:07 +01:00
Olekoop 873e576da2 LibGfx: Use a diffrent way for finding libjxl on Android
When trying to use pkgconfig for finding libjxl, the build fails
trying to link the cross-compiler's libc++.
Using this way libjxl also requires hwy library.

Findlibjxl.cmake was taken from SDL_image and altered to include its license.
2024-09-03 00:17:49 -06:00
Andrew Kaster 188b3bb9b8 CMake: Add find module for swift-testing
This project is a part of the Xcode-shipped toolchain on macOS, but
needs built from source on other platforms. However, using the Xcode
version of the framework leads to a bunch of rpath confusion when
trying to link it the expected way. I suspect that there will be a
more intuitive way to link this library from the toolchain when it
stabilizes. So we'll build it everywhere :)
2024-08-28 21:27:35 -06:00
Andrew Kaster 062e687289 Meta: Apply cxx-interop settings to swift targets directly
Instead of using a global setting, let's set this per-target. This
prevents conflicts when importing third-party dependencies that do
not tolerate the mode being "default".
2024-08-28 21:27:35 -06:00
Andrew Kaster c5153cb398 Meta+Libraries+AK: Append Cxx to imported library module names in swift
At the same time, simplify CMakeLists magic for libraries that want to
include Swift code in the library. The Lib-less name of the library is
now always the module name for the library with any Swift additions,
extensions, etc. All vfs overlays now live in a common location to make
finding them easier from CMake functions. A new pattern is needed for
the Lib-less modules to re-export their Cxx counterparts.
2024-08-27 17:22:31 -06:00
Andrew Kaster f27d638e0a CMake: Always use a target for linking skia 2024-08-27 17:22:31 -06:00
Tim Ledbetter 53ab6fa403 LibWeb: Stub the ServiceWorkerContainer interface 2024-08-25 09:48:30 +02:00
Tim Ledbetter 0c0a4a6042 LibWeb: Stub the ServiceWorkerRegistration interface 2024-08-25 09:48:30 +02:00
Tim Ledbetter 70fdf7affb IDLGenerators: Add register to the list of C++ keywords
This ensures that a generated C++ method called `register` will have an
underscore appended to it, avoiding a compile error.
2024-08-25 09:48:30 +02:00
Andrew Kaster 4ba274691e CMake: Add script to FetchContent the swift-collections library
It requires a few patches on top of the latest release to play nice
with our CMake setup.
2024-08-24 19:14:09 -06:00
Andrew Kaster c1c7e5ff3e AK+Meta: Add SwiftAK module to add helpers to construct swift Strings
This allows constructing Foundation.Data and Swift.String without
unnecessary copies from AK.StringView and AK.String respectively.
2024-08-24 19:14:09 -06:00
Jamie Mansfield 169163b002 LibWeb/EntriesAPI: Implement FileSystemEntry 2024-08-24 14:53:11 +02:00
Timothy Flynn 8865d18a67 LibWeb: Allow callback parameters to be nullable
This is needed for DataTransferItem's getAsString(callback?) prototype.
2024-08-23 10:10:34 +01:00
Timothy Flynn 74d9cfbf2a LibWeb: Implement DataTransferItemList.prototype.add() 2024-08-22 14:21:13 +02:00
Timothy Flynn 0b0d44da27 LibWeb: Implement the ClipboardEvent IDL interface
We don't actually generate any such events ourselves. But Google Lens
will create one with the DataTransfer attribute set to that of any drop
event we send it.
2024-08-22 14:21:13 +02:00
Timothy Flynn 268d6dda2f LibWeb: Sort list of imported namespaces 2024-08-22 14:21:13 +02:00
Sam Atkins 3af6a69f1e LibWeb: Introduce color-function-specific style values
Instead of CSSColorValue holding a Gfx::Color, make it an abstract class
with subclasses for each different color function, to match the Typed-OM
spec. This means moving the color calculations from the parsing code to
the `to_color()` method on the style value.

This lets us have calc() inside a color function, instead of having to
fully resolve the color at parse time. The canvas fillStyle tests have
been updated to reflect this.

The other test change is Screenshot/css-color-functions.html: previously
we produced slightly different colors for an alpha of 0.5 and one of
50%, and this incorrect behavior was baked into the test. So now it's
more correct. :^)
2024-08-21 10:51:48 +01:00
Sam Atkins 581d00293c LibWeb: Rename ColorStyleValue -> CSSColorValue
This matches the name in the CSS Typed OM spec.
https://drafts.css-houdini.org/css-typed-om-1/#csscolorvalue

This is not (yet) the same as the CSSColorValue, but one step at a time.
2024-08-21 10:51:48 +01:00
Andreas Kling aabad3b94e LibGfx: Remove a bunch of no-longer-used OpenType font code
We're not quite ready to remove the old OpenType implementation yet,
but let's carve off some unused stuff.
2024-08-20 09:30:05 +02:00
Andreas Kling c8f09312f7 LibGfx: Rename Path => DeprecatedPath 2024-08-20 09:30:05 +02:00
Andreas Kling 0c7670b226 LibGfx: Rename Painter => DeprecatedPainter 2024-08-20 09:30:05 +02:00
Andrew Kaster d105b1d4f8 LibWeb: Generate a clang module map file, including generated headers 2024-08-19 12:56:55 +02:00
Andrew Kaster 804729fe37 Libraries+Ladybird: Rename LibProtocol -> LibRequests
The identifier "Protocol" is claimed by Objective-C and Swift for use
by the language's built-in protocol conformance feature, which is
similar to Rust traits or Java interfaces.

Rename LibProtocol -> LibRequests, and its namespace from Protocol to
Requests to accomodate this.
2024-08-19 12:56:55 +02:00
Braydn a94bf9bd09 LibThreading: ThreadPool deadlock test
Enable `LibThreading` tests and add a test to check for deadlocks in
`ThreadPool`s
2024-08-19 03:08:04 +02:00
Andrew Kaster 7f0044a721 CMake: Add helper to swiftify imported properties from dependencies
Works around https://gitlab.kitware.com/cmake/cmake/-/issues/26195
2024-08-17 17:44:37 -06:00
Tim Ledbetter 335d51d678 IDLGenerators: Make USVString attribute reflection spec compliant
USVString attributes Now replace any surrogates with the replacement
character U+FFFD and resolve any relative URLs to an absolute URL. This
brings our implementation in line with the specification.
2024-08-17 07:45:00 +02:00
Tim Ledbetter a859b3610d Meta: Use QT_QPA_PLATFORM offscreen in WPT.sh
This has better compatibility with MacOS.
2024-08-17 07:43:29 +02:00
Tim Ledbetter 961ad3c8e9 Meta: Use correct binary paths for MacOS in WPT.sh 2024-08-17 07:43:29 +02:00
Tim Ledbetter 29886b804d Meta: Use cross-platform method to get number of CPUs in WPT.sh 2024-08-17 07:43:29 +02:00
Tim Ledbetter 819f966419 Meta: Ensure required hosts are present before running tests in WPT.sh
The Web Platform Tests runner requires that some hostnames point to
localhost when running the tests locally. We now append these hostnames
to `/etc/hosts` if they aren't already present.
2024-08-17 07:43:29 +02:00
Jamie Mansfield ea61e189eb LibWeb/SVG: Add missing SVGGElement IDL file 2024-08-17 07:41:04 +02:00
Jamie Mansfield e2f599ebee LibWeb/SVG: Implement <metadata> element 2024-08-17 07:40:45 +02:00
Jamie Mansfield e3b3041a0c LibWeb: Implement NavigatorStorage mixin interface
Co-authored-by: Tim Flynn <trflynn89@serenityos.org>
2024-08-16 11:22:09 -04:00
Jamie Mansfield 1b84062c74 LibWeb: Stub StorageManager idl interface 2024-08-16 11:22:09 -04:00
Sam Atkins 6a74b01644 LibWeb: Rename "identifier" and "ValueID" to "Keyword" where correct
For a long time, we've used two terms, inconsistently:
- "Identifier" is a spec term, but refers to a sequence of alphanumeric
  characters, which may or may not be a keyword. (Keywords are a
  subset of all identifiers.)
- "ValueID" is entirely non-spec, and is directly called a "keyword" in
  the CSS specs.

So to avoid confusion as much as possible, let's align with the spec
terminology. I've attempted to change variable names as well, but
obviously we use Keywords in a lot of places in LibWeb and so I may
have missed some.

One exception is that I've not renamed "valid-identifiers" in
Properties.json... I'd like to combine that and the "valid-types" array
together eventually, so there's no benefit to doing an extra rename
now.
2024-08-15 13:58:38 +01:00
Sam Atkins 9559f0f123 LibWeb: Rename IdentifierStyleValue -> CSSKeywordValue
This matches the name in the CSS Typed OM spec.
https://drafts.css-houdini.org/css-typed-om-1/#csskeywordvalue
2024-08-15 13:58:38 +01:00
Sam Atkins 0e3487b9ab LibWeb: Rename StyleValue -> CSSStyleValue
This matches the name in the CSS Typed OM spec.
https://drafts.css-houdini.org/css-typed-om-1/#cssstylevalue

No behaviour changes.
2024-08-15 13:58:38 +01:00
Tim Ledbetter c9caa4262e Meta: Add a script to run the Web Platform tests locally
This change adds a script that can run the Web Platform Tests and
compare different test runs.
2024-08-13 14:10:56 +02:00
Francesco Gazzetta d6303c9da9 CMake: Fix invalid target when using system skia
Commit 35392d4d28 moved the
target_*_directories() calls (or rather their include()) before the
target declaration, so they fail because of the undefined target.
We can fix the problem by using global *_directories() instead.
2024-08-12 18:20:34 +02:00
BenJilks 0ca5675d59 LibTextCodec: Implement iso-2022-jp encoder
Implements the `iso-2022-jp` encoder, as specified by
https://encoding.spec.whatwg.org/#iso-2022-jp-encoder
2024-08-08 17:49:58 +01:00
BenJilks d80575a410 LibTextCodec: Implement gb18030 and gbk encoders
Implements the `gb18030` and `gbk` encoders, as specified by
https://encoding.spec.whatwg.org/#gb18030-encoder
https://encoding.spec.whatwg.org/#gbk-encoder
2024-08-08 17:49:58 +01:00
BenJilks 826292536c LibTextCodec: Implement euc-kr encoder
Implements the `euc-kr` encoder, as specified by
https://encoding.spec.whatwg.org/#euc-kr-encoder
2024-08-08 17:49:58 +01:00