ladybird/Libraries/LibWeb/HTML/HTMLCanvasElement.idl
justus2510 a6e9f107eb LibWeb: Fix Canvas.toDataURL and Canvas.toBlob signatures
Fix the function signatures of Canvas.toDataURL() and Canvas.toBlob()
and make both functions accept non-numbers as the quality parameter, in
which case it will just use the default quality instead of raising an
exception.
This makes toDataURL.arguments.1.html, toDataURL.arguments.2.html and
toDataURL.jpeg.quality.notnumber.html in
wpt/html/semantics/embedded-content/the-canvas-element pass :^)
2024-11-15 10:46:24 +01:00

24 lines
830 B
Text

#import <FileAPI/Blob.idl>
#import <HTML/CanvasRenderingContext2D.idl>
#import <HTML/HTMLElement.idl>
#import <WebGL/WebGLRenderingContext.idl>
typedef (CanvasRenderingContext2D or WebGLRenderingContext) RenderingContext;
// https://html.spec.whatwg.org/multipage/semantics.html#htmlcanvaselement
[Exposed=Window]
interface HTMLCanvasElement : HTMLElement {
[HTMLConstructor] constructor();
[CEReactions] attribute unsigned long width;
[CEReactions] attribute unsigned long height;
RenderingContext? getContext(DOMString contextId, optional any options = null);
USVString toDataURL(optional DOMString type = "image/png", optional any quality);
undefined toBlob(BlobCallback _callback, optional DOMString type = "image/png", optional any quality);
};
callback BlobCallback = undefined (Blob? blob);