Commit Graph

1221 Commits

Author SHA1 Message Date
Sam Atkins
f7898d2c8b Meta: Replace GenerateCSSTransformFunctions with a python generator 2026-04-25 12:02:49 +02:00
Sam Atkins
f9dc467cae Meta: Replace GenerateCSSKeyword with a python generator 2026-04-25 12:02:49 +02:00
Sam Atkins
f6a3ff388b Meta: Replace GenerateCSSEnvironmentVariable with a python generator 2026-04-25 12:02:49 +02:00
Sam Atkins
4de5f3056b Meta: Replace GenerateCSSEnums with a python generator 2026-04-25 12:02:49 +02:00
Shannon Booth
cc6e048bd6 LibWeb+LibIDL: Remove support for #import directives during parsing
These no longer serve any purpose now that we run the IDLGenerator
on all of these files at once.
2026-04-24 20:08:29 +02:00
Shannon Booth
ba741994dd LibIDL: Resolve parsed interfaces post parsing
Move partial interface, partial namespace, mixin, typedef, and overload
finalization into a context-wide post-parse resolve step.

This lets BindingsGenerator parse all declared IDL files first and then
finalize the shared IDL context before generating bindings.
2026-04-24 20:08:29 +02:00
Shannon Booth
a153732a64 LibWeb: Parse support IDL files when generating bindings
Teach the bindings build to pass support IDL files alongside the regular
binding IDLs so BindingsGenerator parses the full declared IDL set into
a shared context.

Keep idl_files.cmake as the source of truth for parsed support IDLs, and
let Interface::will_generate_code() decide which parsed interfaces emit
generated bindings.
2026-04-24 20:08:29 +02:00
Shannon Booth
0e55b0f87e LibWeb/Bindings: Derive includes from IDL references
Stop using imported modules to decide which binding headers to include.
Instead, collect dependencies from referenced interfaces, dictionaries,
enumerations, callbacks, and nested IDL types in the parsed context.
2026-04-24 20:08:29 +02:00
Shannon Booth
535b8f5b9b LibWeb/Bindings: Qualify generated C++ type names
Derive C++ namespaces from each IDL module's location and use those
qualified names when generating binding code.

Also Teach dictionaries their owning IDL module path so dictionary C++
types can be qualified the same way as interfaces. This removes the need
for the generated `using namespace Web::*` hack and the hard-coded
namespace list.

Also fix DOMURL.idl to refer to the IDL interface name `URL`, not the
C++ implementation name `DOMURL`.
2026-04-24 20:08:29 +02:00
Shannon Booth
4178ec0af4 LibWeb/WebGL: Remove Extensions interface
No other third layer folder in LibWeb has its own namespace which
makes this a special case for the IDLGenerator when determining
namespaces. Instead of adding a special case, simply remove the
namespace.
2026-04-24 20:08:29 +02:00
Shannon Booth
83427086fa LibWeb/Bindings: Use IDL context to determine 'is platform object' 2026-04-24 20:08:29 +02:00
Shannon Booth
83f4e03045 LibWeb/Bindings: Batch BindingsGenerator over all IDL files
Teach BindingsGenerator to parse and generate bindings for the full
LibWeb IDL set in one invocation, and collapse the CMake bindings
rules from one custom command per IDL file to a single batched codegen
step.

This has the downsides of:
 * Any single IDL change now reruns the whole bindings generator
 * Per-IDL parallelism at the custom-command level is lost

However, I still feel that this is a worthy trade off as:
 * Generated files are written with write_if_changed(), so rebuilds
   of generated files should not be significantly impacted.
 * It is not a common task to be modifying IDL files
 * Most importantly, giving the IDL generator full knowledge of _all_
   IDL will allow for some simplifications of the bindings generator as
   it has knowledge of all types.
2026-04-24 20:08:29 +02:00
Shannon Booth
bd4ef4b95a LibIDL: Resolve JSON interface types via context
Use the shared IDL context when checking whether a type is a JSON type
instead of walking imported modules from the current interface. This
removes another dependency on explicit #import directives when resolving
interface inheritance for toJSON.
2026-04-23 22:12:13 +02:00
Shannon Booth
e8c221bed4 LibWeb/Bindings: Resolve inherited interfaces via IDL context
When creating an inheritance stack, look up parent interfaces from the
parsed IDL context instead of the current interface's imported modules.
This removes a dependency on explicit #import directives during bindings
generation.
2026-04-23 22:12:13 +02:00
Shannon Booth
5a97dba495 LibWeb: Model Function as a callback type
Import WebIDL/Function.idl where TimerHandler uses Function, and let the
bindings generator handle it through the normal callback-function path.

This removes the special C++ mapping for Function and makes TimerHandler
use GC::Root<CallbackType>, matching the generated binding type when IDL
files are parsed together.
2026-04-23 07:07:49 +02:00
Shannon Booth
04b3537b8f LibWeb/Bindings: Use qualified namespace for WindowProxy in code gen
Rather than relying on the hacky using namespace defintions.
2026-04-23 07:07:49 +02:00
Shannon Booth
f25bfd747a LibIDL: Make parser return modules instead of interfaces
Change the IDL parser entry point to a static factory returning an
IDL::Module. Modules now own the parsed file identity and import graph,
with an optional reference to the file's real interface when one exists.

This is a step towards running the IDL generator on files without
an interface defined.
2026-04-23 07:07:49 +02:00
Callum Law
aa9f2ed83f LibWeb: Rename AcceptedTypeRange to NumericRange
This name wasn't very clear, also updates associated type and variable
names.
2026-04-22 14:24:12 +01:00
Callum Law
8a7332b7b9 LibWeb: Add OpacityValueStyleValue
This allows us to avoid the ugly hack in
`property_accepted_type_ranges()`.

This also updates the `ValueType` to be `opacity-value` rather than
`opacity` to match the spec.
2026-04-22 14:24:12 +01:00
Shannon Booth
25254d5a20 LibWeb/Bindings: Move parsed IDL entities into Context
Start making IDL::Context represent the shared IDL world used during
code generation.

Move globally visible parsed IDL such as dictionaries, enums,
typedefs, callbacks, mixins, and partial declarations out of individual
Interface objects and into Context.

The main goal of this change is a step towards invoking the IDL
generator on every IDL file at once, rather than per interface.

In the meantime as standalone improvements, this lets code generation
resolve imported IDL types through the shared Context without copying
imported declarations onto each Interface. It also makes duplicate
local declarations unnecessary for imported shared types, since an
interface can reference an enum or dictionary owned by another
parsed IDL module without re-emitting it itself.
2026-04-22 13:26:01 +02:00
Shannon Booth
442a0e2e64 LibIDL+LibWeb: Move IDL interface dump into LibIDL 2026-04-22 13:26:01 +02:00
Shannon Booth
db41fde06a LibWeb/Bindings: Factor write_if_changed into standalone function 2026-04-22 13:26:01 +02:00
Shannon Booth
31a4093c86 LibWeb/Bindings: Factor out function for generating depfiles 2026-04-22 13:26:01 +02:00
Shannon Booth
0ec82fac38 LibWeb/Bindings: Convert file paths over to ByteString 2026-04-22 13:26:01 +02:00
Jonathan Gamble
baefb51902 LibWeb: Add Media Capture and Stream APIs 2026-04-21 16:40:46 -05:00
Shannon Booth
fd44da6829 LibWeb/Bindings: Emit one bindings header and cpp per IDL
Previously, the LibWeb bindings generator would output multiple per
interface files like Prototype/Constructor/Namespace/GlobalMixin
depending on the contents of that IDL file.

This complicates the build system as it means that it does not know
what files will be generated without knowledge of the contents of that
IDL file.

Instead, for each IDL file only generate a single Bindings/<IDLFile>.h
and Bindings/<IDLFile>.cpp.
2026-04-21 07:36:13 +02:00
Shannon Booth
f8288a14cc LibWeb/BindingsGenerator: Simplify weird dictionary member assignment
Remove the special case assignment path for string dictionary members.
The old logic was using the outer dictionary conversion’s optional and
optional_default_value state to decide how to assign an individual
member, which was very confusing and not correct.

This was probably needed on earlier buggier versions of the IDL
generator working around the wrong problem.
2026-04-17 20:48:30 +01:00
Shannon Booth
e9f8b6b035 LibWeb/Bindings: Add all integral types to idl_type_name_to_cpp_type
Which would be required if we added, for example, IDL which had
the missing types as part of a sequence. Also arange them in
terms of size while we are here.
2026-04-17 20:48:30 +01:00
Shannon Booth
6321f09296 LibWeb/Bindings: Remove some stray return statements 2026-04-17 20:48:30 +01:00
Shannon Booth
3cd2835232 LibWeb/Bindings: Use more any_of in generate_union_to_cpp 2026-04-17 20:48:30 +01:00
Shannon Booth
d5727168f2 LibWeb/Bindings: Remove dead else in branch in generate_to_string
This was appending just an empty line.
2026-04-17 20:48:30 +01:00
Shannon Booth
f172bf6818 LibWeb/Bindings: Simplify LegacyNullToEmptyString handling
Stop passing LegacyNullToEmptyString as a separate boolean and derive
it from parameter.extended_attributes instead.
2026-04-17 20:48:30 +01:00
Shannon Booth
33725b494b LibWeb/Bindings: Factor generate_union_to_cpp into function 2026-04-17 15:50:07 +01:00
Shannon Booth
20b1fe22d1 LibWeb/Bindings: Factor generate_sequence_to_cpp into function 2026-04-17 15:50:07 +01:00
Shannon Booth
1532ac1551 LibWeb/Bindings: Factor generate_callback_function_to_cpp into function 2026-04-17 15:50:07 +01:00
Shannon Booth
6e5db85fac LibWeb/Bindings: Factor generate_enum_to_cpp into function 2026-04-17 15:50:07 +01:00
Shannon Booth
de472d3454 LibWeb/Bindings: Factor generate_record_to_cpp into function 2026-04-17 15:50:07 +01:00
Shannon Booth
6e21df0138 LibWeb/Bindings: Factor out generate_any_to_cpp into function 2026-04-17 15:50:07 +01:00
Shannon Booth
3b2df8eefb LibWeb/Bindings: Factor generate_array_buffer_view_to_cpp into function 2026-04-17 15:50:07 +01:00
Shannon Booth
d0e07d05f7 LibWeb/Bindings: Factor generate_callback_interface_to_cpp into function 2026-04-17 15:50:07 +01:00
Shannon Booth
2f184f00ec LibWeb/Bindings: Factor generate_buffer_source_to_cpp into function 2026-04-17 15:50:07 +01:00
Shannon Booth
241c5e182f LibWeb/Bindings: Name is_javascript_builtin in terms of BufferSource
While this does add some extra cases into the function, this is
effectively a rename to better match how we were effectively already
doing this. Rename the function and link it to the right location in
the specification. Doing this also allows us to drop the FIXME as it
makes it clear what this hardcoded list is meant to achieve.
2026-04-17 15:50:07 +01:00
Shannon Booth
3a6d4ec77a LibWeb/Bindings: Factor generate_floating_point_to_cpp into function 2026-04-17 15:50:07 +01:00
Shannon Booth
ca524a0a0c LibWeb/Bindings: Factor generate_platform_object_to_cpp into function 2026-04-17 15:50:07 +01:00
Shannon Booth
536052c3c8 LibWeb/Bindings: Factor generate_promise_to_cpp into function 2026-04-17 15:50:07 +01:00
Shannon Booth
69fb476e76 LibWeb/Bindings: Factor generate_object_to_cpp into function 2026-04-17 15:50:07 +01:00
Shannon Booth
431e8a7b81 LibWeb/Bindings: Remove uneeded File/MediaSource special cases
These are already covered by nature of being considered a platform
object.
2026-04-17 15:50:07 +01:00
Andreas Kling
9694134f32 LibWeb: Stop emitting custom element reactions in attribute getters
In other engines, the [CEReactions] extended attribute on an attribute
only applies to the setter steps. Attribute getters never fire custom
element reactions, yet our bindings generator was still pushing a new
element queue onto the custom element reactions stack on entry and
popping + invoking it on return for every single getter call on a
[CEReactions] attribute.
2026-04-17 01:31:32 +02:00
Shannon Booth
649b7fa32d LibWeb/Bindings: Remove support for [ExplicitNull] extended attribute
This is no longer used, and only adds complexity.
2026-04-13 23:30:54 +02:00
Sam Atkins
492cfc58d9 LibWeb/CSS: Add flags for element-backed & tree-abiding pseudo-elements
Generate a couple of functions for checking if a pseudo-element fits
these categories.
2026-04-08 10:37:05 +01:00