Skip to content

Add Fullscreen types #553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 60 additions & 40 deletions baselines/dom.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3887,6 +3887,8 @@ interface DhKeyGenParams extends Algorithm {
}

interface DocumentEventMap extends GlobalEventHandlersEventMap, DocumentAndElementEventHandlersEventMap {
"fullscreenchange": Event;
"fullscreenerror": Event;
"readystatechange": ProgressEvent;
"visibilitychange": Event;
}
Expand Down Expand Up @@ -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<HTMLFormElement>;
/** @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.
*/
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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<void>;
getAnimations(): Animation[];
/**
* Returns a reference to the first object with the specified value of the ID or NAME attribute.
Expand All @@ -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<HTMLElement>;
/**
* 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.
Expand All @@ -4352,32 +4364,23 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par
getElementsByTagName<K extends keyof SVGElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<SVGElementTagNameMap[K]>;
getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
/**
* 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.
Expand All @@ -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<Element>;
msElementsFromPoint(x: number, y: number): NodeListOf<Element>;
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.
Expand All @@ -4409,20 +4423,9 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf<Element>;
/**
* 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<T extends Node>(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<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -4657,6 +4665,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;
outerHTML: string;
/**
* Returns the namespace prefix.
Expand Down Expand Up @@ -4745,6 +4755,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<void>;
scroll(options?: ScrollToOptions): void;
scroll(x: number, y: number): void;
scrollBy(options?: ScrollToOptions): void;
Expand All @@ -4770,6 +4784,10 @@ interface Element extends Node, ParentNode, NonDocumentTypeChildNode, ChildNode,
*/
toggleAttribute(qualifiedName: string, force?: boolean): boolean;
webkitMatchesSelector(selectors: string): boolean;
addEventListener<K extends keyof ElementEventMap>(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof ElementEventMap>(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: {
Expand Down Expand Up @@ -6019,7 +6037,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, ElementCSSInlineStyle {
Expand Down Expand Up @@ -12120,7 +12138,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, ElementCSSInlineStyle {
Expand Down Expand Up @@ -16472,6 +16490,7 @@ interface WindowOrWorkerGlobalScope {
createImageBitmap(image: ImageBitmapSource): Promise<ImageBitmap>;
createImageBitmap(image: ImageBitmapSource, sx: number, sy: number, sw: number, sh: number): Promise<ImageBitmap>;
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
queueMicrotask(callback: Function): void;
setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
}
Expand Down Expand Up @@ -17526,6 +17545,7 @@ declare function clearTimeout(handle?: number): void;
declare function createImageBitmap(image: ImageBitmapSource): Promise<ImageBitmap>;
declare function createImageBitmap(image: ImageBitmapSource, sx: number, sy: number, sw: number, sh: number): Promise<ImageBitmap>;
declare function fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
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;
Expand Down
2 changes: 2 additions & 0 deletions baselines/webworker.generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2654,6 +2654,7 @@ interface WindowOrWorkerGlobalScope {
createImageBitmap(image: ImageBitmapSource): Promise<ImageBitmap>;
createImageBitmap(image: ImageBitmapSource, sx: number, sy: number, sw: number, sh: number): Promise<ImageBitmap>;
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
queueMicrotask(callback: Function): void;
setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
}
Expand Down Expand Up @@ -2935,6 +2936,7 @@ declare function clearTimeout(handle?: number): void;
declare function createImageBitmap(image: ImageBitmapSource): Promise<ImageBitmap>;
declare function createImageBitmap(image: ImageBitmapSource, sx: number, sy: number, sw: number, sh: number): Promise<ImageBitmap>;
declare function fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
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<K extends keyof DedicatedWorkerGlobalScopeEventMap>(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
Expand Down
9 changes: 0 additions & 9 deletions inputfiles/comments.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 */"
},
Expand All @@ -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 */"
},
Expand All @@ -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 */"
},
Expand Down
6 changes: 6 additions & 0 deletions inputfiles/idl/Fullscreen.commentmap.json
Original file line number Diff line number Diff line change
@@ -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."
}
20 changes: 20 additions & 0 deletions inputfiles/idl/Fullscreen.widl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
partial interface Element {
Promise<void> requestFullscreen();

attribute EventHandler onfullscreenchange;
attribute EventHandler onfullscreenerror;
};

partial interface Document {
[LenientSetter] readonly attribute boolean fullscreenEnabled;
[LenientSetter, Unscopable] readonly attribute boolean fullscreen; // historical

Promise<void> exitFullscreen();

attribute EventHandler onfullscreenchange;
attribute EventHandler onfullscreenerror;
};

partial interface DocumentOrShadowRoot {
[LenientSetter] readonly attribute Element? fullscreenElement;
};
3 changes: 3 additions & 0 deletions inputfiles/idl/HTML - Web application APIs.widl
Original file line number Diff line number Diff line change
Expand Up @@ -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<ImageBitmap> createImageBitmap(ImageBitmapSource image, optional ImageBitmapOptions options);
Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, long sx, long sy, long sw, long sh, optional ImageBitmapOptions options);
Expand Down
4 changes: 4 additions & 0 deletions inputfiles/idlSources.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,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"
Expand Down
Loading