Skip to content

Commit 68619bb

Browse files
authored
Merge pull request #553 from saschanaz/fullscreen
Add Fullscreen types
2 parents ca92565 + a8095c2 commit 68619bb

File tree

8 files changed

+98
-61
lines changed

8 files changed

+98
-61
lines changed

baselines/dom.generated.d.ts

Lines changed: 60 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3887,6 +3887,8 @@ interface DhKeyGenParams extends Algorithm {
38873887
}
38883888

38893889
interface DocumentEventMap extends GlobalEventHandlersEventMap, DocumentAndElementEventHandlersEventMap {
3890+
"fullscreenchange": Event;
3891+
"fullscreenerror": Event;
38903892
"readystatechange": ProgressEvent;
38913893
"visibilitychange": Event;
38923894
}
@@ -4004,6 +4006,13 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par
40044006
* Retrieves a collection, in source order, of all form objects in the document.
40054007
*/
40064008
readonly forms: HTMLCollectionOf<HTMLFormElement>;
4009+
/** @deprecated */
4010+
readonly fullscreen: boolean;
4011+
/**
4012+
* Returns true if document has the ability to display elements fullscreen
4013+
* and fullscreen is supported, or false otherwise.
4014+
*/
4015+
readonly fullscreenEnabled: boolean;
40074016
/**
40084017
* Returns the head element.
40094018
*/
@@ -4038,6 +4047,8 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par
40384047
* Contains information about the current URL.
40394048
*/
40404049
location: Location | null;
4050+
onfullscreenchange: ((this: Document, ev: Event) => any) | null;
4051+
onfullscreenerror: ((this: Document, ev: Event) => any) | null;
40414052
/**
40424053
* Fires when the state of the object has changed.
40434054
* @param ev The event
@@ -4325,6 +4336,11 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par
43254336
* @param value Value to assign.
43264337
*/
43274338
execCommand(commandId: string, showUI?: boolean, value?: string): boolean;
4339+
/**
4340+
* Stops document's fullscreen element from being displayed fullscreen and
4341+
* resolves promise when done.
4342+
*/
4343+
exitFullscreen(): Promise<void>;
43284344
getAnimations(): Animation[];
43294345
/**
43304346
* 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
43404356
* @param elementName Gets a collection of objects based on the value of the NAME or ID attribute.
43414357
*/
43424358
getElementsByName(elementName: string): NodeListOf<HTMLElement>;
4343-
/**
4344-
* Displays help information for the given command identifier.
4345-
* @param commandId Displays help information for the given command identifier.
4346-
*/
43474359
/**
43484360
* Retrieves a collection of objects based on the specified element name.
43494361
* @param name Specifies the name of an element.
@@ -4352,32 +4364,23 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par
43524364
getElementsByTagName<K extends keyof SVGElementTagNameMap>(qualifiedName: K): HTMLCollectionOf<SVGElementTagNameMap[K]>;
43534365
getElementsByTagName(qualifiedName: string): HTMLCollectionOf<Element>;
43544366
/**
4355-
* Causes the element to receive the focus and executes the code specified by the onfocus event.
4356-
*/
4357-
/**
4358-
* Retrieves the string associated with a command.
4359-
* @param commandId String that contains the identifier of a command. This can be any command identifier given in the list of Command Identifiers.
4360-
*/
4361-
/**
4362-
* Returns the current value of the document, range, or current selection for the given command.
4367+
* Returns a Boolean value that indicates whether the specified command is in the indeterminate state.
43634368
* @param commandId String that specifies a command identifier.
43644369
*/
4365-
queryCommandValue(commandId: string): string;
4370+
queryCommandIndeterm(commandId: string): boolean;
43664371
/**
43674372
* Returns an object representing the current selection of the document that is loaded into the object displaying a webpage.
43684373
*/
43694374
/**
4370-
* Returns a Boolean value that indicates the current state of the command.
4371-
* @param commandId String that specifies a command identifier.
4375+
* Returns a Boolean value that indicates whether the current command is supported on the current range.
4376+
* @param commandId Specifies a command identifier.
43724377
*/
4373-
queryCommandState(commandId: string): boolean;
4374-
/** @deprecated */
4375-
releaseEvents(): void;
4378+
queryCommandSupported(commandId: string): boolean;
43764379
/**
4377-
* Returns a Boolean value that indicates whether the specified command is in the indeterminate state.
4380+
* Returns the current value of the document, range, or current selection for the given command.
43784381
* @param commandId String that specifies a command identifier.
43794382
*/
4380-
queryCommandIndeterm(commandId: string): boolean;
4383+
queryCommandValue(commandId: string): string;
43814384
/**
43824385
* Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document.
43834386
* @param commandId Specifies a command identifier.
@@ -4388,17 +4391,28 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par
43884391
*/
43894392
hasFocus(): boolean;
43904393
/**
4391-
* Returns a Boolean value that indicates whether the current command is supported on the current range.
4392-
* @param commandId Specifies a command identifier.
4394+
* Returns a Boolean value that indicates the current state of the command.
4395+
* @param commandId String that specifies a command identifier.
43934396
*/
4394-
queryCommandSupported(commandId: string): boolean;
4395-
msElementsFromRect(left: number, top: number, width: number, height: number): NodeListOf<Element>;
4396-
msElementsFromPoint(x: number, y: number): NodeListOf<Element>;
4397+
queryCommandState(commandId: string): boolean;
4398+
/**
4399+
* Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window.
4400+
* @param content The text and HTML tags to write.
4401+
*/
4402+
writeln(...text: string[]): void;
43974403
/**
43984404
* Writes one or more HTML expressions to a document in the specified window.
43994405
* @param content Specifies the text and HTML tags to write.
44004406
*/
44014407
write(...text: string[]): void;
4408+
/**
4409+
* 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.
4410+
* @param url Specifies a MIME type for the document.
4411+
* @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.
4412+
* @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.
4413+
* @param replace Specifies whether the existing entry for the document is replaced in the history list.
4414+
*/
4415+
open(url?: string, name?: string, features?: string, replace?: boolean): Document;
44024416
/**
44034417
* If namespace and localName are
44044418
* "*" returns a HTMLCollection of all descendant elements.
@@ -4409,20 +4423,9 @@ interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, Par
44094423
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf<HTMLElement>;
44104424
getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf<SVGElement>;
44114425
getElementsByTagNameNS(namespaceURI: string, localName: string): HTMLCollectionOf<Element>;
4412-
/**
4413-
* 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.
4414-
* @param url Specifies a MIME type for the document.
4415-
* @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.
4416-
* @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.
4417-
* @param replace Specifies whether the existing entry for the document is replaced in the history list.
4418-
*/
4419-
open(url?: string, name?: string, features?: string, replace?: boolean): Document;
44204426
importNode<T extends Node>(importedNode: T, deep: boolean): T;
4421-
/**
4422-
* Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window.
4423-
* @param content The text and HTML tags to write.
4424-
*/
4425-
writeln(...text: string[]): void;
4427+
/** @deprecated */
4428+
releaseEvents(): void;
44264429
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
44274430
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
44284431
removeEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
@@ -4626,6 +4629,11 @@ declare var EXT_texture_filter_anisotropic: {
46264629
readonly TEXTURE_MAX_ANISOTROPY_EXT: number;
46274630
};
46284631

4632+
interface ElementEventMap {
4633+
"fullscreenchange": Event;
4634+
"fullscreenerror": Event;
4635+
}
4636+
46294637
interface Element extends Node, ParentNode, NonDocumentTypeChildNode, ChildNode, Slotable, Animatable {
46304638
readonly assignedSlot: HTMLSlotElement | null;
46314639
readonly attributes: NamedNodeMap;
@@ -4657,6 +4665,8 @@ interface Element extends Node, ParentNode, NonDocumentTypeChildNode, ChildNode,
46574665
* Returns the namespace.
46584666
*/
46594667
readonly namespaceURI: string | null;
4668+
onfullscreenchange: ((this: Element, ev: Event) => any) | null;
4669+
onfullscreenerror: ((this: Element, ev: Event) => any) | null;
46604670
outerHTML: string;
46614671
/**
46624672
* Returns the namespace prefix.
@@ -4745,6 +4755,10 @@ interface Element extends Node, ParentNode, NonDocumentTypeChildNode, ChildNode,
47454755
*/
47464756
removeAttributeNS(namespace: string | null, localName: string): void;
47474757
removeAttributeNode(attr: Attr): Attr;
4758+
/**
4759+
* Displays element fullscreen and resolves promise when done.
4760+
*/
4761+
requestFullscreen(): Promise<void>;
47484762
scroll(options?: ScrollToOptions): void;
47494763
scroll(x: number, y: number): void;
47504764
scrollBy(options?: ScrollToOptions): void;
@@ -4770,6 +4784,10 @@ interface Element extends Node, ParentNode, NonDocumentTypeChildNode, ChildNode,
47704784
*/
47714785
toggleAttribute(qualifiedName: string, force?: boolean): boolean;
47724786
webkitMatchesSelector(selectors: string): boolean;
4787+
addEventListener<K extends keyof ElementEventMap>(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
4788+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
4789+
removeEventListener<K extends keyof ElementEventMap>(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
4790+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
47734791
}
47744792

47754793
declare var Element: {
@@ -6019,7 +6037,7 @@ declare var HTMLDocument: {
60196037
new(): HTMLDocument;
60206038
};
60216039

6022-
interface HTMLElementEventMap extends GlobalEventHandlersEventMap, DocumentAndElementEventHandlersEventMap {
6040+
interface HTMLElementEventMap extends ElementEventMap, GlobalEventHandlersEventMap, DocumentAndElementEventHandlersEventMap {
60236041
}
60246042

60256043
interface HTMLElement extends Element, GlobalEventHandlers, DocumentAndElementEventHandlers, ElementContentEditable, HTMLOrSVGElement, ElementCSSInlineStyle {
@@ -12123,7 +12141,7 @@ declare var SVGDescElement: {
1212312141
new(): SVGDescElement;
1212412142
};
1212512143

12126-
interface SVGElementEventMap extends GlobalEventHandlersEventMap, DocumentAndElementEventHandlersEventMap {
12144+
interface SVGElementEventMap extends ElementEventMap, GlobalEventHandlersEventMap, DocumentAndElementEventHandlersEventMap {
1212712145
}
1212812146

1212912147
interface SVGElement extends Element, GlobalEventHandlers, DocumentAndElementEventHandlers, SVGElementInstance, HTMLOrSVGElement, ElementCSSInlineStyle {
@@ -16475,6 +16493,7 @@ interface WindowOrWorkerGlobalScope {
1647516493
createImageBitmap(image: ImageBitmapSource): Promise<ImageBitmap>;
1647616494
createImageBitmap(image: ImageBitmapSource, sx: number, sy: number, sw: number, sh: number): Promise<ImageBitmap>;
1647716495
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
16496+
queueMicrotask(callback: Function): void;
1647816497
setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
1647916498
setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
1648016499
}
@@ -17530,6 +17549,7 @@ declare function clearTimeout(handle?: number): void;
1753017549
declare function createImageBitmap(image: ImageBitmapSource): Promise<ImageBitmap>;
1753117550
declare function createImageBitmap(image: ImageBitmapSource, sx: number, sy: number, sw: number, sh: number): Promise<ImageBitmap>;
1753217551
declare function fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
17552+
declare function queueMicrotask(callback: Function): void;
1753317553
declare function setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
1753417554
declare function setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
1753517555
declare var sessionStorage: Storage;

baselines/webworker.generated.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2654,6 +2654,7 @@ interface WindowOrWorkerGlobalScope {
26542654
createImageBitmap(image: ImageBitmapSource): Promise<ImageBitmap>;
26552655
createImageBitmap(image: ImageBitmapSource, sx: number, sy: number, sw: number, sh: number): Promise<ImageBitmap>;
26562656
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
2657+
queueMicrotask(callback: Function): void;
26572658
setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
26582659
setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
26592660
}
@@ -2935,6 +2936,7 @@ declare function clearTimeout(handle?: number): void;
29352936
declare function createImageBitmap(image: ImageBitmapSource): Promise<ImageBitmap>;
29362937
declare function createImageBitmap(image: ImageBitmapSource, sx: number, sy: number, sw: number, sh: number): Promise<ImageBitmap>;
29372938
declare function fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
2939+
declare function queueMicrotask(callback: Function): void;
29382940
declare function setInterval(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
29392941
declare function setTimeout(handler: TimerHandler, timeout?: number, ...arguments: any[]): number;
29402942
declare function addEventListener<K extends keyof DedicatedWorkerGlobalScopeEventMap>(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;

inputfiles/comments.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -785,9 +785,6 @@
785785
"elementFromPoint": {
786786
"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 */"
787787
},
788-
"queryCommandText": {
789-
"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 */"
790-
},
791788
"write": {
792789
"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 */"
793790
},
@@ -809,9 +806,6 @@
809806
"queryCommandEnabled": {
810807
"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 */"
811808
},
812-
"focus": {
813-
"comment": "/**\r\n * Causes the element to receive the focus and executes the code specified by the onfocus event.\r\n */"
814-
},
815809
"close": {
816810
"comment": "/**\r\n * Closes an output stream and forces the sent data to display.\r\n */"
817811
},
@@ -836,9 +830,6 @@
836830
"hasFocus": {
837831
"comment": "/**\r\n * Gets a value indicating whether the object currently has focus.\r\n */"
838832
},
839-
"execCommandShowHelp": {
840-
"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 */"
841-
},
842833
"createAttribute": {
843834
"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 */"
844835
},
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"element-requestfullscreen": "Displays element fullscreen and resolves promise when done.",
3+
"document-fullscreenenabled": "Returns true if document has the ability to display elements fullscreen\nand fullscreen is supported, or false otherwise.",
4+
"document-exitfullscreen": "Stops document's fullscreen element from being displayed fullscreen and\nresolves promise when done.",
5+
"document-fullscreenelement": "Returns shadowroot's fullscreen element."
6+
}

inputfiles/idl/Fullscreen.widl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
partial interface Element {
2+
Promise<void> requestFullscreen();
3+
4+
attribute EventHandler onfullscreenchange;
5+
attribute EventHandler onfullscreenerror;
6+
};
7+
8+
partial interface Document {
9+
[LenientSetter] readonly attribute boolean fullscreenEnabled;
10+
[LenientSetter, Unscopable] readonly attribute boolean fullscreen; // historical
11+
12+
Promise<void> exitFullscreen();
13+
14+
attribute EventHandler onfullscreenchange;
15+
attribute EventHandler onfullscreenerror;
16+
};
17+
18+
partial interface DocumentOrShadowRoot {
19+
[LenientSetter] readonly attribute Element? fullscreenElement;
20+
};

inputfiles/idl/HTML - Web application APIs.widl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,9 @@ interface mixin WindowOrWorkerGlobalScope {
143143
long setInterval(TimerHandler handler, optional long timeout = 0, any... arguments);
144144
void clearInterval(optional long handle = 0);
145145

146+
// microtask queuing
147+
void queueMicrotask(Function callback);
148+
146149
// ImageBitmap
147150
Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, optional ImageBitmapOptions options);
148151
Promise<ImageBitmap> createImageBitmap(ImageBitmapSource image, long sx, long sy, long sw, long sh, optional ImageBitmapOptions options);

inputfiles/idlSources.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@
3636
"url": "https://fetch.spec.whatwg.org/",
3737
"title": "Fetch"
3838
},
39+
{
40+
"url": "https://fullscreen.spec.whatwg.org/",
41+
"title": "Fullscreen"
42+
},
3943
{
4044
"url": "https://www.w3.org/TR/geolocation-API/",
4145
"title": "Geolocation"

0 commit comments

Comments
 (0)