From 72eb2be5c446bc7f5de596230d389d70fc9460f9 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Thu, 2 Aug 2018 13:51:21 +0900 Subject: [PATCH] add Fullscreen types --- baselines/dom.generated.d.ts | 100 +++++++++++------- baselines/webworker.generated.d.ts | 2 + inputfiles/comments.json | 9 -- inputfiles/idl/Fullscreen.commentmap.json | 6 ++ inputfiles/idl/Fullscreen.widl | 20 ++++ .../idl/HTML - Web application APIs.widl | 3 + inputfiles/idlSources.json | 4 + inputfiles/overridingTypes.json | 17 +-- 8 files changed, 99 insertions(+), 62 deletions(-) create mode 100644 inputfiles/idl/Fullscreen.commentmap.json create mode 100644 inputfiles/idl/Fullscreen.widl diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index c9f4e278b..b12b0b2d8 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -3887,6 +3887,8 @@ interface DhKeyGenParams extends Algorithm { } interface DocumentEventMap extends GlobalEventHandlersEventMap, DocumentAndElementEventHandlersEventMap { + "fullscreenchange": Event; + "fullscreenerror": Event; "readystatechange": ProgressEvent; "visibilitychange": Event; } @@ -4004,6 +4006,13 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par * Retrieves a collection, in source order, of all form objects in the document. */ readonly forms: HTMLCollectionOf; + /** @deprecated */ + readonly fullscreen: boolean; + /** + * Returns true if document has the ability to display elements fullscreen + * and fullscreen is supported, or false otherwise. + */ + readonly fullscreenEnabled: boolean; /** * Returns the head element. */ @@ -4038,6 +4047,8 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par * Contains information about the current URL. */ location: Location | null; + onfullscreenchange: ((this: Document, ev: Event) => any) | null; + onfullscreenerror: ((this: Document, ev: Event) => any) | null; /** * Fires when the state of the object has changed. * @param ev The event @@ -4325,6 +4336,11 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par * @param value Value to assign. */ execCommand(commandId: string, showUI?: boolean, value?: string): boolean; + /** + * Stops document's fullscreen element from being displayed fullscreen and + * resolves promise when done. + */ + exitFullscreen(): Promise; getAnimations(): Animation[]; /** * Returns a reference to the first object with the specified value of the ID or NAME attribute. @@ -4340,10 +4356,6 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. */ getElementsByName(elementName: string): NodeListOf; - /** - * Displays help information for the given command identifier. - * @param commandId Displays help information for the given command identifier. - */ /** * Retrieves a collection of objects based on the specified element name. * @param name Specifies the name of an element. @@ -4352,32 +4364,23 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par getElementsByTagName(qualifiedName: K): HTMLCollectionOf; getElementsByTagName(qualifiedName: string): HTMLCollectionOf; /** - * Causes the element to receive the focus and executes the code specified by the onfocus event. - */ - /** - * Retrieves the string associated with a command. - * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers. - */ - /** - * Returns the current value of the document, range, or current selection for the given command. + * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. * @param commandId String that specifies a command identifier. */ - queryCommandValue(commandId: string): string; + queryCommandIndeterm(commandId: string): boolean; /** * Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. */ /** - * Returns a Boolean value that indicates the current state of the command. - * @param commandId String that specifies a command identifier. + * Returns a Boolean value that indicates whether the current command is supported on the current range. + * @param commandId Specifies a command identifier. */ - queryCommandState(commandId: string): boolean; - /** @deprecated */ - releaseEvents(): void; + queryCommandSupported(commandId: string): boolean; /** - * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. + * Returns the current value of the document, range, or current selection for the given command. * @param commandId String that specifies a command identifier. */ - queryCommandIndeterm(commandId: string): boolean; + queryCommandValue(commandId: string): string; /** * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. * @param commandId Specifies a command identifier. @@ -4388,17 +4391,28 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par */ hasFocus(): boolean; /** - * Returns a Boolean value that indicates whether the current command is supported on the current range. - * @param commandId Specifies a command identifier. + * Returns a Boolean value that indicates the current state of the command. + * @param commandId String that specifies a command identifier. */ - queryCommandSupported(commandId: string): boolean; - msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf; - msElementsFromPoint(x: number, y: number): NodeListOf; + queryCommandState(commandId: string): boolean; + /** + * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. + * @param content The text and HTML tags to write. + */ + writeln(...text: string[]): void; /** * Writes one or more HTML expressions to a document in the specified window. * @param content Specifies the text and HTML tags to write. */ write(...text: string[]): void; + /** + * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. + * @param url Specifies a MIME type for the document. + * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. + * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. + * @param replace Specifies whether the existing entry for the document is replaced in the history list. + */ + open(url?: string, name?: string, features?: string, replace?: boolean): Document; /** * If namespace and localName are * "*" returns a HTMLCollection of all descendant elements. @@ -4409,20 +4423,9 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf; - /** - * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. - * @param url Specifies a MIME type for the document. - * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. - * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. - * @param replace Specifies whether the existing entry for the document is replaced in the history list. - */ - open(url?: string, name?: string, features?: string, replace?: boolean): Document; importNode(importedNode: T, deep: boolean): T; - /** - * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. - * @param content The text and HTML tags to write. - */ - writeln(...text: string[]): void; + /** @deprecated */ + releaseEvents(): void; addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void; @@ -4626,6 +4629,11 @@ declare var EXT_texture_filter_anisotropic: { readonly TEXTURE_MAX_ANISOTROPY_EXT: number; }; +interface ElementEventMap { + "fullscreenchange": Event; + "fullscreenerror": Event; +} + interface Element extends Node, ParentNode, NonDocumentTypeChildNode, ChildNode, Slotable, Animatable { readonly assignedSlot: HTMLSlotElement | null; readonly attributes: NamedNodeMap; @@ -4656,6 +4664,8 @@ interface Element extends Node, ParentNode, NonDocumentTypeChildNode, ChildNode, * Returns the namespace. */ readonly namespaceURI: string | null; + onfullscreenchange: ((this: Element, ev: Event) => any) | null; + onfullscreenerror: ((this: Element, ev: Event) => any) | null; /** * Returns the namespace prefix. */ @@ -4743,6 +4753,10 @@ interface Element extends Node, ParentNode, NonDocumentTypeChildNode, ChildNode, */ removeAttributeNS(namespace: string | null, localName: string): void; removeAttributeNode(attr: Attr): Attr; + /** + * Displays element fullscreen and resolves promise when done. + */ + requestFullscreen(): Promise; scroll(options?: ScrollToOptions): void; scroll(x: number, y: number): void; scrollBy(options?: ScrollToOptions): void; @@ -4768,6 +4782,10 @@ interface Element extends Node, ParentNode, NonDocumentTypeChildNode, ChildNode, */ toggleAttribute(qualifiedName: string, force?: boolean): boolean; webkitMatchesSelector(selectors: string): boolean; + addEventListener(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; } declare var Element: { @@ -6013,7 +6031,7 @@ declare var HTMLDocument: { new(): HTMLDocument; }; -interface HTMLElementEventMap extends GlobalEventHandlersEventMap, DocumentAndElementEventHandlersEventMap { +interface HTMLElementEventMap extends ElementEventMap, GlobalEventHandlersEventMap, DocumentAndElementEventHandlersEventMap { } interface HTMLElement extends Element, GlobalEventHandlers, DocumentAndElementEventHandlers, ElementContentEditable, HTMLOrSVGElement { @@ -12113,7 +12131,7 @@ declare var SVGDescElement: { new(): SVGDescElement; }; -interface SVGElementEventMap extends GlobalEventHandlersEventMap, DocumentAndElementEventHandlersEventMap { +interface SVGElementEventMap extends ElementEventMap, GlobalEventHandlersEventMap, DocumentAndElementEventHandlersEventMap { } interface SVGElement extends Element, GlobalEventHandlers, DocumentAndElementEventHandlers, SVGElementInstance, HTMLOrSVGElement { @@ -16465,6 +16483,7 @@ interface WindowOrWorkerGlobalScope { 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; setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number; } @@ -17519,6 +17538,7 @@ 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 var sessionStorage: Storage; diff --git a/baselines/webworker.generated.d.ts b/baselines/webworker.generated.d.ts index 8862b8105..2fb41d298 100644 --- a/baselines/webworker.generated.d.ts +++ b/baselines/webworker.generated.d.ts @@ -2654,6 +2654,7 @@ interface WindowOrWorkerGlobalScope { 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; setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number; } @@ -2935,6 +2936,7 @@ 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 addEventListener(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; diff --git a/inputfiles/comments.json b/inputfiles/comments.json index 35685c918..834bd2bd4 100644 --- a/inputfiles/comments.json +++ b/inputfiles/comments.json @@ -785,9 +785,6 @@ "elementFromPoint": { "comment": "/**\r\n * Returns the element for the specified x coordinate and the specified y coordinate.\r\n * @param x The x-offset\r\n * @param y The y-offset\r\n */" }, - "queryCommandText": { - "comment": "/**\r\n * Retrieves the string associated with a command.\r\n * @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers.\r\n */" - }, "write": { "comment": "/**\r\n * Writes one or more HTML expressions to a document in the specified window.\r\n * @param content Specifies the text and HTML tags to write.\r\n */" }, @@ -809,9 +806,6 @@ "queryCommandEnabled": { "comment": "/**\r\n * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document.\r\n * @param commandId Specifies a command identifier.\r\n */" }, - "focus": { - "comment": "/**\r\n * Causes the element to receive the focus and executes the code specified by the onfocus event.\r\n */" - }, "close": { "comment": "/**\r\n * Closes an output stream and forces the sent data to display.\r\n */" }, @@ -836,9 +830,6 @@ "hasFocus": { "comment": "/**\r\n * Gets a value indicating whether the object currently has focus.\r\n */" }, - "execCommandShowHelp": { - "comment": "/**\r\n * Displays help information for the given command identifier.\r\n * @param commandId Displays help information for the given command identifier.\r\n */" - }, "createAttribute": { "comment": "/**\r\n * Creates an attribute object with a specified name.\r\n * @param name String that sets the attribute object's name.\r\n */" }, diff --git a/inputfiles/idl/Fullscreen.commentmap.json b/inputfiles/idl/Fullscreen.commentmap.json new file mode 100644 index 000000000..90111876d --- /dev/null +++ b/inputfiles/idl/Fullscreen.commentmap.json @@ -0,0 +1,6 @@ +{ + "element-requestfullscreen": "Displays element fullscreen and resolves promise when done.", + "document-fullscreenenabled": "Returns true if document has the ability to display elements fullscreen\nand fullscreen is supported, or false otherwise.", + "document-exitfullscreen": "Stops document's fullscreen element from being displayed fullscreen and\nresolves promise when done.", + "document-fullscreenelement": "Returns shadowroot's fullscreen element." +} diff --git a/inputfiles/idl/Fullscreen.widl b/inputfiles/idl/Fullscreen.widl new file mode 100644 index 000000000..61710f01e --- /dev/null +++ b/inputfiles/idl/Fullscreen.widl @@ -0,0 +1,20 @@ +partial interface Element { + Promise requestFullscreen(); + + attribute EventHandler onfullscreenchange; + attribute EventHandler onfullscreenerror; +}; + +partial interface Document { + [LenientSetter] readonly attribute boolean fullscreenEnabled; + [LenientSetter, Unscopable] readonly attribute boolean fullscreen; // historical + + Promise exitFullscreen(); + + attribute EventHandler onfullscreenchange; + attribute EventHandler onfullscreenerror; +}; + +partial interface DocumentOrShadowRoot { + [LenientSetter] readonly attribute Element? fullscreenElement; +}; diff --git a/inputfiles/idl/HTML - Web application APIs.widl b/inputfiles/idl/HTML - Web application APIs.widl index 85c8827a0..3737fceaa 100644 --- a/inputfiles/idl/HTML - Web application APIs.widl +++ b/inputfiles/idl/HTML - Web application APIs.widl @@ -143,6 +143,9 @@ interface mixin WindowOrWorkerGlobalScope { long setInterval(TimerHandler handler, optional long timeout = 0, any... arguments); void clearInterval(optional long handle = 0); + // 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); diff --git a/inputfiles/idlSources.json b/inputfiles/idlSources.json index b6210f9ef..3dd927f4f 100644 --- a/inputfiles/idlSources.json +++ b/inputfiles/idlSources.json @@ -32,6 +32,10 @@ "url": "https://fetch.spec.whatwg.org/", "title": "Fetch" }, + { + "url": "https://fullscreen.spec.whatwg.org/", + "title": "Fullscreen" + }, { "url": "https://www.w3.org/TR/geolocation-API/", "title": "Geolocation" diff --git a/inputfiles/overridingTypes.json b/inputfiles/overridingTypes.json index 21dd19c1c..baac005ad 100644 --- a/inputfiles/overridingTypes.json +++ b/inputfiles/overridingTypes.json @@ -363,18 +363,6 @@ "getElementById(elementId: string): HTMLElement | null" ] }, - "msElementsFromRect": { - "name": "msElementsFromRect", - "override-signatures": [ - "msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf" - ] - }, - "msElementsFromPoint": { - "name": "msElementsFromPoint", - "override-signatures": [ - "msElementsFromPoint(x: number, y: number): NodeListOf" - ] - }, "elementsFromPoint": { "name": "elementsFromPoint", "override-signatures": [ @@ -431,6 +419,9 @@ "name": "forms", "override-type": "HTMLCollectionOf" }, + "fullscreen": { + "deprecated": 1 + }, "images": { "name": "images", "override-type": "HTMLCollectionOf" @@ -2481,4 +2472,4 @@ "typedefs": { "typedef": [] } -} \ No newline at end of file +}