Commit graph

3481 commits

Author SHA1 Message Date
Nico Weber
bcff78ceee Meta: Add WebDriver/{Actions,InputSource,InputState}.cpp to the GN build 2024-11-24 19:40:10 -05:00
Nico Weber
1699ec259f Meta: Add WebDriver/ElementReference.cpp to GN build 2024-11-24 15:19:49 -05:00
implicitfield
c98071dd69 CMake: Remove all uses of globs in conventional builds
This also makes the Shell tests run on Lagom again, as they have been
silently skipped ever since d46be35f (which moved the tests but didn't
update the glob.)
2024-11-23 23:50:17 -05:00
implicitfield
72b2e40ce1 Meta: Dereference headers when building the root file system
This is in preparation for installing LibC headers into the sysroot as
symlinks rather than as plain copies.
2024-11-23 23:50:17 -05:00
Luke Wilde
67e65204b5 LibWeb: Add CMake dependencies for GeneratedCSSStyleProperties.idl
Co-Authored-By: Andrew Kaster <andrew@ladybird.org>
(cherry picked from commit c0ae3aa884290a2814bb2fa151cd8f89179b4912)
2024-11-23 22:07:22 -05:00
Nico Weber
e4ee3d1692 Meta: Port GenerateCSSStyleProperties changes to GN 2024-11-23 22:07:22 -05:00
Jonne Ransijn
3eabeaa198 LibIDL: Fix use-after-free in GenerateWindowOrWorkerInterfaces
`lexical_bases` was storing `StringView`s into `ByteString`s returned
from `LexicalPath::string()` that might no longer exist.

(cherry picked from commit c3783cf3bd8261b6f456cd9f796cc6a0b03096ee)
2024-11-23 22:07:22 -05:00
Luke Wilde
772be9dec0 LibWeb: Generate IDL attributes for all supported CSS properties
The CSSOM spec tells us to potentially add up to three different IDL
attributes to CSSStyleDeclaration for every CSS property we support:
- A camelCased attribute, where a dash indicates the next character
  should be uppercase
- A camelCased attribute for every -webkit- prefixed property, with the
  first letter always being lowercase
- A dashed-attribute for every property with a dash in it.

Additionally, every attribute must have the CEReactions and
LegacyNullToEmptyString extended attributes specified on it.

Since we specify every property we support with Properties.json, we can
use that file to generate the IDL file and it's implementation.

We import it from the Build directory with the help of multiple import
base paths. Then, we add it to CSSStyleDeclaration via the mixin
functionality and inheriting the generated class in
CSSStyleDeclaration.

(cherry picked from commit aacf9b08ed8c4286c84145b52fa70f399ed0bdff;
amended to fix tiny conflict in libweb_generators.cmake, and to change
the default value of all gap-related properties from 'auto' to 'normal'
since serenity does not yet have LadybirdBrowser/ladybird#2253 and
cherry-picking that has a pretty long dependency tree. It's easy to
update the test once that is cherry-picked)
2024-11-23 22:07:22 -05:00
Luke Wilde
3ce2605096 LibIDL: Allow overwriting the generated attribute callback name
This will allow the CSSStyleDeclaration IDL attribute generator to
implement it's own C++ acceptable identifier sanitization and
deduplication.

(cherry picked from commit d95ae629ee03b99d39930ee5806739622dc8cee6)
2024-11-23 22:07:22 -05:00
Luke Wilde
c0adae8d7d LibIDL: Support multiple import base paths for resolving imports
This allows us to specify multiple base paths to look for imported IDL
files in. This will allow us to import IDL files from sources and from
the Build directory (i.e. for generated IDL files).

(cherry picked from commit 300f212044e5475a8e14c585a79c0b5bb56688f4)
2024-11-23 22:07:22 -05:00
Nico Weber
0197bfcadf LibUnicode+LibWeb: Rework bidirectional_class() API a bit
Before this commit, GenerateUnicodeData generated a
`BidirectionalClass` enum directly from UnicodeData.txt.

Now, GenerateUnicodeData instead generates `BidirectionalClassInternal`
and CharacterTypes.h has an explicit enum `BidiClass` with nicer names
-- no underscores, but also names more similar to ICUs names.

(Since CharacterTypes.h is included in some of LibUnicode's generators,
it can't refer to generated `BidirectionalClassInternal`, so we instead
have a big manual mapping switch in UnicodeData.cpp.)

`bidirectional_class()` used to return an `Optional<BidirectionalClass>`
for when unicode data was disabled. Now we return `BidiClass` and
just return `BidiClass::LeftToRight` instead of making every client
do this.

It also updates LibWeb's Element.cpp to this new system.

Also remove now-unused `bidirectional_class_from_string()`.

This kind of cherry-picks the 4th commit of
LadybirdBrowser/ladybird#239 (aa3a30870b58c47cb37bce1418d7e6bee7af71d9):
The CharacterTypes.h, Element.cpp and TestUnicodeCharacterTypes.cpp changes are
by trflynn.

Co-authored-by: Tim Flynn <trflynn89@serenityos.org>
2024-11-23 19:24:11 -05:00
Nico Weber
aff777c5e0 Meta: Use property aliases for BidirectionalClass enum values
Changes the generated UnicodeData.h from

    enum class BidirectionalClass : BidirectionalClassUnderlyingType {
        AL,
        AN,
        B,
        ...
    };

to

    enum class BidirectionalClass : BidirectionalClassUnderlyingType {
        AL,
        AN,
        B,
        ...
        Arabic_Letter = AL,
        Arabic_Number = AN,
        Boundary_Neutral = BN,
        ...
    };
2024-11-23 19:24:11 -05:00
Sönke Holz
d56cedf3cd Kernel/aarch64: Use generic kprintf.cpp 2024-11-23 19:29:50 +01:00
Ali Mohammad Pur
03e1dfb620 Meta: Delete jakt toolchain in delete_toolchain too 2024-11-22 19:43:12 +01:00
Andreas Kling
9b4db4a0e0 LibWeb: Make DOMException take error message as a String
There was no need to use FlyString for error messages, and it just
caused a bunch of churn since these strings typically only existed
during the lifetime of the error.

(cherry picked from commit 175f3febb8037a440d4ead7347d3266ee3d345e1;
minorly amended to fix conflict in WebSocket.cpp due to serenity
not having the adapter class removal in LadybirdBrowser/ladybird#1671)
2024-11-22 11:13:42 -05:00
Andrew Kaster
9448fe10da LibWeb: Implement most of Service Worker registration
This approach will need some rework to be properly handled at the user
agent level instead of per renderer process, but it's a start.

(cherry picked from commit 7faebb2702a2a19fc401fde1856a0d90861d2904)
2024-11-22 08:47:53 -05:00
Aliaksandr Kalenik
ff4c99ec0a Meta+Tests: Substitute Ahem font path in import-wpt-test.py
(cherry picked from commit 3833049fc8680d4e6349511cf566f27a25225ada)
2024-11-21 22:16:48 -05:00
sideshowbarker
c4b4f293e9 Meta: Make import-wpt-test.py use html.parser, not BeautifulSoup
This change switches the Meta/import-wpt-test.py script to using the
standard html.parser module rather than BeautifulSoup.

Otherwise, without this change, when a contributor first tries to run
the script, if they don’t have BeautifulSoup installed, it will fail.

Note that this patch also includes an unrelated small change that
switches to using os.path.normpath — rather than Path.absolute() — to
“normalize” the destination names of the downloaded test files.

(cherry picked from commit 286511c4cf9dcd985882c9bbb2de42b01e7494a9)
2024-11-21 22:16:48 -05:00
sideshowbarker
c5b9ce19eb Meta: Make import-wpt-test.py resolve “..” parent refs in URLs/pathnames
This change makes the Meta/import-wpt-test.py script handle URLs such as
https://wpt.live//WebCryptoAPI/generateKey/../util/helpers.js and paths
containing, e.g., wpt-import/WebCryptoAPI/generateKey/../util/helpers.js
(that is, URLs and paths with “..” parent-directory references in them).

Otherwise, without this change, when the import-wpt-test.py script tries
a URL like https://wpt.live//WebCryptoAPI/generateKey/../util/helpers.js
which contains a “..” parent-directory reference, the script fails with
a “urllib.error.HTTPError: HTTP Error 404: Not Found” error message.

(cherry picked from commit cf7a1f6a5297f4b01a98a39a3d9da6dd4cbcf5d2)
2024-11-21 22:16:48 -05:00
stelar7
4181fe7453 Meta: Add a script to import WPT tests
(cherry picked from commit 5630a0d6b44c3599f8a70b07dc294080dcb50ae1)
2024-11-21 22:16:48 -05:00
Andreas Kling
8c1596ca62 Meta: Ignore LibWeb text tests for newline-at-eof check
(cherry picked from commit 85bf1d6033c6de3de4761e18e0b0992a8814d705)
2024-11-21 22:16:48 -05:00
Nico Weber
fec88bd121 Meta: Update GN build for Origin.cpp move from LibWeb to LibURL 2024-11-21 22:16:27 -05:00
Shannon Booth
2855880f8a LibWeb+LibURL: Move HTML::Origin to URL::Origin
While Origin is defined in the HTML spec - this leaves us with quite an
awkward relationship as the URL spec makes use of AO's from what is
defined in the HTML spec.

To simplify this factoring, relocate Origin into LibURL.

(cherry picked from commit dc401f49ea7e861064484e79594e35c3d93000ae;
amended to fix minor conflicts due to serenity not (yet?) having a
LibUnicode/Segmenter.h include in Document.cpp, and due to
BrowsingContext already having LadybirdBrowser/ladybird#2358 in
serenity)
2024-11-21 22:16:27 -05:00
Shannon Booth
d6d8ce68c8 LibWeb: Correct attributes on IDL interface 'operations'
This fixes four tests for the IDL harness for URL under:

https://wpt.live/url/idlharness.any.html
and https://wpt.live/url/idlharness.any.worker.html

But probably some tests in other places too :^)

(cherry picked from commit e9dd05b2b52aa6363b5c5e2e90099b8e1c28e868)
2024-11-21 22:16:27 -05:00
Shannon Booth
049fcbd810 LibWeb: Factor out function to define the 'operations' on an interface
(cherry picked from commit fb2b78620d7db7b969c29624d0cc183222441e9c)
2024-11-21 22:16:27 -05:00
Sönke Holz
b0503607d9 Meta: Try to download files with gzip compression in download_file.py
This makes downloading emoji-test.txt a lot faster.
2024-11-21 10:08:16 +01:00
Sönke Holz
be9c0921ff Meta: Use download_file.py for the CMake build
This required making the `-v` and `-f` arguments optional.
2024-11-21 10:08:16 +01:00
stelar7
c39fa9a033 LibWeb: Parse the rotate css property
(cherry picked from commit 488436fb54347e69040cfed4f523926241a136a3)
2024-11-19 11:02:38 -05:00
Lucas CHOLLET
5148cd3122 LibWeb/CSS: Start parsing the color() function
This is really bare bone as we only support the `xyz-d50` color space
for the moment.

It makes us pass the following WPT tests:
 - css/css-color/predefined-016.html
 - css/css-color/xyz-d50-001.html
 - css/css-color/xyz-d50-002.html

(cherry picked from commit 48bbebc636598eca905b8eef984ee2cba548ff64)
2024-11-18 20:22:45 -05:00
Lucas CHOLLET
12c57e3026 LibWeb/CSS: Introduce a base class for LCH-based color values
This will be used by both CSSLCH and CSSOKLCH.

(cherry picked from commit e8fc731b8cde75a0af9571a3b491f6149038ea21)
2024-11-18 13:21:10 -05:00
Nico Weber
bb2ce8b993 Meta: Add CSSNestedDeclarations to GN 2024-11-18 09:48:28 -05:00
Lucas CHOLLET
b49cc740e8 LibWeb/CSS: Make CSSOKLab inherit from a new CSSLabLike class
This class provides the common base for both CSSOKLab and the future
CSSLab classes.

(cherry picked from commit 8efa046e0c56d970cabe5644e0e8b4eef85013c3)
2024-11-18 09:07:51 -05:00
Sam Atkins
fe9ab2c91e LibWeb/CSS: Rewrite CSS Parser core methods according to new spec
CSS Syntax 3 (https://drafts.csswg.org/css-syntax) has changed
significantly since we implemented it a couple of years ago. Just about
every parsing algorithm has been rewritten in terms of the new token
stream concept, and to support nested styles. As all of those
algorithms call into each other, this is an unfortunately chonky diff.

As part of this, the transitory types (Declaration, Function, AtRule...)
have been rewritten. That's both because we have new requirements of
what they should be and contain, and also because the spec asks us to
create and then gradually modify them in place, which is easier if they
are plain structs.

(cherry picked from commit e0be17e4fbf1870f35614d0cde8f63e72f78bd16;
amended to tweak test expectation due to serenity not yet having
LadybirdBrowser/ladybird#1603)
2024-11-17 22:08:57 -05:00
Sam Atkins
962207a2db LibWeb/CSS: Bring TokenStream in line with spec
When the TokenStream code was originally written, there was no such
concept in the CSS Syntax spec. But since then, it's been officially
added, (https://drafts.csswg.org/css-syntax/#css-token-stream) and the
parsing algorithms are described in terms of it. This patch brings our
implementation in line with the spec. A few deprecated TokenStream
methods are left around until their users are also updated to match the
newer spec.

There are a few differences:

- They name things differently. The main confusing one is we had
  `next_token()` which consumed a token and returned it, but the spec
  has a `next_token()` which peeks the next token. The spec names are
  honestly better than what I'd come up with. (`discard_a_token()` is a
  nice addition too!)

- We used to store the index of the token that was just consumed, and
  they instead store the index of the token that will be consumed next.
  This is a perfect breeding ground for off-by-one errors, so I've
  finally added a test suite for TokenStream itself.

- We use a transaction system for rewinding, and the spec uses a stack
  of "marks", which can be manually rewound to. These should be able to
  coexist as long as we stick with marks in the parser spec algorithms,
  and stick with transactions elsewhere.

(cherry picked from commit b645e26e9b29437c0e248b5e43e3ec76aacf960d)
2024-11-17 18:57:30 -05:00
Nico Weber
6c341b9819 Meta: Add more commits and PRs to lb-cherry-picks.py
Also implement a consistency check for never_merge_commits,
and move one commit from it to never_merge_prs that was failing
that check.
2024-11-17 15:05:50 -05:00
Shannon Booth
be9872c3fd LibWeb: Add support for dictionaries in overload resolution
By making use of the known set of supported dictionary names in that
overload set. Note that this list is typically very small (the max that
we have currently is 1).

(cherry picked from commit 70599d3f8d015ca0e5c704e8b0afad85a0f2fa1a)
2024-11-17 13:47:42 -05:00
Shannon Booth
c48cc68197 LibWeb: Verify that all overloads contain Unscopable if present
It would be strange for the IDL to be defined as such, so instead of
leaving a FIXME comment, let's just verify that this doesn't happen in
practise incase it does end up happening in reality.

(cherry picked from commit 013c2a1c7cda0d5921e2368e5de3a65ed9208625)
2024-11-17 13:47:42 -05:00
Andrew Kaster
eac6c59e68 LibWeb: Add ServiceWorker job registration and execution
Now we can register jobs and they will be executed on the event loop
"later". This doesn't feel like the right place to execute them, but
the spec needs some updates in this regard anyway.

(cherry picked from commit 29416befe640eae7bf44b72e3f4ad42a1e397701)
2024-11-17 13:47:42 -05:00
Nico Weber
2a3333bf17 Meta: Add ServiceWorker-related files to GN 2024-11-17 11:03:57 -05:00
Nico Weber
9f8db75b2a Meta: Let LibWebView link to LibSyntax, add Document to LibSyntax in GN 2024-11-16 14:05:12 -05:00
Nico Weber
4678fc1029 Meta: Add StyleSheetIdentifier.cpp to the GN build 2024-11-15 23:10:03 -05:00
Sam Atkins
5d86305596 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.

(cherry picked from commit 8cbc2116162764479edeec78e4b2b7c41447b643;
amended to fix conflicts in two cmake files, due to serenity
still having more code_generators, and still buildling
OutOfProcessWebView.cpp. Also kept embed_as_string_view because
it's used by stringify_gml. Did this by giving embed_as_string.py
a --type= argument that defaults to string but can also be set
to string-view.)
2024-11-15 23:10:03 -05:00
Andrew Kaster
05fffee336 CMake: Move ca_certificate_download include up with other downloads
(cherry picked from commit 82b73b2eee8448e07925909720191bb3bbdac670)
2024-11-15 08:56:56 -05:00
stelar7
25374a193c LibWeb/Meta: Adjust how missing/invalid default values are generated
(cherry picked from commit d81f31c6993a422e02d48b02872de436a07e73b7)
2024-11-14 17:46:06 -05:00
Jelle Raaijmakers
35f4f5cf54 LibWeb: Implement AudioListener
This exposes BaseAudioContext.listener, which is a container for
parameters related to the configuration of an actual "listener" in 3D
space.

(cherry picked from commit 2a98f2a12d5069a2189fa38b4a7e158d84ee03ec)
2024-11-14 17:46:06 -05:00
sin-ack
23e49f2835 BindingsGenerator: Handle global interfaces without named properties
DedicatedWorkerGlobalScope is an object with a Global extended
attribute, but does not define any named property getters. This needs to
be handled by setting the prototype chain to:

    DedicatedWorkerGlobalScope
    ^ DedicatedWorkerGlobalScopePrototype
    ^ WorkerGlobalScopePrototype

(This is different from something like Window, where there is an
intermediate WindowProperties object for named properties.)

Previously, we treated the GlobalMixin object as if it was a simple
prototype object, accidentally setting DedicatedWorkerGlobalScope's
prototype to WorkerGlobalScopePrototype. This caused the expression

    self instanceof DedicatedWorkerGlobalScope

to return false inside workers.

This makes us pass many more of the "/xhr/idlharness.any.worker" WPT
tests than before, rather than failing early.

(cherry picked from commit d5948709cd499ef0e7bfa3c24e8c03befed115fe)
2024-11-14 17:46:06 -05:00
Nico Weber
5dbc8f8481 Meta: Add new WebGL source files to GN build as well
LadybirdBrowser/ladybird#2308 updated idl_files.gni,
but not the actual build file.
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
b67c8d138c LibWeb: Add WebGLShaderPrecisionFormat
(cherry picked from commit 3d8ab0e67c707062e4d889598fbd176fa0c6fce8)
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
b288bfd994 LibWeb: Add WebGLActiveInfo
(cherry picked from commit d63a979bde54ad93422c2fadb5cf24cbc3339e07)
2024-11-13 19:32:27 -05:00
Jelle Raaijmakers
59ed552646 LibWeb: Add WebGLUniformLocation
(cherry picked from commit 889e7942fa090a240743d3b53ab2bc5288e064c3)
2024-11-13 19:32:27 -05:00