Window.idl 5.3 KB

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