Window.idl 4.2 KB

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