chromium/third_party/blink/renderer/modules/canvas/htmlcanvas/html_canvas_element_module.idl

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// https://html.spec.whatwg.org/C/#the-canvas-element

typedef (CanvasRenderingContext2D or
         WebGLRenderingContext or
         WebGL2RenderingContext or
         ImageBitmapRenderingContext or
         GPUCanvasContext) RenderingContext;

[
    ImplementedAs=HTMLCanvasElementModule
] partial interface HTMLCanvasElement
{
    [HighEntropy, MeasureAs=HTMLCanvasGetContext, RaisesException] RenderingContext? getContext(DOMString contextId, optional CanvasContextCreationAttributesModule attributes = {});

    [CallWith=ScriptState,
     RaisesException, MeasureAs=OffscreenCanvas] OffscreenCanvas transferControlToOffscreen();
};