Commit graph

4048 commits

Author SHA1 Message Date
Sam Atkins
f97ac33cb3 LibWeb/CSS: Use NumericCalculationNode for constants
Having multiple kinds of node that hold numeric values made things more
complicated than they needed to be, and we were already converting
ConstantCalculationNodes to NumericCalculationNodes in the first
simplification pass that happens at parse-time, so they didn't exist
after that.

As noted, the spec allows for other contexts to introduce their own
numeric keywords, which might be resolved later than parse-time. We'll
need a different mechanism to support those, but
ConstantCalculationNode could not have done so anyway.
2025-02-27 21:42:43 +01:00
Andreas Kling
8ab61843be LibWeb: Parse CSS fit-content(<length-percentage>) values
Before this change, we only parsed fit-content as a standalone keyword,
but CSS-SIZING-3 added it as a function as well. I don't know of
anything else in CSS that is overloaded like this, so it ends up looking
a little awkward in the implementation.

Note that a lot of code had already been prepped for fit-content values
to have an argument, we just weren't parsing it.
2025-02-27 00:44:14 +01:00
Sam Atkins
c729c3fcee LibWeb/CSS: Add custom-ident blacklists to Properties.json
These excluded values use a similar notation to the ranges for numeric
types: `![foo,bar,baz]` to exclude `foo`, `bar`, and `baz`.
2025-02-26 11:22:47 +00:00
Luke Wilde
198cec481a LibWeb: Allow null for optional, nullable, no default value union types
For these types, it would previously only accept `undefined` for the
`null` state.

Fixes GET requests in the Turbo library always failing:
9e057f284a/src/http/fetch_request.js (L219-L220)
9e057f284a/src/http/fetch_request.js (L51-L64)

This was found on https://www.fangamer.com/.
2025-02-22 18:45:27 +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
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
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
Andrew Kaster
13338a9532 CMake: Ensure build and test presets for Distribution and Debug 2025-02-21 12:05:18 +01: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
bc54c0cdfb AK+Everywhere: Store JSON strings as String 2025-02-20 19:27:51 -05:00
Timothy Flynn
e591636419 AK+Everywhere: Store JSON object keys as String 2025-02-20 19:27:51 -05: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
Psychpsyo
3b577e6135 Meta: Improve IDL generator for dictionary members
This makes it so that the IDL generator no longer assumed that
dictionary members with a default value are optional, since they
will always, at least, have the default value.
2025-02-18 10:18:40 -07:00
devgianlu
0926720c2a LibDNS: Add basic DNS::Resolver tests 2025-02-18 15:46:44 +01:00
devgianlu
7fb15ef936 LibCrypto: Remove unused Poly1305 class 2025-02-18 00:02:26 +01:00
devgianlu
ce3e79a402 LibCrypto: Remove unused ChaCha20Poly1305 class 2025-02-18 00:02:26 +01:00
devgianlu
bc0bb0d535 LibCrypto: Remove unused Certificate class 2025-02-18 00:02:26 +01:00
Sam Atkins
71cb04d8cb IPCCompiler: Allow arguments to not be default-constructible
All fields are always initialized, so we don't need to initialize them
by default. This lets us send types over IPC that can't be
default-constructed, such as a Variant without Empty.
2025-02-17 11:37:38 -05:00
Sam Atkins
b3b7e76c10 IPCCompiler: Remove invalid state from IPC message classes
At some point, we stopped ever constructing invalid messages. This makes
that clearer, and will allow us to stop requiring that IPC arguments be
default-constructible.
2025-02-17 11:37:38 -05:00
stasoid
4ae3522b10 LibCore: Implement System::socketpair on Windows 2025-02-14 09:38:59 -07: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
InvalidUsernameException
0a9c66ef07 Meta: Make missing optipng fatal in CI 2025-02-12 17:37:42 +00:00
InvalidUsernameException
a00a5c9ac5 Meta: Remove unused, defunct lint script leftover from SerenityOS 2025-02-12 17:37:42 +00:00
Shannon Booth
ba382c454a LibWeb/Bindings: Allow optional string returned in a union
This is not a very pleasant fix, but matches a similar const_cast that
we do to return JS objects returned in a union. Ideally we would
'simply' remove the const from the value being visited in the variant,
but that opens up a whole can of worms where we are currently relying on
temporary lifetime extension so that interfaces can return a Variant of
GC::Ref's to JS::Objects.
2025-02-10 17:05:15 +00:00
Shannon Booth
f3ec727555 LibWeb/Bindings: Support returning nullable types in dictionaries
We were previously assuming that dictionary members were always
required when being returned.

This is a bit of a weird case, because unlike _input_ dictionaries
which the spec marks as required, 'result' dictionaries do not seem to
be marked in spec IDL as required. This is still fine from the POV that
the spec is written as it states that we should only be putting the
values into the dictionary if the value exists.

We could do this through some metaprogramming constexpr type checks.
For example, if the type in our C++ representation was not an
Optional, we can skip the has_value check.

Instead of doing that, change the IDL of the result dictionaries to
annotate these members so that the IDL generator knows this
information up front. While all current cases have every single
member returned or not returned, it is conceivable that the spec
could have a situation that one member is always returned (and
should get marked as required), while the others are optionally
returned. Therefore, this new GenerateAsRequired attribute is
applied for each individual member.
2025-02-10 17:05:15 +00:00
Shannon Booth
64a2c156bb LibWeb/Bindings: Generate dictionary in bindings in a C++ scope
This fixes a compile error of multiple variables of the same name within
the same scope for the URLPattern IDL, which has a dictionary return
type that contains multiple dictionaries of the same type. Conveniently,
this also makes the complicated generated code of the URLPattern
interface easier to read by adding some more structure :^)
2025-02-10 17:05:15 +00:00
Shannon Booth
69f0120833 LibWeb/Bindings: Add support for converting records to javascript 2025-02-10 17:05:15 +00:00
Undefine
0c882c441e LibCompress: Remove unused Lzma compression and decompression 2025-02-10 16:22:32 +00:00
Undefine
f30fd8af4c LibCompress: Remove unused Lzma2 decompression 2025-02-10 16:22:32 +00:00
Undefine
a49b7c0125 LibCompress: Remove unused Xz decompression 2025-02-10 16:22:32 +00:00
Undefine
50d4479ddb LibCompress: Remove unused brotli decompression 2025-02-10 16:22:32 +00:00
Luke Wilde
958938655d LibWeb/WebGL: Implement WEBGL_compressed_texture_s3tc extension 2025-02-09 01:00:51 +01:00
Luke Wilde
484008d440 LibWeb/WebGL: Implement compressedTex(Sub)Image2D 2025-02-09 01:00:51 +01:00
Luke Wilde
f1b81b1ae2 LibWeb/WebGL2: Implement getActiveUniforms 2025-02-09 01:00:51 +01:00
Luke Wilde
071a445015 LibWeb/WebGL2: Implement drawArraysInstanced 2025-02-09 01:00:51 +01: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
Luke Wilde
f1801fb1d2 LibWeb: Make namespace attributes writable and configurable by default
This matches the prototype attributes.

Used by https://chatgpt.com/, where it runs this code:
```js
CSS.supports('animation-timeline: --works')
```
If this returns false, it will attempt to polyfill Animation Timeline
and override CSS.supports to support Animation Timeline properties.
2025-02-07 15:36:02 +01:00
Sam Atkins
6a4d80b9b6 LibWeb/CSS: Integrate ParsingContext into the Parser
This is not really a context, but more of a set of parameters for
creating a Parser. So, treat it as such: Rename it to ParsingParams,
and store its values and methods directly in the Parser instead of
keeping the ParsingContext around.

This has a nice side-effect of not including DOM/Document.h everywhere
that needs a Parser.
2025-02-06 16:47:25 +00:00
Sam Atkins
1413760047 LibWeb/CSS: Split up Parser.cpp
This file has been a pain to edit for a while, even with the previous
splits. So, I've divided it up into 3 parts:
- Parser.cpp has the "base" code. It's the algorithms and entry-points
  defined in the Syntax spec.
- ValueParsing.cpp contains code for parsing single values, such as a
  length, or a color, or a calculation.
- PropertyParsing.cpp contains code for parsing an entire property's
  value. A few of these sit in a grey area between being a property's
  value and a value in their own right, but the rule I've used is "is
  this useful outside of a single property and its shorthands?"

This only moves code, with as few modifications as possible to make that
work. I did add explicit instantiations for the template implementations
as part of this, which revealed a few that are actually only compatible
with a single type, so I'll clear those up in a subsequent commit.
2025-02-06 16:47:25 +00:00
Andrew Kaster
c7fe7b09a5 Meta: Open files with explicit encoding in check-style.py 2025-02-05 17:35:10 -07:00
Psychpsyo
9b8120d8e8 Meta: Disallow links to single-page HTML spec 2025-02-05 16:04:50 -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
devgianlu
9f7bdaf3b4 Meta: Handle formatting of IPC partial dictionary syntax 2025-02-05 13:18:47 -07:00
devgianlu
da9eaf8788 LibWeb: Stub for Credential Management API
Stub out basic Credential Management APIs and import IDL tests.

Spec: https://w3c.github.io/webappsec-credential-management/
2025-02-05 13:18:47 -07:00
devgianlu
e14511468f IDLGenerators: Do not generate required dictionary members as Optional 2025-02-05 13:18:47 -07:00
devgianlu
348db1c445 LibIDL+IDLGenerators: Support generation of IDL partial dictionaries 2025-02-05 13:18:47 -07:00