2021-10-03 17:32:01 -03:00
|
|
|
# Adding a new IDL file
|
|
|
|
|
|
2024-11-22 12:33:33 -03:00
|
|
|
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.
|
2021-10-03 17:32:01 -03:00
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
```webidl
|
|
|
|
|
[Exposed=Window]
|
|
|
|
|
interface HTMLDetailsElement : HTMLElement {
|
|
|
|
|
[HTMLConstructor] constructor();
|
|
|
|
|
|
|
|
|
|
[CEReactions] attribute boolean open;
|
|
|
|
|
};
|
|
|
|
|
```
|
|
|
|
|
|
2026-05-09 11:32:33 -03:00
|
|
|
2. Add the IDL file to [`LibWeb/idl_files.cmake`](../Libraries/LibWeb/idl_files.cmake).
|
2021-10-03 17:32:01 -03:00
|
|
|
|
2026-05-01 11:12:15 -03:00
|
|
|
3. Forward declare the generated class in [`LibWeb/Forward.h`](../Libraries/LibWeb/Forward.h):
|
2021-10-03 17:32:01 -03:00
|
|
|
- `HTMLDetailsElement` in its namespace.
|