// 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
         WebGLRenderingContextWebGPU or
         WebGL2RenderingContextWebGPU or
         ImageBitmapRenderingContext or
         GPUCanvasContext) RenderingContext;

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

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