Bug 1852740: add tests for the `fetchpriority` attribute in Link headers. r=necko...
[gecko.git] / dom / webidl / OffscreenCanvas.webidl
blob408bee600d8b32fae2b7c176078e15fe8954109d
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5  *
6  * For more information on this interface, please see
7  * https://html.spec.whatwg.org/#the-offscreencanvas-interface
8  */
10 typedef (OffscreenCanvasRenderingContext2D or ImageBitmapRenderingContext or WebGLRenderingContext or WebGL2RenderingContext or GPUCanvasContext) OffscreenRenderingContext;
12 dictionary ImageEncodeOptions {
13   DOMString type = "image/png";
14   unrestricted double quality;
17 enum OffscreenRenderingContextId { "2d", "bitmaprenderer", "webgl", "webgl2", "webgpu" };
19 [Exposed=(Window,Worker), Pref="gfx.offscreencanvas.enabled"]
20 interface OffscreenCanvas : EventTarget {
21   [Throws]
22   constructor([EnforceRange] unsigned long width, [EnforceRange] unsigned long height);
24   [Pure, SetterThrows]
25   attribute [EnforceRange] unsigned long width;
26   [Pure, SetterThrows]
27   attribute [EnforceRange] unsigned long height;
29   [Throws]
30   OffscreenRenderingContext? getContext(OffscreenRenderingContextId contextId,
31                                         optional any contextOptions = null);
33   [Throws]
34   ImageBitmap transferToImageBitmap();
35   [NewObject]
36   Promise<Blob> convertToBlob(optional ImageEncodeOptions options = {});
38   attribute EventHandler oncontextlost;
39   attribute EventHandler oncontextrestored;
41   // Deprecated by convertToBlob
42   [Deprecated="OffscreenCanvasToBlob", NewObject]
43   Promise<Blob> toBlob(optional DOMString type = "",
44                        optional any encoderOptions);