Serenity Operating System
at master 113 lines 5.2 kB view raw
1#import <Crypto/Crypto.idl> 2#import <CSS/MediaQueryList.idl> 3#import <CSS/Screen.idl> 4#import <DOM/Document.idl> 5#import <DOM/EventHandler.idl> 6#import <DOM/EventTarget.idl> 7#import <HighResolutionTime/Performance.idl> 8#import <HTML/AnimationFrameProvider.idl> 9#import <HTML/Navigator.idl> 10#import <HTML/WindowLocalStorage.idl> 11#import <HTML/WindowOrWorkerGlobalScope.idl> 12#import <HTML/WindowSessionStorage.idl> 13#import <RequestIdleCallback/IdleRequest.idl> 14 15// https://html.spec.whatwg.org/multipage/nav-history-apis.html#window 16[Global=Window, Exposed=Window, LegacyUnenumerableNamedProperties, UseNewAKString] 17interface Window : EventTarget { 18 // the current browsing context 19 [LegacyUnforgeable] readonly attribute WindowProxy window; 20 [Replaceable] readonly attribute WindowProxy self; 21 [LegacyUnforgeable] readonly attribute Document document; 22 attribute DOMString name; 23 [PutForwards=href, LegacyUnforgeable] readonly attribute Location location; 24 readonly attribute History history; 25 undefined focus(); 26 27 // other browsing contexts 28 [Replaceable] readonly attribute WindowProxy frames; 29 [Replaceable] readonly attribute unsigned long length; 30 [LegacyUnforgeable] readonly attribute WindowProxy? top; 31 [Replaceable] readonly attribute WindowProxy? parent; 32 readonly attribute Element? frameElement; 33 WindowProxy? open(optional USVString url = "", optional DOMString target = "_blank", optional [LegacyNullToEmptyString] DOMString features = ""); 34 35 // the user agent 36 readonly attribute Navigator navigator; 37 [ImplementedAs=navigator] readonly attribute Navigator clientInformation; // legacy alias of .navigator 38 39 // user prompts 40 undefined alert(); 41 undefined alert(DOMString message); 42 boolean confirm(optional DOMString message = ""); 43 DOMString? prompt(optional DOMString message = "", optional DOMString default = ""); 44 45 undefined postMessage(any message, USVString targetOrigin); 46 // FIXME: undefined postMessage(any message, USVString targetOrigin, optional sequence<object> transfer = []); 47 // FIXME: undefined postMessage(any message, optional WindowPostMessageOptions options = {}); 48 49 // https://dom.spec.whatwg.org/#interface-window-extensions 50 [Replaceable] readonly attribute (Event or undefined) event; // legacy 51 52 // https://w3c.github.io/csswg-drafts/cssom/#extensions-to-the-window-interface 53 [NewObject] CSSStyleDeclaration getComputedStyle(Element elt, optional CSSOMString? pseudoElt); 54 55 // https://w3c.github.io/csswg-drafts/cssom-view/#extensions-to-the-window-interface 56 [NewObject] MediaQueryList matchMedia(CSSOMString query); 57 [SameObject, Replaceable] readonly attribute Screen screen; 58 59 // viewport 60 [Replaceable] readonly attribute long innerWidth; 61 [Replaceable] readonly attribute long innerHeight; 62 63 // viewport scrolling 64 [Replaceable] readonly attribute double scrollX; 65 [Replaceable, ImplementedAs=scroll_x] readonly attribute double pageXOffset; 66 [Replaceable] readonly attribute double scrollY; 67 [Replaceable, ImplementedAs=scroll_y] readonly attribute double pageYOffset; 68 undefined scroll(optional ScrollToOptions options = {}); 69 undefined scroll(unrestricted double x, unrestricted double y); 70 [ImplementedAs=scroll] undefined scrollTo(optional ScrollToOptions options = {}); 71 [ImplementedAs=scroll] undefined scrollTo(unrestricted double x, unrestricted double y); 72 undefined scrollBy(optional ScrollToOptions options = {}); 73 undefined scrollBy(unrestricted double x, unrestricted double y); 74 75 // client 76 [Replaceable] readonly attribute long screenX; 77 [Replaceable, ImplementedAs=screen_x] readonly attribute long screenLeft; 78 [Replaceable] readonly attribute long screenY; 79 [Replaceable, ImplementedAs=screen_y] readonly attribute long screenTop; 80 [Replaceable] readonly attribute long outerWidth; 81 [Replaceable] readonly attribute long outerHeight; 82 [Replaceable] readonly attribute double devicePixelRatio; 83 84 // https://w3c.github.io/requestidlecallback/#window_extensions 85 unsigned long requestIdleCallback(IdleRequestCallback callback, optional IdleRequestOptions options = {}); 86 undefined cancelIdleCallback(unsigned long handle); 87 88 // https://w3c.github.io/selection-api/#extensions-to-window-interface 89 Selection? getSelection(); 90 91 // FIXME: Everything from here on should be shared through WindowOrWorkerGlobalScope 92 // https://w3c.github.io/hr-time/#the-performance-attribute 93 [Replaceable] readonly attribute Performance performance; 94 95 // https://w3c.github.io/webcrypto/#crypto-interface 96 [SameObject] readonly attribute Crypto crypto; 97}; 98Window includes AnimationFrameProvider; 99Window includes GlobalEventHandlers; 100Window includes WindowEventHandlers; 101Window includes WindowLocalStorage; 102Window includes WindowSessionStorage; 103Window includes WindowOrWorkerGlobalScope; 104 105enum ScrollBehavior { "auto", "instant", "smooth" }; 106 107dictionary ScrollOptions { 108 ScrollBehavior behavior = "auto"; 109}; 110dictionary ScrollToOptions : ScrollOptions { 111 unrestricted double left; 112 unrestricted double top; 113};