Window.idl 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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/CustomElements/CustomElementRegistry.idl>
  10. #import <HTML/Navigator.idl>
  11. #import <HTML/WindowLocalStorage.idl>
  12. #import <HTML/WindowOrWorkerGlobalScope.idl>
  13. #import <HTML/WindowSessionStorage.idl>
  14. #import <RequestIdleCallback/IdleRequest.idl>
  15. // https://html.spec.whatwg.org/multipage/nav-history-apis.html#window
  16. [Global=Window, Exposed=Window, LegacyUnenumerableNamedProperties, UseNewAKString]
  17. interface 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. readonly attribute CustomElementRegistry customElements;
  26. undefined focus();
  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. // the user agent
  35. readonly attribute Navigator navigator;
  36. [ImplementedAs=navigator] readonly attribute Navigator clientInformation; // legacy alias of .navigator
  37. // user prompts
  38. undefined alert();
  39. undefined alert(DOMString message);
  40. boolean confirm(optional DOMString message = "");
  41. DOMString? prompt(optional DOMString message = "", optional DOMString default = "");
  42. undefined postMessage(any message, USVString targetOrigin);
  43. // FIXME: undefined postMessage(any message, USVString targetOrigin, optional sequence<object> transfer = []);
  44. // FIXME: undefined postMessage(any message, optional WindowPostMessageOptions options = {});
  45. // https://dom.spec.whatwg.org/#interface-window-extensions
  46. [Replaceable] readonly attribute (Event or undefined) event; // legacy
  47. // https://w3c.github.io/csswg-drafts/cssom/#extensions-to-the-window-interface
  48. [NewObject] CSSStyleDeclaration getComputedStyle(Element elt, optional CSSOMString? pseudoElt);
  49. // https://w3c.github.io/csswg-drafts/cssom-view/#extensions-to-the-window-interface
  50. [NewObject] MediaQueryList matchMedia(CSSOMString query);
  51. [SameObject, Replaceable] readonly attribute Screen screen;
  52. // viewport
  53. [Replaceable] readonly attribute long innerWidth;
  54. [Replaceable] readonly attribute long innerHeight;
  55. // viewport scrolling
  56. [Replaceable] readonly attribute double scrollX;
  57. [Replaceable, ImplementedAs=scroll_x] readonly attribute double pageXOffset;
  58. [Replaceable] readonly attribute double scrollY;
  59. [Replaceable, ImplementedAs=scroll_y] readonly attribute double pageYOffset;
  60. undefined scroll(optional ScrollToOptions options = {});
  61. undefined scroll(unrestricted double x, unrestricted double y);
  62. [ImplementedAs=scroll] undefined scrollTo(optional ScrollToOptions options = {});
  63. [ImplementedAs=scroll] undefined scrollTo(unrestricted double x, unrestricted double y);
  64. undefined scrollBy(optional ScrollToOptions options = {});
  65. undefined scrollBy(unrestricted double x, unrestricted double y);
  66. // client
  67. [Replaceable] readonly attribute long screenX;
  68. [Replaceable, ImplementedAs=screen_x] readonly attribute long screenLeft;
  69. [Replaceable] readonly attribute long screenY;
  70. [Replaceable, ImplementedAs=screen_y] readonly attribute long screenTop;
  71. [Replaceable] readonly attribute long outerWidth;
  72. [Replaceable] readonly attribute long outerHeight;
  73. [Replaceable] readonly attribute double devicePixelRatio;
  74. // https://w3c.github.io/requestidlecallback/#window_extensions
  75. unsigned long requestIdleCallback(IdleRequestCallback callback, optional IdleRequestOptions options = {});
  76. undefined cancelIdleCallback(unsigned long handle);
  77. // https://w3c.github.io/selection-api/#extensions-to-window-interface
  78. Selection? getSelection();
  79. // FIXME: Everything from here on should be shared through WindowOrWorkerGlobalScope
  80. // https://w3c.github.io/hr-time/#the-performance-attribute
  81. [Replaceable] readonly attribute Performance performance;
  82. // https://w3c.github.io/webcrypto/#crypto-interface
  83. [SameObject] readonly attribute Crypto crypto;
  84. };
  85. Window includes AnimationFrameProvider;
  86. Window includes GlobalEventHandlers;
  87. Window includes WindowEventHandlers;
  88. Window includes WindowLocalStorage;
  89. Window includes WindowSessionStorage;
  90. Window includes WindowOrWorkerGlobalScope;
  91. enum ScrollBehavior { "auto", "instant", "smooth" };
  92. dictionary ScrollOptions {
  93. ScrollBehavior behavior = "auto";
  94. };
  95. dictionary ScrollToOptions : ScrollOptions {
  96. unrestricted double left;
  97. unrestricted double top;
  98. };