ladybird
ladybird copied to clipboard
LibWeb: Add CanvasImageSource to ImageBitmapSource in the IDL
This is divided into 2 commits:
- The first one modifies the idl files quite a bit for such a small change, but it was necessary 😓
- The second one fixes the arising error, which is:
The generation from the idl file creates a flattened Variant of the nested typedef, so
ImageBitmapSourcefrom the idl isVariant<A,B,C,D,E>and the manualImageBitmapSourceisVariant<Variant<A,B,C>,D,E>(A,B,... are just abbreviations, to keep it short and readable)
There are three possible fixes for this:
- Don't create flattened versions of typedefs, when generating variants from idl :x: This is a bad idea, as it might affect other parts
- Copy the inner types of
CanvasImageSourcetoImageBitmapSource
:x: asCanvasImageSourceisn't fully implemented yet, it is subject to change, so we would have to change it in two place in the future - Create a C++ template, that Flattens a Variant, and then write something like
ImageBitmapSource = FlattenVariant<CanvasImageSource, D,E>;✔️ I find this to be the best solution
So I solved this, by adding a new FlattenVariant type, that solves this, I added a test for that.
Apologies for forgetting about this! The change looks good, but now has conflicts.
Apologies for forgetting about this! The change looks good, but now has conflicts.
Yeah https://github.com/LadybirdBrowser/ladybird/pull/2036 did a refactor I also did xD
Rebased it now
@tcl3 if it looks good, could it be merged, otherwise let me now 😄
@tcl3 or @gmta any updates? 👀