ladybird icon indicating copy to clipboard operation
ladybird copied to clipboard

LibWeb: Add CanvasImageSource to ImageBitmapSource in the IDL

Open Totto16 opened this issue 1 year ago • 4 comments

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 ImageBitmapSource from the idl is Variant<A,B,C,D,E> and the manual ImageBitmapSource is Variant<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 CanvasImageSource to ImageBitmapSource
    :x: as CanvasImageSource isn'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.

Totto16 avatar Oct 10 '24 14:10 Totto16

Apologies for forgetting about this! The change looks good, but now has conflicts.

tcl3 avatar Oct 31 '24 09:10 tcl3

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

Totto16 avatar Oct 31 '24 10:10 Totto16

@tcl3 if it looks good, could it be merged, otherwise let me now 😄

Totto16 avatar Nov 04 '24 11:11 Totto16

@tcl3 or @gmta any updates? 👀

Totto16 avatar Nov 27 '24 12:11 Totto16