From b2fb7c7a97cb785fdb99215addacaab90d2f4637 Mon Sep 17 00:00:00 2001 From: Xiaoru Li Date: Tue, 2 Oct 2018 13:00:14 +0200 Subject: [PATCH 1/9] Add ImageBitmapSource types Different for Window or WorkerGlobalScope --- inputfiles/addedTypes.json | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/inputfiles/addedTypes.json b/inputfiles/addedTypes.json index 3d97c2ac6..76dbe212f 100644 --- a/inputfiles/addedTypes.json +++ b/inputfiles/addedTypes.json @@ -2577,6 +2577,14 @@ { "new-type": "WindowProxy", "type": "Window" + }, + { + "new-type": "ImageBitmapSourceWorker", + "type": "ImageBitmap | ImageData | Blob" + }, + { + "new-type": "ImageBitmapSourceWindow", + "type": "HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | ImageData | Blob" } ] } From 96eae1c66618196fa792a51313e5412ae3b9e3e4 Mon Sep 17 00:00:00 2001 From: Xiaoru Li Date: Tue, 2 Oct 2018 13:34:26 +0200 Subject: [PATCH 2/9] Modify widl for ImageBitmap --- .../idl/HTML - ImageBitmap and animations.widl | 6 +++++- inputfiles/idl/HTML - Web application APIs.widl | 15 ++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/inputfiles/idl/HTML - ImageBitmap and animations.widl b/inputfiles/idl/HTML - ImageBitmap and animations.widl index 0d8f7ef70..1cda56c3d 100644 --- a/inputfiles/idl/HTML - ImageBitmap and animations.widl +++ b/inputfiles/idl/HTML - ImageBitmap and animations.widl @@ -7,7 +7,11 @@ interface ImageBitmap { typedef (CanvasImageSource or Blob or - ImageData) ImageBitmapSource; + ImageData) ImageBitmapSourceWindow; + +typedef (ImageBitmap or + Blob or + ImageData) ImageBitmapSourceWorker; enum ImageOrientation { "none", "flipY" }; enum PremultiplyAlpha { "none", "premultiply", "default" }; diff --git a/inputfiles/idl/HTML - Web application APIs.widl b/inputfiles/idl/HTML - Web application APIs.widl index 3737fceaa..81176a236 100644 --- a/inputfiles/idl/HTML - Web application APIs.widl +++ b/inputfiles/idl/HTML - Web application APIs.widl @@ -145,10 +145,19 @@ interface mixin WindowOrWorkerGlobalScope { // microtask queuing void queueMicrotask(Function callback); +}; - // ImageBitmap - Promise createImageBitmap(ImageBitmapSource image, optional ImageBitmapOptions options); - Promise createImageBitmap(ImageBitmapSource image, long sx, long sy, long sw, long sh, optional ImageBitmapOptions options); +// ImageBitmap +interface mixin ImageBitmapWindow { + Promise createImageBitmap(ImageBitmapSourceWindow image, optional ImageBitmapOptions options); + Promise createImageBitmap(ImageBitmapSourceWindow image, long sx, long sy, long sw, long sh, optional ImageBitmapOptions options); +}; +interface mixin ImageBitmapWorker { + Promise createImageBitmap(ImageBitmapSourceWorker image, optional ImageBitmapOptions options); + Promise createImageBitmap(ImageBitmapSourceWorker image, long sx, long sy, long sw, long sh, optional ImageBitmapOptions options); }; + Window includes WindowOrWorkerGlobalScope; +Window includes ImageBitmapWindow; WorkerGlobalScope includes WindowOrWorkerGlobalScope; +WorkerGlobalScope includes ImageBitmapWindow; From da508fb4b575a22d40c1ad933af4943d93cfa9e6 Mon Sep 17 00:00:00 2001 From: Xiaoru Li Date: Tue, 2 Oct 2018 14:04:24 +0200 Subject: [PATCH 3/9] Remove conflicting defs in json --- inputfiles/addedTypes.json | 8 -------- 1 file changed, 8 deletions(-) diff --git a/inputfiles/addedTypes.json b/inputfiles/addedTypes.json index 76dbe212f..3d97c2ac6 100644 --- a/inputfiles/addedTypes.json +++ b/inputfiles/addedTypes.json @@ -2577,14 +2577,6 @@ { "new-type": "WindowProxy", "type": "Window" - }, - { - "new-type": "ImageBitmapSourceWorker", - "type": "ImageBitmap | ImageData | Blob" - }, - { - "new-type": "ImageBitmapSourceWindow", - "type": "HTMLImageElement | SVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | ImageData | Blob" } ] } From 479a6467b447dfab7f2090dbec57e4acb5532a6c Mon Sep 17 00:00:00 2001 From: Xiaoru Li Date: Tue, 2 Oct 2018 14:12:36 +0200 Subject: [PATCH 4/9] Fix typo --- inputfiles/idl/HTML - Web application APIs.widl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inputfiles/idl/HTML - Web application APIs.widl b/inputfiles/idl/HTML - Web application APIs.widl index 81176a236..3ceb8b76c 100644 --- a/inputfiles/idl/HTML - Web application APIs.widl +++ b/inputfiles/idl/HTML - Web application APIs.widl @@ -160,4 +160,4 @@ interface mixin ImageBitmapWorker { Window includes WindowOrWorkerGlobalScope; Window includes ImageBitmapWindow; WorkerGlobalScope includes WindowOrWorkerGlobalScope; -WorkerGlobalScope includes ImageBitmapWindow; +WorkerGlobalScope includes ImageBitmapWorker; From aea3f34fef0dfa959503553bc646d3c5d2a15b5a Mon Sep 17 00:00:00 2001 From: Xiaoru Li Date: Tue, 2 Oct 2018 14:16:38 +0200 Subject: [PATCH 5/9] Remove confliting ImageBitmapOptions in json --- inputfiles/addedTypes.json | 39 -------------------------------------- 1 file changed, 39 deletions(-) diff --git a/inputfiles/addedTypes.json b/inputfiles/addedTypes.json index 3d97c2ac6..e75ef0beb 100644 --- a/inputfiles/addedTypes.json +++ b/inputfiles/addedTypes.json @@ -396,45 +396,6 @@ } } }, - "ImageBitmapOptions": { - "flavor": "All", - "name": "ImageBitmapOptions", - "properties": { - "property": { - "imageOrientation": { - "name": "imageOrientation", - "override-type": "\"none\" | \"flipY\"", - "required": 0 - }, - "premultiplyAlpha": { - "name": "premultiplyAlpha", - "override-type": "\"none\" | \"premultiply\" | \"default\"", - "required": 0 - }, - "colorSpaceConversion": { - "name": "colorSpaceConversion", - "override-type": "\"none\" | \"default\"", - "required": 0 - }, - "resizeWidth": { - "name": "resizeWidth", - "override-type": "number", - "required": 0 - }, - "resizeHeight": { - "name": "resizeHeight", - "override-type": "number", - "required": 0 - }, - "resizeQuality": { - "name": "resizeQuality", - "override-type": "\"pixelated\" | \"low\" | \"medium\" | \"high\"", - "required": 0 - } - } - }, - "no-interface-object": "1" - }, "Window": { "name": "Window", "properties": { From 7315100b83ff035412d1b0565def6c03f62a6d45 Mon Sep 17 00:00:00 2001 From: Xiaoru Li Date: Tue, 2 Oct 2018 14:20:20 +0200 Subject: [PATCH 6/9] Update generated baseline files --- baselines/dom.generated.d.ts | 37 ++++++++++++++++++------------ baselines/webworker.generated.d.ts | 34 ++++++++++++++++----------- 2 files changed, 42 insertions(+), 29 deletions(-) diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index d912d196e..6577814ff 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -519,6 +519,15 @@ interface IIRFilterOptions extends AudioNodeOptions { feedforward: number[]; } +interface ImageBitmapOptions { + colorSpaceConversion?: ColorSpaceConversion; + imageOrientation?: ImageOrientation; + premultiplyAlpha?: PremultiplyAlpha; + resizeHeight?: number; + resizeQuality?: ResizeQuality; + resizeWidth?: number; +} + interface IntersectionObserverEntryInit { boundingClientRect: DOMRectInit; intersectionRect: DOMRectInit; @@ -9082,15 +9091,6 @@ declare var ImageBitmap: { new(): ImageBitmap; }; -interface ImageBitmapOptions { - colorSpaceConversion?: "none" | "default"; - imageOrientation?: "none" | "flipY"; - premultiplyAlpha?: "none" | "premultiply" | "default"; - resizeHeight?: number; - resizeQuality?: "pixelated" | "low" | "medium" | "high"; - resizeWidth?: number; -} - interface ImageBitmapRenderingContext { /** * Returns the canvas element that the context is bound to. @@ -9109,6 +9109,11 @@ declare var ImageBitmapRenderingContext: { new(): ImageBitmapRenderingContext; }; +interface ImageBitmapWindow { + createImageBitmap(image: ImageBitmapSourceWindow, options?: ImageBitmapOptions): Promise; + createImageBitmap(image: ImageBitmapSourceWindow, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; +} + interface ImageData { /** * Returns the one-dimensional array containing the data in RGBA order, as integers in the @@ -16293,7 +16298,7 @@ interface WindowEventMap extends GlobalEventHandlersEventMap, WindowEventHandler "waiting": Event; } -interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64, GlobalFetch, WindowOrWorkerGlobalScope, WindowEventHandlers { +interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64, GlobalFetch, WindowOrWorkerGlobalScope, ImageBitmapWindow, WindowEventHandlers { Blob: typeof Blob; URL: typeof URL; URLSearchParams: typeof URLSearchParams; @@ -16494,8 +16499,6 @@ interface WindowOrWorkerGlobalScope { btoa(data: string): string; clearInterval(handle?: number): void; clearTimeout(handle?: number): void; - createImageBitmap(image: ImageBitmapSource): Promise; - createImageBitmap(image: ImageBitmapSource, sx: number, sy: number, sw: number, sh: number): Promise; fetch(input: RequestInfo, init?: RequestInit): Promise; queueMicrotask(callback: Function): void; setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number; @@ -17550,12 +17553,12 @@ declare function atob(data: string): string; declare function btoa(data: string): string; declare function clearInterval(handle?: number): void; declare function clearTimeout(handle?: number): void; -declare function createImageBitmap(image: ImageBitmapSource): Promise; -declare function createImageBitmap(image: ImageBitmapSource, sx: number, sy: number, sw: number, sh: number): Promise; declare function fetch(input: RequestInfo, init?: RequestInit): Promise; declare function queueMicrotask(callback: Function): void; declare function setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number; declare function setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number; +declare function createImageBitmap(image: ImageBitmapSourceWindow, options?: ImageBitmapOptions): Promise; +declare function createImageBitmap(image: ImageBitmapSourceWindow, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; declare var sessionStorage: Storage; declare var localStorage: Storage; declare var onafterprint: ((this: Window, ev: Event) => any) | null; @@ -17588,7 +17591,7 @@ type HTMLOrSVGImageElement = HTMLImageElement | SVGImageElement; type CanvasImageSource = HTMLOrSVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap; type MessageEventSource = WindowProxy | MessagePort | ServiceWorker; type HTMLOrSVGScriptElement = HTMLScriptElement | SVGScriptElement; -type ImageBitmapSource = CanvasImageSource | Blob | ImageData; +type ImageBitmapSourceWindow = CanvasImageSource | Blob | ImageData; type OnErrorEventHandler = OnErrorEventHandlerNonNull | null; type OnBeforeUnloadEventHandler = OnBeforeUnloadEventHandlerNonNull | null; type TimerHandler = string | Function; @@ -17647,6 +17650,7 @@ type CanvasTextBaseline = "top" | "hanging" | "middle" | "alphabetic" | "ideogra type ChannelCountMode = "max" | "clamped-max" | "explicit"; type ChannelInterpretation = "speakers" | "discrete"; type ClientTypes = "window" | "worker" | "sharedworker" | "all"; +type ColorSpaceConversion = "none" | "default"; type CompositeOperation = "replace" | "add" | "accumulate"; type DirectionSetting = "" | "rl" | "lr"; type DisplayCaptureSurfaceType = "monitor" | "window" | "application" | "browser"; @@ -17661,6 +17665,7 @@ type GamepadMappingType = "" | "standard"; type IDBCursorDirection = "next" | "nextunique" | "prev" | "prevunique"; type IDBRequestReadyState = "pending" | "done"; type IDBTransactionMode = "readonly" | "readwrite" | "versionchange"; +type ImageOrientation = "none" | "flipY"; type ImageSmoothingQuality = "low" | "medium" | "high"; type IterationCompositeOperation = "replace" | "accumulate"; type KeyFormat = "raw" | "spki" | "pkcs8" | "jwk"; @@ -17691,6 +17696,7 @@ type PaymentComplete = "success" | "fail" | "unknown"; type PaymentShippingType = "shipping" | "delivery" | "pickup"; type PlaybackDirection = "normal" | "reverse" | "alternate" | "alternate-reverse"; type PositionAlignSetting = "line-left" | "center" | "line-right" | "auto"; +type PremultiplyAlpha = "none" | "premultiply" | "default"; type PushEncryptionKeyName = "p256dh" | "auth"; type PushPermissionState = "denied" | "granted" | "prompt"; type RTCBundlePolicy = "balanced" | "max-compat" | "max-bundle"; @@ -17729,6 +17735,7 @@ type RequestCredentials = "omit" | "same-origin" | "include"; type RequestDestination = "" | "audio" | "audioworklet" | "document" | "embed" | "font" | "image" | "manifest" | "object" | "paintworklet" | "report" | "script" | "sharedworker" | "style" | "track" | "video" | "worker" | "xslt"; type RequestMode = "navigate" | "same-origin" | "no-cors" | "cors"; type RequestRedirect = "follow" | "error" | "manual"; +type ResizeQuality = "pixelated" | "low" | "medium" | "high"; type ResponseType = "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect"; type ScopedCredentialType = "ScopedCred"; type ScrollBehavior = "auto" | "instant" | "smooth"; diff --git a/baselines/webworker.generated.d.ts b/baselines/webworker.generated.d.ts index 9c9dcaba1..13ec6b83c 100644 --- a/baselines/webworker.generated.d.ts +++ b/baselines/webworker.generated.d.ts @@ -205,6 +205,15 @@ interface IDBVersionChangeEventInit extends EventInit { oldVersion?: number; } +interface ImageBitmapOptions { + colorSpaceConversion?: ColorSpaceConversion; + imageOrientation?: ImageOrientation; + premultiplyAlpha?: PremultiplyAlpha; + resizeHeight?: number; + resizeQuality?: ResizeQuality; + resizeWidth?: number; +} + interface JsonWebKey { alg?: string; crv?: string; @@ -1776,13 +1785,9 @@ declare var ImageBitmap: { new(): ImageBitmap; }; -interface ImageBitmapOptions { - colorSpaceConversion?: "none" | "default"; - imageOrientation?: "none" | "flipY"; - premultiplyAlpha?: "none" | "premultiply" | "default"; - resizeHeight?: number; - resizeQuality?: "pixelated" | "low" | "medium" | "high"; - resizeWidth?: number; +interface ImageBitmapWorker { + createImageBitmap(image: ImageBitmapSourceWorker, options?: ImageBitmapOptions): Promise; + createImageBitmap(image: ImageBitmapSourceWorker, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; } interface ImageData { @@ -2652,8 +2657,6 @@ interface WindowOrWorkerGlobalScope { btoa(data: string): string; clearInterval(handle?: number): void; clearTimeout(handle?: number): void; - createImageBitmap(image: ImageBitmapSource): Promise; - createImageBitmap(image: ImageBitmapSource, sx: number, sy: number, sw: number, sh: number): Promise; fetch(input: RequestInfo, init?: RequestInit): Promise; queueMicrotask(callback: Function): void; setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number; @@ -2683,7 +2686,7 @@ interface WorkerGlobalScopeEventMap { "error": ErrorEvent; } -interface WorkerGlobalScope extends EventTarget, WorkerUtils, WindowConsole, GlobalFetch, WindowOrWorkerGlobalScope { +interface WorkerGlobalScope extends EventTarget, WorkerUtils, WindowConsole, GlobalFetch, WindowOrWorkerGlobalScope, ImageBitmapWorker { readonly caches: CacheStorage; readonly isSecureContext: boolean; readonly location: WorkerLocation; @@ -2934,12 +2937,12 @@ declare function atob(data: string): string; declare function btoa(data: string): string; declare function clearInterval(handle?: number): void; declare function clearTimeout(handle?: number): void; -declare function createImageBitmap(image: ImageBitmapSource): Promise; -declare function createImageBitmap(image: ImageBitmapSource, sx: number, sy: number, sw: number, sh: number): Promise; declare function fetch(input: RequestInfo, init?: RequestInit): Promise; declare function queueMicrotask(callback: Function): void; declare function setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number; declare function setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number; +declare function createImageBitmap(image: ImageBitmapSourceWorker, options?: ImageBitmapOptions): Promise; +declare function createImageBitmap(image: ImageBitmapSourceWorker, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; declare function addEventListener(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; declare function removeEventListener(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, options?: boolean | EventListenerOptions): void; @@ -2949,9 +2952,8 @@ type HeadersInit = Headers | string[][] | Record; type BodyInit = Blob | BufferSource | FormData | URLSearchParams | ReadableStream | string; type RequestInfo = Request | string; type DOMHighResTimeStamp = number; -type CanvasImageSource = ImageBitmap; type MessageEventSource = MessagePort | ServiceWorker; -type ImageBitmapSource = CanvasImageSource | Blob | ImageData; +type ImageBitmapSourceWorker = ImageBitmap | Blob | ImageData; type TimerHandler = string | Function; type PerformanceEntryList = PerformanceEntry[]; type PushMessageDataInit = BufferSource | string; @@ -2967,14 +2969,17 @@ type IDBValidKey = number | string | Date | BufferSource | IDBArrayKey; type Transferable = ArrayBuffer | MessagePort | ImageBitmap; type BinaryType = "blob" | "arraybuffer"; type ClientTypes = "window" | "worker" | "sharedworker" | "all"; +type ColorSpaceConversion = "none" | "default"; type IDBCursorDirection = "next" | "nextunique" | "prev" | "prevunique"; type IDBRequestReadyState = "pending" | "done"; type IDBTransactionMode = "readonly" | "readwrite" | "versionchange"; +type ImageOrientation = "none" | "flipY"; type KeyFormat = "raw" | "spki" | "pkcs8" | "jwk"; type KeyType = "public" | "private" | "secret"; type KeyUsage = "encrypt" | "decrypt" | "sign" | "verify" | "deriveKey" | "deriveBits" | "wrapKey" | "unwrapKey"; type NotificationDirection = "auto" | "ltr" | "rtl"; type NotificationPermission = "default" | "denied" | "granted"; +type PremultiplyAlpha = "none" | "premultiply" | "default"; type PushEncryptionKeyName = "p256dh" | "auth"; type PushPermissionState = "denied" | "granted" | "prompt"; type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "origin-only" | "origin-when-cross-origin" | "unsafe-url"; @@ -2983,6 +2988,7 @@ type RequestCredentials = "omit" | "same-origin" | "include"; type RequestDestination = "" | "audio" | "audioworklet" | "document" | "embed" | "font" | "image" | "manifest" | "object" | "paintworklet" | "report" | "script" | "sharedworker" | "style" | "track" | "video" | "worker" | "xslt"; type RequestMode = "navigate" | "same-origin" | "no-cors" | "cors"; type RequestRedirect = "follow" | "error" | "manual"; +type ResizeQuality = "pixelated" | "low" | "medium" | "high"; type ResponseType = "basic" | "cors" | "default" | "error" | "opaque" | "opaqueredirect"; type ServiceWorkerState = "installing" | "installed" | "activating" | "activated" | "redundant"; type ServiceWorkerUpdateViaCache = "imports" | "all" | "none"; From 7d233526e915cccb3abe12c2d9f95c86127b9dea Mon Sep 17 00:00:00 2001 From: Xiaoru Li Date: Thu, 31 Jan 2019 11:05:57 +0100 Subject: [PATCH 7/9] Revert widl files to unmodified state --- .../idl/HTML - ImageBitmap and animations.widl | 6 +----- inputfiles/idl/HTML - Web application APIs.widl | 15 +++------------ 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/inputfiles/idl/HTML - ImageBitmap and animations.widl b/inputfiles/idl/HTML - ImageBitmap and animations.widl index 1cda56c3d..0d8f7ef70 100644 --- a/inputfiles/idl/HTML - ImageBitmap and animations.widl +++ b/inputfiles/idl/HTML - ImageBitmap and animations.widl @@ -7,11 +7,7 @@ interface ImageBitmap { typedef (CanvasImageSource or Blob or - ImageData) ImageBitmapSourceWindow; - -typedef (ImageBitmap or - Blob or - ImageData) ImageBitmapSourceWorker; + ImageData) ImageBitmapSource; enum ImageOrientation { "none", "flipY" }; enum PremultiplyAlpha { "none", "premultiply", "default" }; diff --git a/inputfiles/idl/HTML - Web application APIs.widl b/inputfiles/idl/HTML - Web application APIs.widl index 3ceb8b76c..3737fceaa 100644 --- a/inputfiles/idl/HTML - Web application APIs.widl +++ b/inputfiles/idl/HTML - Web application APIs.widl @@ -145,19 +145,10 @@ interface mixin WindowOrWorkerGlobalScope { // microtask queuing void queueMicrotask(Function callback); -}; -// ImageBitmap -interface mixin ImageBitmapWindow { - Promise createImageBitmap(ImageBitmapSourceWindow image, optional ImageBitmapOptions options); - Promise createImageBitmap(ImageBitmapSourceWindow image, long sx, long sy, long sw, long sh, optional ImageBitmapOptions options); -}; -interface mixin ImageBitmapWorker { - Promise createImageBitmap(ImageBitmapSourceWorker image, optional ImageBitmapOptions options); - Promise createImageBitmap(ImageBitmapSourceWorker image, long sx, long sy, long sw, long sh, optional ImageBitmapOptions options); + // ImageBitmap + Promise createImageBitmap(ImageBitmapSource image, optional ImageBitmapOptions options); + Promise createImageBitmap(ImageBitmapSource image, long sx, long sy, long sw, long sh, optional ImageBitmapOptions options); }; - Window includes WindowOrWorkerGlobalScope; -Window includes ImageBitmapWindow; WorkerGlobalScope includes WindowOrWorkerGlobalScope; -WorkerGlobalScope includes ImageBitmapWorker; From a88d12f50233669cdc7d37f220962f2fef1fa6d9 Mon Sep 17 00:00:00 2001 From: Xiaoru Li Date: Thu, 31 Jan 2019 11:43:03 +0100 Subject: [PATCH 8/9] Update widl via fetch-idl script --- inputfiles/idl/HTML - ImageBitmap and animations.widl | 9 +++++++++ inputfiles/idl/HTML - Web application APIs.widl | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/inputfiles/idl/HTML - ImageBitmap and animations.widl b/inputfiles/idl/HTML - ImageBitmap and animations.widl index 0d8f7ef70..6a47109e5 100644 --- a/inputfiles/idl/HTML - ImageBitmap and animations.widl +++ b/inputfiles/idl/HTML - ImageBitmap and animations.widl @@ -22,3 +22,12 @@ dictionary ImageBitmapOptions { [EnforceRange] unsigned long resizeHeight; ResizeQuality resizeQuality = "low"; }; + +callback FrameRequestCallback = void (DOMHighResTimeStamp time); + +interface mixin AnimationFrameProvider { + unsigned long requestAnimationFrame(FrameRequestCallback callback); + void cancelAnimationFrame(unsigned long handle); +}; +Window includes AnimationFrameProvider; +DedicatedWorkerGlobalScope includes AnimationFrameProvider; diff --git a/inputfiles/idl/HTML - Web application APIs.widl b/inputfiles/idl/HTML - Web application APIs.widl index 3737fceaa..aa5f0c759 100644 --- a/inputfiles/idl/HTML - Web application APIs.widl +++ b/inputfiles/idl/HTML - Web application APIs.widl @@ -64,6 +64,7 @@ interface mixin GlobalEventHandlers { attribute EventHandler onended; attribute OnErrorEventHandler onerror; attribute EventHandler onfocus; + attribute EventHandler onformdata; attribute EventHandler oninput; attribute EventHandler oninvalid; attribute EventHandler onkeydown; @@ -144,7 +145,7 @@ interface mixin WindowOrWorkerGlobalScope { void clearInterval(optional long handle = 0); // microtask queuing - void queueMicrotask(Function callback); + void queueMicrotask(VoidFunction callback); // ImageBitmap Promise createImageBitmap(ImageBitmapSource image, optional ImageBitmapOptions options); From a45cbb049e8f4b49e89754136fe7790dad69a409 Mon Sep 17 00:00:00 2001 From: Xiaoru Li Date: Thu, 31 Jan 2019 11:44:51 +0100 Subject: [PATCH 9/9] Build and run baseline test --- baselines/dom.generated.d.ts | 31 +++++++++++++++--------- baselines/webworker.generated.d.ts | 39 +++++++++++++++++++++--------- 2 files changed, 47 insertions(+), 23 deletions(-) diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index 7f048ed64..05c78c02f 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -1802,6 +1802,11 @@ declare var AnimationEvent: { new(type: string, animationEventInitDict?: AnimationEventInit): AnimationEvent; }; +interface AnimationFrameProvider { + cancelAnimationFrame(handle: number): void; + requestAnimationFrame(callback: FrameRequestCallback): number; +} + interface AnimationPlaybackEvent extends Event { readonly currentTime: number | null; readonly timelineTime: number | null; @@ -5409,6 +5414,7 @@ interface GlobalEventHandlersEventMap { "ended": Event; "error": ErrorEvent; "focus": FocusEvent; + "formdata": Event; "gotpointercapture": PointerEvent; "input": Event; "invalid": Event; @@ -5570,6 +5576,7 @@ interface GlobalEventHandlers { * @param ev The event. */ onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null; + onformdata: ((this: GlobalEventHandlers, ev: Event) => any) | null; ongotpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null; oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null; @@ -9371,11 +9378,7 @@ declare var ImageBitmapRenderingContext: { new(): ImageBitmapRenderingContext; }; -interface ImageBitmapWindow { - createImageBitmap(image: ImageBitmapSourceWindow, options?: ImageBitmapOptions): Promise; - createImageBitmap(image: ImageBitmapSourceWindow, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; -} - +/** The ImageData interface represents the underlying pixel data of an area of a element. It is created using the ImageData() constructor or creator methods on the CanvasRenderingContext2D object associated with a canvas: createImageData() and getImageData(). It can also be used to set a part of the canvas by using putImageData(). */ interface ImageData { /** * Returns the one-dimensional array containing the data in RGBA order, as integers in the @@ -16921,7 +16924,8 @@ interface WindowEventMap extends GlobalEventHandlersEventMap, WindowEventHandler "waiting": Event; } -interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64, GlobalFetch, WindowOrWorkerGlobalScope, ImageBitmapWindow, WindowEventHandlers { +/** The Window interface represents a window containing a DOM document; the document property points to the DOM document loaded in that window. */ +interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64, GlobalFetch, AnimationFrameProvider, WindowOrWorkerGlobalScope, WindowEventHandlers { Blob: typeof Blob; URL: typeof URL; URLSearchParams: typeof URLSearchParams; @@ -17123,8 +17127,10 @@ interface WindowOrWorkerGlobalScope { btoa(data: string): string; clearInterval(handle?: number): void; clearTimeout(handle?: number): void; + createImageBitmap(image: ImageBitmapSource, options?: ImageBitmapOptions): Promise; + createImageBitmap(image: ImageBitmapSource, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; fetch(input: RequestInfo, init?: RequestInit): Promise; - queueMicrotask(callback: Function): void; + queueMicrotask(callback: VoidFunction): void; setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number; setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number; } @@ -18031,6 +18037,7 @@ declare var onerror: OnErrorEventHandler; * @param ev The event. */ declare var onfocus: ((this: Window, ev: FocusEvent) => any) | null; +declare var onformdata: ((this: Window, ev: Event) => any) | null; declare var ongotpointercapture: ((this: Window, ev: PointerEvent) => any) | null; declare var oninput: ((this: Window, ev: Event) => any) | null; declare var oninvalid: ((this: Window, ev: Event) => any) | null; @@ -18200,6 +18207,8 @@ declare var indexedDB: IDBFactory; declare function atob(encodedString: string): string; declare function btoa(rawString: string): string; declare function fetch(input: RequestInfo, init?: RequestInit): Promise; +declare function cancelAnimationFrame(handle: number): void; +declare function requestAnimationFrame(callback: FrameRequestCallback): number; declare var caches: CacheStorage; declare var crypto: Crypto; declare var indexedDB: IDBFactory; @@ -18209,12 +18218,12 @@ declare function atob(data: string): string; declare function btoa(data: string): string; declare function clearInterval(handle?: number): void; declare function clearTimeout(handle?: number): void; +declare function createImageBitmap(image: ImageBitmapSource, options?: ImageBitmapOptions): Promise; +declare function createImageBitmap(image: ImageBitmapSource, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; declare function fetch(input: RequestInfo, init?: RequestInit): Promise; -declare function queueMicrotask(callback: Function): void; +declare function queueMicrotask(callback: VoidFunction): void; declare function setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number; declare function setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number; -declare function createImageBitmap(image: ImageBitmapSourceWindow, options?: ImageBitmapOptions): Promise; -declare function createImageBitmap(image: ImageBitmapSourceWindow, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; declare var sessionStorage: Storage; declare var localStorage: Storage; declare var onafterprint: ((this: Window, ev: Event) => any) | null; @@ -18247,7 +18256,7 @@ type HTMLOrSVGImageElement = HTMLImageElement | SVGImageElement; type CanvasImageSource = HTMLOrSVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap; type MessageEventSource = WindowProxy | MessagePort | ServiceWorker; type HTMLOrSVGScriptElement = HTMLScriptElement | SVGScriptElement; -type ImageBitmapSourceWindow = CanvasImageSource | Blob | ImageData; +type ImageBitmapSource = CanvasImageSource | Blob | ImageData; type OnErrorEventHandler = OnErrorEventHandlerNonNull | null; type OnBeforeUnloadEventHandler = OnBeforeUnloadEventHandlerNonNull | null; type TimerHandler = string | Function; diff --git a/baselines/webworker.generated.d.ts b/baselines/webworker.generated.d.ts index 969569b68..be5778426 100644 --- a/baselines/webworker.generated.d.ts +++ b/baselines/webworker.generated.d.ts @@ -537,6 +537,11 @@ interface AesCmacParams extends Algorithm { length: number; } +interface AnimationFrameProvider { + cancelAnimationFrame(handle: number): void; + requestAnimationFrame(callback: FrameRequestCallback): number; +} + /** A Blob object represents a file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system. */ interface Blob { readonly size: number; @@ -1073,7 +1078,7 @@ interface DedicatedWorkerGlobalScopeEventMap extends WorkerGlobalScopeEventMap { } /** The DedicatedWorkerGlobalScope object (the Worker global scope) is accessible through the self keyword. Some additional global functions, namespaces objects, and constructors, not typically associated with the worker global scope, but available on it, are listed in the JavaScript Reference. See also: Functions available to workers. */ -interface DedicatedWorkerGlobalScope extends WorkerGlobalScope { +interface DedicatedWorkerGlobalScope extends WorkerGlobalScope, AnimationFrameProvider { onmessage: ((this: DedicatedWorkerGlobalScope, ev: MessageEvent) => any) | null; close(): void; postMessage(message: any, transfer?: Transferable[]): void; @@ -1970,11 +1975,6 @@ declare var ImageBitmap: { new(): ImageBitmap; }; -interface ImageBitmapWorker { - createImageBitmap(image: ImageBitmapSourceWorker, options?: ImageBitmapOptions): Promise; - createImageBitmap(image: ImageBitmapSourceWorker, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; -} - /** The ImageData interface represents the underlying pixel data of an area of a element. It is created using the ImageData() constructor or creator methods on the CanvasRenderingContext2D object associated with a canvas: createImageData() and getImageData(). It can also be used to set a part of the canvas by using putImageData(). */ interface ImageData { /** @@ -3985,8 +3985,10 @@ interface WindowOrWorkerGlobalScope { btoa(data: string): string; clearInterval(handle?: number): void; clearTimeout(handle?: number): void; + createImageBitmap(image: ImageBitmapSource, options?: ImageBitmapOptions): Promise; + createImageBitmap(image: ImageBitmapSource, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; fetch(input: RequestInfo, init?: RequestInit): Promise; - queueMicrotask(callback: Function): void; + queueMicrotask(callback: VoidFunction): void; setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number; setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number; } @@ -4015,7 +4017,8 @@ interface WorkerGlobalScopeEventMap { "error": ErrorEvent; } -interface WorkerGlobalScope extends EventTarget, WorkerUtils, WindowConsole, GlobalFetch, WindowOrWorkerGlobalScope, ImageBitmapWorker { +/** The WorkerGlobalScope interface of the Web Workers API is an interface representing the scope of any worker. Workers have no browsing context; this scope contains the information usually conveyed by Window objects — in this case event handlers, the console or the associated WorkerNavigator object. Each WorkerGlobalScope has its own event loop. */ +interface WorkerGlobalScope extends EventTarget, WorkerUtils, WindowConsole, GlobalFetch, WindowOrWorkerGlobalScope { readonly caches: CacheStorage; readonly isSecureContext: boolean; readonly location: WorkerLocation; @@ -4257,6 +4260,10 @@ interface EventHandlerNonNull { (event: Event): any; } +interface FrameRequestCallback { + (time: number): void; +} + interface PerformanceObserverCallback { (entries: PerformanceObserverEntryList, observer: PerformanceObserver): void; } @@ -4285,6 +4292,10 @@ interface TransformStreamDefaultControllerTransformCallback { (chunk: I, controller: TransformStreamDefaultController): void | PromiseLike; } +interface VoidFunction { + (): void; +} + interface WritableStreamDefaultControllerCloseCallback { (): void | PromiseLike; } @@ -4338,12 +4349,14 @@ declare function atob(data: string): string; declare function btoa(data: string): string; declare function clearInterval(handle?: number): void; declare function clearTimeout(handle?: number): void; +declare function createImageBitmap(image: ImageBitmapSource, options?: ImageBitmapOptions): Promise; +declare function createImageBitmap(image: ImageBitmapSource, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; declare function fetch(input: RequestInfo, init?: RequestInit): Promise; -declare function queueMicrotask(callback: Function): void; +declare function queueMicrotask(callback: VoidFunction): void; declare function setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number; declare function setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number; -declare function createImageBitmap(image: ImageBitmapSourceWorker, options?: ImageBitmapOptions): Promise; -declare function createImageBitmap(image: ImageBitmapSourceWorker, sx: number, sy: number, sw: number, sh: number, options?: ImageBitmapOptions): Promise; +declare function cancelAnimationFrame(handle: number): void; +declare function requestAnimationFrame(callback: FrameRequestCallback): number; declare function addEventListener(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; declare function addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; declare function removeEventListener(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, options?: boolean | EventListenerOptions): void; @@ -4353,8 +4366,9 @@ type HeadersInit = Headers | string[][] | Record; type BodyInit = Blob | BufferSource | FormData | URLSearchParams | ReadableStream | string; type RequestInfo = Request | string; type DOMHighResTimeStamp = number; +type CanvasImageSource = ImageBitmap; type MessageEventSource = MessagePort | ServiceWorker; -type ImageBitmapSourceWorker = ImageBitmap | Blob | ImageData; +type ImageBitmapSource = CanvasImageSource | Blob | ImageData; type TimerHandler = string | Function; type PerformanceEntryList = PerformanceEntry[]; type PushMessageDataInit = BufferSource | string; @@ -4384,6 +4398,7 @@ type Transferable = ArrayBuffer | MessagePort | ImageBitmap; type BinaryType = "blob" | "arraybuffer"; type ClientTypes = "window" | "worker" | "sharedworker" | "all"; type ColorSpaceConversion = "none" | "default"; +type EndingType = "transparent" | "native"; type IDBCursorDirection = "next" | "nextunique" | "prev" | "prevunique"; type IDBRequestReadyState = "pending" | "done"; type IDBTransactionMode = "readonly" | "readwrite" | "versionchange";