Commit graph

1515 commits

Author SHA1 Message Date
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
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
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
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
Shannon Booth
64eeda6450 LibWeb: Return a representation of an 'Agent' in 'relevant agent'
This makes it more convenient to use the 'relvant agent' concept,
instead of the awkward dynamic casts we needed to do for every call
site.

mutation_observers is also changed to hold a GC::Root instead of raw
GC::Ptr. Somehow this was not causing problems before, but trips up CI
after these changes.
2025-01-11 10:39:48 -05:00
Tim Ledbetter
b6ec055bf9 IDLGenerators: Set Iterator @@toStringTag with correct descriptor 2025-01-11 10:02:48 -05:00
Shannon Booth
627b7dd936 LibWeb/Bindings: Define constructor properties in the correct order 2025-01-11 01:43:31 +00:00
Luke Wilde
876d26c32e LibWeb/WebGL: Respect subarrays in readPixels 2025-01-08 17:55:17 +03:00
Luke Wilde
71746c47c2 LibWeb/WebGL: Bind default frame/render buffer when binding is null
This fixes the depth issues on github.com, as the depth commands are
now sent to the right frame/render buffer.
2025-01-08 17:55:17 +03:00
Luke Wilde
e5d59a2d42 LibWeb/WebGL2: Implement getSyncParameter 2025-01-08 17:55:17 +03:00
Luke Wilde
6bf6cd3f19 LibWeb/WebGL: Account for subarrays in tex(Sub)Image{2D,3D}
This allows Ruffle to correctly upload textures.
2025-01-08 17:55:17 +03:00
Luke Wilde
2b20b8aaff LibWeb/WebGL: Return correct types from get{Shader,Program}Parameter
Returning numbers instead of booleans for the statuses made Ruffle
(through the wgpu crate) think a shader/program failed to compile/link,
as it does a strict type comparison.
2025-01-08 17:55:17 +03:00
Luke Wilde
c30c1d65f4 LibWeb/WebGL2: Implement clearBuffer{fv,iv,uiv,fi} 2025-01-08 17:55:17 +03:00
Luke Wilde
f627c91bf3 LibWeb/WebGL2: Implement deleteSampler 2025-01-08 17:55:17 +03:00
Luke Wilde
09ad685238 LibWeb/WebGL2: Implement samplerParameter{i,f} 2025-01-08 17:55:17 +03:00
Luke Wilde
aa2eb7ac7d LibWeb/WebGL2: Implement MAX_VARYING_COMPONENTS parameter 2025-01-08 17:55:17 +03:00
Luke Wilde
c4ff1a1eb0 LibWeb/WebGL2: Implement MAX_FRAGMENT_UNIFORM_BLOCKS parameter 2025-01-08 17:55:17 +03:00
Luke Wilde
0390a2328c LibWeb/WebGL2: Implement MAX_ELEMENT_INDEX parameter 2025-01-08 17:55:17 +03:00
Luke Wilde
2d94953047 LibWeb/WebGL2: Implement COPY_WRITE_BUFFER_BINDING parameter 2025-01-08 17:55:17 +03:00