Commit graph

2231 commits

Author SHA1 Message Date
Totto16
4c54fa10ed LibWeb: Improve Enum generation in IDLGenerator
Generated enums have no underlying type specifier, this adds one
It uses the smallest available, which is mostly u8
2025-03-04 16:35:04 +00:00
Luke Wilde
6cb0f41c57 LibWeb/WebGL: Return from uniform methods if location is null
If location is null, the spec simply tells us to return and ignore the
passed in data.

Fixes #3708.
2025-03-03 08:43:33 +01:00
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
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
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
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
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
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
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
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
Sam Atkins
c3d61020e7 LibWeb/CSS: Make CalculationNodes ref-counted
Calc simplification (which I'm working towards) involves repeatedly
deriving a new calculation tree from an existing one, and in many
cases, either the whole result or a portion of it will be identical to
that of the original. Using RefPtr lets us avoid making unnecessary
copies. As a bonus it will also make it easier to return either `this`
or a new node.

In future we could also cache commonly-used nodes, similar to how we do
so for 1px and 0px LengthStyleValues and various keywords.
2025-01-30 19:31:54 +01:00
Shannon Booth
d4649db55e LibWeb/URLPattern: Add initial stub for URLPattern interface 2025-01-27 18:07:17 +00:00
Luke Wilde
d915b574ab LibWeb/WebGL: Implement pixel format conversion for TexImageSource
This is done by using the combination of format and type to map to the
appropriate Skia bitmap type. With this, we then read the SkImage of
the TexImageSource into a new SkPixmap with the destination format
information and holding an appropriately sized buffer. Once created,
readPixels is called to convert and write the image into the buffer.
2025-01-21 21:36:05 +01:00
Luke Wilde
d13dd76818 LibWeb/WebGL: Map DEPTH_STENCIL to DEPTH24_STENCIL8 for WebGL 1 too 2025-01-21 21:36:05 +01:00
Luke Wilde
de77a5e3ea LibWeb/WebGL: Move extensions into their own folder 2025-01-21 21:36:05 +01:00
Luke Wilde
442f0b9a13 LibWeb/WebGL: Implement OES_vertex_array_object extension 2025-01-21 21:36:05 +01:00
Luke Wilde
4cb5a980e5 LibWeb/WebGL: Implement getAttachedShaders 2025-01-21 21:36:05 +01:00
Luke Wilde
aa99853a5c LibWeb/WebGL: Track the shaders attached to a program
This is required to return original references to the shaders attached
to a program from getAttachedShaders. This is required for Figma (and
likely all other Emscripten compiled applications that use WebGL) to
get it's own generated shader IDs from the shaders returned from
getAttachedShaders.
2025-01-21 21:36:05 +01:00
Timothy Flynn
85b424464a AK+Everywhere: Rename verify_cast to as
Follow-up to fc20e61e72.
2025-01-21 11:34:06 -05:00
Luke Wilde
927bdf909b LibWeb/WebGL2: Implement a bunch of parameters read by CreepJS
This also fixes GLfloat and GLboolean to use their appropriate glGet
functions.
2025-01-18 10:23:07 +01:00
Tim Ledbetter
aa39aa50f7 LibWeb: Add MediaElementAudioSourceNode interface 2025-01-17 19:04:47 +00:00
Andrew Kaster
7c3b590d44 LibWeb/WebGL2: Implement MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS
This is a parameter for getParameter()
2025-01-15 11:25:22 +00:00
Andrew Kaster
f5e06a2457 LibWeb/WebGL2: Implement MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS
This is a parameter for getParameter()
2025-01-15 11:25:22 +00:00
Sam Atkins
4e1aa96dce LibWeb/CSS: Use CalcSV's context to determine what percentages are
This lets us implement the `matches_number()` and `matches_dimension()`
methods of `CSSNumericType` to spec, instead of being an ad-hoc hack.
2025-01-13 10:59:16 +00:00
Sam Atkins
4efdb76857 LibWeb/CSS: Give calc() a CalculationContext for resolving percentages
This is passed in at construction, meaning we will be able to refer to
it later, when we're no longer inside the Parser.
2025-01-13 10:59:16 +00:00
Shannon Booth
dfdcfc8e88 LibWeb/Bindings: Generate undefined in a union as 'Empty'
This can only ever be undefined, and no other JS value, so it makes
sense to use undefined to represent this case.
2025-01-12 18:39:24 +00:00