ladybird/Documentation/AddNewIDLFile.md
Shannon Booth 4b9f6450bd LibWeb: Treat support IDLs like normal bindings inputs
Allow the WebIDL parser to accept files without a top-level interface,
and have the exposed-interface generator skip those modules.

With that in place, register support IDLs through
libweb_js_bindings() as well, including generated CSS IDLs from the
build directory, and remove the separate support-idl plumbing.

This is enabled now that the IDL generator rules have been simplified
so that every IDL file produces a corresponding header and cpp file.
2026-05-10 20:11:46 +02:00

769 B

Adding a new IDL file

Ladybird's build system does a lot of work of turning the IDL from a Web spec into code, but there are a few things you'll need to do yourself.

For the sake of example, let's say you're wanting to add the HTMLDetailsElement.

  1. Create LibWeb/HTML/HTMLDetailsElement.idl with the contents of the IDL section of the spec. In this case, that would be:
[Exposed=Window]
interface HTMLDetailsElement : HTMLElement {
    [HTMLConstructor] constructor();

    [CEReactions] attribute boolean open;
};
  1. Add the IDL file to LibWeb/idl_files.cmake.

  2. Forward declare the generated class in LibWeb/Forward.h:

    • HTMLDetailsElement in its namespace.