Window.idl 5.0 KB

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