| // Copyright 2021 The Dawn Authors |
| // |
| // Licensed under the Apache License, Version 2.0 (the "License"); |
| // you may not use this file except in compliance with the License. |
| // You may obtain a copy of the License at |
| // |
| // http://www.apache.org/licenses/LICENSE-2.0 |
| // |
| // Unless required by applicable law or agreed to in writing, software |
| // distributed under the License is distributed on an "AS IS" BASIS, |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| // See the License for the specific language governing permissions and |
| // limitations under the License. |
| |
| // An IDL file that provides stub definitions for dictionaries and interfaces |
| // used by the webgpu.idl file |
| // |
| // The [LegacyNoInterfaceObject] annotation asks idlgen to not create a global constructor for |
| // an interface. It is a real WebIDL annotation but we use it liberally here. |
| // https://webidl.spec.whatwg.org/#LegacyNoInterfaceObject |
| |
| dictionary EventInit { |
| boolean bubbles = false; |
| boolean cancelable = false; |
| boolean composed = false; |
| }; |
| |
| [LegacyNoInterfaceObject] interface Navigator {}; |
| |
| [LegacyNoInterfaceObject] interface Event { |
| readonly attribute boolean bubbles; |
| readonly attribute boolean cancelable; |
| attribute boolean returnValue; |
| }; |
| |
| [LegacyNoInterfaceObject] interface WorkerNavigator{}; |
| |
| [LegacyNoInterfaceObject] interface EventListener { |
| undefined handleEvent(Event event); |
| }; |
| |
| [LegacyNoInterfaceObject] interface EventTarget { |
| undefined addEventListener(DOMString type, EventListener? callback, optional (AddEventListenerOptions or boolean) options); |
| undefined removeEventListener(DOMString type, EventListener? callback, optional (EventListenerOptions or boolean) options); |
| boolean dispatchEvent(Event event); |
| }; |
| |
| dictionary EventListenerOptions { boolean capture = false; }; |
| |
| dictionary AddEventListenerOptions : EventListenerOptions { |
| boolean passive = false; |
| boolean once = false; |
| }; |
| |
| typedef(Int8Array or Int16Array or Int32Array or Uint8Array or Uint16Array or |
| Uint32Array or Float32Array or Float64Array or |
| DataView) ArrayBufferView; |
| |
| typedef(ArrayBufferView or ArrayBuffer) BufferSource; |
| |
| // NAPI doesn't have SharedArrayBuffer so comment out that part of AllowSharedBufferSource. |
| typedef (ArrayBuffer or /* SharedArrayBuffer or [AllowShared] */ ArrayBufferView) AllowSharedBufferSource; |
| |
| // Interfaces used in the WebGPU IDL that don't have an equivalent in the NAPI world. |
| [LegacyNoInterfaceObject] interface DOMException {}; |
| [LegacyNoInterfaceObject] interface EventHandler{}; |
| [LegacyNoInterfaceObject] interface HTMLCanvasElement {}; |
| [LegacyNoInterfaceObject] interface HTMLImageElement {}; |
| [LegacyNoInterfaceObject] interface HTMLVideoElement {}; |
| [LegacyNoInterfaceObject] interface ImageBitmap {}; |
| [LegacyNoInterfaceObject] interface ImageData {}; |
| [LegacyNoInterfaceObject] interface OffscreenCanvas {}; |
| [LegacyNoInterfaceObject] interface VideoFrame {}; |
| |
| enum PredefinedColorSpace { "srgb", "display-p3" }; |