servo/components/script/dom/webidls/Document.webidl
Ngo Iok Ui (Wu Yu Wei) 40bac8c3df
script: document.visibilityState and document.hidden (#32635)
* Squashed commit of the following:

commit 5e0ea9996cb0d8137c3e1cd04487a1065b61289d
Author: Wu Yu Wei <yuweiwu@pm.me>
Date:   Thu Jul 11 13:37:51 2024 +0900

    Move lint to new_inherited

    Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>

commit a8cbfb1eef2650d153ef41c232d9e80e1118fc37
Merge: b819968f3e 7a33f8f008
Author: Wu Yu Wei <yuweiwu@pm.me>
Date:   Thu Jul 11 13:32:18 2024 +0900

    Merge branch 'main' into visibility

commit b819968f3eaa361c8a2cf3af679943ae2065ab32
Merge: eda2ec4c22 1c6b74e1f1
Author: Wu Wayne <yuweiwu@pm.me>
Date:   Tue Jul 9 14:26:43 2024 +0900

    Merge branch 'main' into visibility

commit eda2ec4c225c63236d6851ea525455cad8874ce5
Author: Wu Wayne <yuweiwu@pm.me>
Date:   Thu Jul 4 14:25:05 2024 +0900

    Include page-visibility tests to wpt

commit 9da7b4ee39b141e59e4a21a64445c4b08499463f
Author: Wu Yu Wei <yuweiwu@pm.me>
Date:   Thu Jul 4 12:50:40 2024 +0900

    Add TODO comment for future update

commit 11f55fea3ead0c8fa07f16557a63cc6a77c15c3f
Author: Wu Yu Wei <yuweiwu@pm.me>
Date:   Wed Jul 3 11:01:51 2024 +0900

    Add spaces between steps

commit 408c3e51f25867e85f894cd77a6355bc32f2aa00
Author: Wu Wayne <yuweiwu@pm.me>
Date:   Tue Jul 2 18:33:53 2024 +0900

    Update MANIFEST.json

commit 679fe4ffdd28554b11b4018395fac22a08ccbc34
Author: Wu Wayne <yuweiwu@pm.me>
Date:   Tue Jul 2 18:27:02 2024 +0900

    Add VisibilityStateEntry to mozilla/interfaces.html

commit 4a456a2b4a473fa795274edf56ecf660616f90eb
Author: Wu Wayne <yuweiwu@pm.me>
Date:   Tue Jul 2 14:28:11 2024 +0900

    Update meta results

commit cd191447ff61de392526e00c13f765c2df7a269e
Merge: 7ff480a698 ad01342f00
Author: Ngo Iok Ui (Wu Yu Wei) <yuweiwu@pm.me>
Date:   Tue Jul 2 13:47:49 2024 +0900

    Merge branch 'main' into visibility

commit 7ff480a698413ac5526edfb1b8731373bb9d04ae
Author: Wu Yu Wei <yuweiwu@pm.me>
Date:   Tue Jul 2 13:12:44 2024 +0900

    Update description text of update_visibility_state

commit 0e496b7bce4fd5476a1919737b00e8f0c9e2fdc8
Author: Wu Yu Wei <yuweiwu@pm.me>
Date:   Tue Jul 2 12:59:40 2024 +0900

    Add specification link to VisibilityStateEntry methods

commit 3e4a061450621bd17f19ff81099dd4daaeaea478
Author: Wu Yu Wei <yuweiwu@pm.me>
Date:   Tue Jul 2 12:31:53 2024 +0900

    Add descriptive text to each step

commit 8bbdfcae97db5002b09e5f5ecec6ae80d080dc95
Author: Wu Wayne <yuweiwu@pm.me>
Date:   Fri Jun 28 19:15:34 2024 +0900

    mach fmt

commit dc1c7a4aec6aba56af7afcfee6feadbee242a643
Author: Wu Wayne <yuweiwu@pm.me>
Date:   Fri Jun 28 19:01:00 2024 +0900

    Add update_visibility_state

commit 6aa18143319044dc084a9585ab064cd853bccc21
Author: Wu Wayne <yuweiwu@pm.me>
Date:   Fri Jun 28 16:06:25 2024 +0900

    Add VisibilityStateEntry.webidl

commit 638ae3cd563004334d35cc3fbdc1f918d29833d0
Author: Wu Yu Wei <yuweiwu@pm.me>
Date:   Fri Jun 28 13:39:29 2024 +0900

    Add visibilityState and hidden in Document.webidl

Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>

* Move creation into reflect call

Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>

---------

Signed-off-by: Wu Yu Wei <yuweiwu@pm.me>
2024-07-12 08:32:25 +00:00

220 lines
7.2 KiB
Text

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
/*
* The origin of this IDL file is:
* https://dom.spec.whatwg.org/#interface-document
* https://html.spec.whatwg.org/multipage/#the-document-object
*/
// https://dom.spec.whatwg.org/#interface-document
[Exposed=Window]
interface Document : Node {
[Throws] constructor();
[SameObject]
readonly attribute DOMImplementation implementation;
[Constant]
readonly attribute USVString URL;
[Constant]
readonly attribute USVString documentURI;
// readonly attribute USVString origin;
readonly attribute DOMString compatMode;
readonly attribute DOMString characterSet;
readonly attribute DOMString charset; // legacy alias of .characterSet
readonly attribute DOMString inputEncoding; // legacy alias of .characterSet
[Constant]
readonly attribute DOMString contentType;
[Pure]
readonly attribute DocumentType? doctype;
[Pure]
readonly attribute Element? documentElement;
HTMLCollection getElementsByTagName(DOMString qualifiedName);
HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString qualifiedName);
HTMLCollection getElementsByClassName(DOMString classNames);
[CEReactions, NewObject, Throws]
Element createElement(DOMString localName, optional (DOMString or ElementCreationOptions) options = {});
[CEReactions, NewObject, Throws]
Element createElementNS(DOMString? namespace, DOMString qualifiedName,
optional (DOMString or ElementCreationOptions) options = {});
[NewObject]
DocumentFragment createDocumentFragment();
[NewObject]
Text createTextNode(DOMString data);
[NewObject, Throws]
CDATASection createCDATASection(DOMString data);
[NewObject]
Comment createComment(DOMString data);
[NewObject, Throws]
ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
[CEReactions, NewObject, Throws]
Node importNode(Node node, optional boolean deep = false);
[CEReactions, Throws]
Node adoptNode(Node node);
[NewObject, Throws]
Attr createAttribute(DOMString localName);
[NewObject, Throws]
Attr createAttributeNS(DOMString? namespace, DOMString qualifiedName);
[NewObject, Throws]
Event createEvent(DOMString interface_);
[NewObject]
Range createRange();
// NodeFilter.SHOW_ALL = 0xFFFFFFFF
[NewObject]
NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF,
optional NodeFilter? filter = null);
[NewObject]
TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF,
optional NodeFilter? filter = null);
};
Document includes NonElementParentNode;
Document includes ParentNode;
enum DocumentReadyState { "loading", "interactive", "complete" };
enum DocumentVisibilityState { "visible", "hidden" };
dictionary ElementCreationOptions {
DOMString is;
};
// https://html.spec.whatwg.org/multipage/#the-document-object
// [LegacyOverrideBuiltIns]
partial /*sealed*/ interface Document {
// resource metadata management
[PutForwards=href, LegacyUnforgeable]
readonly attribute Location? location;
[SetterThrows] attribute DOMString domain;
readonly attribute DOMString referrer;
[Throws]
attribute DOMString cookie;
readonly attribute DOMString lastModified;
readonly attribute DocumentReadyState readyState;
// DOM tree accessors
getter NamedPropertyValue (DOMString name);
[CEReactions]
attribute DOMString title;
// [CEReactions]
// attribute DOMString dir;
[CEReactions, SetterThrows]
attribute HTMLElement? body;
readonly attribute HTMLHeadElement? head;
[SameObject]
readonly attribute HTMLCollection images;
[SameObject]
readonly attribute HTMLCollection embeds;
[SameObject]
readonly attribute HTMLCollection plugins;
[SameObject]
readonly attribute HTMLCollection links;
[SameObject]
readonly attribute HTMLCollection forms;
[SameObject]
readonly attribute HTMLCollection scripts;
NodeList getElementsByName(DOMString elementName);
readonly attribute HTMLScriptElement? currentScript;
// dynamic markup insertion
[CEReactions, Throws]
Document open(optional DOMString unused1, optional DOMString unused2);
[CEReactions, Throws]
WindowProxy? open(USVString url, DOMString name, DOMString features);
[CEReactions, Throws]
undefined close();
[CEReactions, Throws]
undefined write(DOMString... text);
[CEReactions, Throws]
undefined writeln(DOMString... text);
// user interaction
readonly attribute Window?/*Proxy?*/ defaultView;
boolean hasFocus();
// [CEReactions]
// attribute DOMString designMode;
// [CEReactions]
// boolean execCommand(DOMString commandId, optional boolean showUI = false, optional DOMString value = "");
// boolean queryCommandEnabled(DOMString commandId);
// boolean queryCommandIndeterm(DOMString commandId);
// boolean queryCommandState(DOMString commandId);
boolean queryCommandSupported(DOMString commandId);
// DOMString queryCommandValue(DOMString commandId);
readonly attribute boolean hidden;
readonly attribute DocumentVisibilityState visibilityState;
// special event handler IDL attributes that only apply to Document objects
[LegacyLenientThis] attribute EventHandler onreadystatechange;
// also has obsolete members
};
Document includes GlobalEventHandlers;
Document includes DocumentAndElementEventHandlers;
// https://html.spec.whatwg.org/multipage/#Document-partial
partial interface Document {
[CEReactions]
attribute [LegacyNullToEmptyString] DOMString fgColor;
// https://github.com/servo/servo/issues/8715
// [CEReactions, LegacyNullToEmptyString]
// attribute DOMString linkColor;
// https://github.com/servo/servo/issues/8716
// [CEReactions, LegacyNullToEmptyString]
// attribute DOMString vlinkColor;
// https://github.com/servo/servo/issues/8717
// [CEReactions, LegacyNullToEmptyString]
// attribute DOMString alinkColor;
[CEReactions]
attribute [LegacyNullToEmptyString] DOMString bgColor;
[SameObject]
readonly attribute HTMLCollection anchors;
[SameObject]
readonly attribute HTMLCollection applets;
undefined clear();
undefined captureEvents();
undefined releaseEvents();
// Tracking issue for document.all: https://github.com/servo/servo/issues/7396
// readonly attribute HTMLAllCollection all;
};
// https://fullscreen.spec.whatwg.org/#api
partial interface Document {
[LegacyLenientSetter] readonly attribute boolean fullscreenEnabled;
[LegacyLenientSetter] readonly attribute Element? fullscreenElement;
[LegacyLenientSetter] readonly attribute boolean fullscreen; // historical
Promise<undefined> exitFullscreen();
attribute EventHandler onfullscreenchange;
attribute EventHandler onfullscreenerror;
};
Document includes DocumentOrShadowRoot;
// https://w3c.github.io/selection-api/#dom-document
partial interface Document {
Selection? getSelection();
};
// Servo internal API.
partial interface Document {
[Throws]
ShadowRoot servoGetMediaControls(DOMString id);
};
// https://html.spec.whatwg.org/multipage/#dom-document-nameditem-filter
typedef (WindowProxy or Element or HTMLCollection) NamedPropertyValue;