2 * Copyright (C) 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 JSCustomDefineOwnProperty,
32 CustomGetOwnPropertySlot,
33 CustomEnumerateProperty,
34 CustomProxyToJSObject,
36 JSCustomToNativeObject,
38 JSLegacyParent=JSDOMWindowBase,
40 ExportMacro=WEBCORE_EXPORT,
41 ] interface DOMWindow : EventTarget {
43 [Replaceable] readonly attribute Screen screen;
44 readonly attribute History history;
45 [Replaceable] readonly attribute BarProp locationbar;
46 [Replaceable] readonly attribute BarProp menubar;
47 [Replaceable] readonly attribute BarProp personalbar;
48 [Replaceable] readonly attribute BarProp scrollbars;
49 [Replaceable] readonly attribute BarProp statusbar;
50 [Replaceable] readonly attribute BarProp toolbar;
51 readonly attribute Navigator navigator;
52 [Replaceable] readonly attribute Navigator clientInformation;
53 readonly attribute Crypto crypto;
54 [DoNotCheckSecurity, CustomSetter, Unforgeable] attribute Location location;
55 [Replaceable, CustomGetter] readonly attribute Event event;
57 DOMSelection getSelection();
59 [CheckSecurityForNode] readonly attribute Element frameElement;
61 [DoNotCheckSecurity, CallWith=Document, ForwardDeclareInHeader] void focus();
62 [DoNotCheckSecurity, ForwardDeclareInHeader] void blur();
63 [DoNotCheckSecurity, CallWith=Document, ForwardDeclareInHeader] void close();
68 [Custom] DOMWindow open(DOMString url,
70 optional DOMString options);
72 [Custom] any showModalDialog(DOMString url,
73 optional any dialogArgs,
74 optional DOMString featureArgs);
76 // FIXME: Using "undefined" as default parameter value is wrong.
77 void alert(optional DOMString message = "undefined");
78 boolean confirm(optional DOMString message = "undefined");
79 DOMString? prompt(optional DOMString message = "undefined", optional DOMString? defaultValue = null);
81 // FIXME: Using "undefined" as default parameter value is wrong.
82 boolean find(optional DOMString string = "undefined",
83 optional boolean caseSensitive = false,
84 optional boolean backwards = false,
85 optional boolean wrap = false,
86 optional boolean wholeWord = false,
87 optional boolean searchInFrames = false,
88 optional boolean showDialog = false);
90 [Replaceable] readonly attribute boolean offscreenBuffering;
92 [Replaceable] readonly attribute long outerHeight;
93 [Replaceable] readonly attribute long outerWidth;
94 [Replaceable] readonly attribute long innerHeight;
95 [Replaceable] readonly attribute long innerWidth;
96 [Replaceable] readonly attribute long screenX;
97 [Replaceable] readonly attribute long screenY;
98 [Replaceable] readonly attribute long screenLeft;
99 [Replaceable] readonly attribute long screenTop;
100 [Replaceable] readonly attribute long scrollX;
101 [Replaceable] readonly attribute long scrollY;
102 readonly attribute long pageXOffset;
103 readonly attribute long pageYOffset;
105 void scrollBy(optional long x = 0, optional long y = 0);
106 void scrollTo(optional long x = 0, optional long y = 0);
107 void scroll(optional long x = 0, optional long y = 0);
108 void moveBy(optional unrestricted float x = NaN, optional unrestricted float y = NaN); // FIXME: this should take longs not floats.
109 void moveTo(optional unrestricted float x = NaN, optional unrestricted float y = NaN); // FIXME: this should take longs not floats.
110 void resizeBy(optional unrestricted float x = NaN, optional unrestricted float y = NaN); // FIXME: this should take longs not floats.
111 void resizeTo(optional unrestricted float width = NaN, optional unrestricted float height = NaN); // FIXME: this should take longs not floats.
113 [DoNotCheckSecurity, ForwardDeclareInHeader] readonly attribute boolean closed;
115 [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute unsigned long length;
117 attribute DOMString name;
119 attribute DOMString status;
120 attribute DOMString defaultStatus;
121 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
122 // This attribute is an alias of defaultStatus and is necessary for legacy uses.
123 [ImplementedAs=defaultStatus] attribute DOMString defaultstatus;
126 // Self referential attributes
127 [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute DOMWindow self;
128 [DoNotCheckSecurity, Unforgeable] readonly attribute DOMWindow window;
129 [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute DOMWindow frames;
131 [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute DOMWindow opener;
132 [Replaceable, DoNotCheckSecurityOnGetter] readonly attribute DOMWindow parent;
133 [DoNotCheckSecurityOnGetter, Unforgeable] readonly attribute DOMWindow top;
135 // DOM Level 2 AbstractView Interface
136 [Unforgeable] readonly attribute Document document;
139 MediaQueryList matchMedia(DOMString query);
141 // styleMedia has been removed from the CSSOM View specification.
142 readonly attribute StyleMedia styleMedia;
144 // DOM Level 2 Style Interface
145 CSSStyleDeclaration getComputedStyle(optional Element? element = null, optional DOMString? pseudoElement = null);
148 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
149 CSSRuleList getMatchedCSSRules(optional Element? element = null, optional DOMString? pseudoElement = null);
152 [Replaceable] readonly attribute unrestricted double devicePixelRatio;
154 WebKitPoint webkitConvertPointFromPageToNode(optional Node? node = null,
155 optional WebKitPoint? p = null);
156 WebKitPoint webkitConvertPointFromNodeToPage(optional Node? node = null,
157 optional WebKitPoint? p = null);
159 readonly attribute DOMApplicationCache applicationCache;
161 [GetterRaisesException] readonly attribute Storage sessionStorage;
162 [GetterRaisesException] readonly attribute Storage localStorage;
164 // This is the interface orientation in degrees. Some examples are:
165 // 0 is straight up; -90 is when the device is rotated 90 clockwise;
166 // 90 is when rotated counter clockwise.
167 [Conditional=ORIENTATION_EVENTS] readonly attribute long orientation;
169 // cross-document messaging
170 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
171 [DoNotCheckSecurity, Custom, RaisesException, ForwardDeclareInHeader] void postMessage(SerializedScriptValue message, DOMString targetOrigin, optional Array messagePorts);
173 // There's no good way to expose an array via the ObjC bindings, so for now just allow passing in a single port.
174 [DoNotCheckSecurity, Custom, RaisesException, ForwardDeclareInHeader] void postMessage(SerializedScriptValue message, optional MessagePort messagePort, DOMString targetOrigin);
177 [Conditional=WEB_TIMING, Replaceable] readonly attribute Performance performance;
179 [Conditional=REQUEST_ANIMATION_FRAME] long requestAnimationFrame(RequestAnimationFrameCallback callback);
180 [Conditional=REQUEST_ANIMATION_FRAME] void cancelAnimationFrame(long id);
181 [Conditional=REQUEST_ANIMATION_FRAME] long webkitRequestAnimationFrame(RequestAnimationFrameCallback callback);
182 [Conditional=REQUEST_ANIMATION_FRAME, ImplementedAs=cancelAnimationFrame] void webkitCancelAnimationFrame(long id);
183 [Conditional=REQUEST_ANIMATION_FRAME, ImplementedAs=cancelAnimationFrame] void webkitCancelRequestAnimationFrame(long id); // This is a deprecated alias for webkitCancelAnimationFrame(). Remove this when removing vendor prefix.
185 void captureEvents(/*in long eventFlags*/);
186 void releaseEvents(/*in long eventFlags*/);
188 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
189 // Additional constructors.
190 [CustomGetter, CustomConstructor] attribute HTMLImageElementNamedConstructor Image; // Usable with new operator
191 attribute DOMTokenListConstructor DOMSettableTokenList; // Map DOMSettableTokenList to DOMTokenList for backward compatibility.
193 attribute DOMURLConstructor webkitURL; // FIXME: deprecate this.
194 attribute MutationObserverConstructor WebKitMutationObserver; // FIXME: Add metrics to determine when we can remove this.
195 #endif // defined(LANGUAGE_JAVASCRIPT)
200 // Unique to Element and DOMWindow
201 // FIXME: Should these be exposed on Document as well (and therefore moved to GlobalEventHandlers.idl)?
202 [NotEnumerable] attribute EventHandler onanimationend;
203 [NotEnumerable] attribute EventHandler onanimationiteration;
204 [NotEnumerable] attribute EventHandler onanimationstart;
205 [NotEnumerable] attribute EventHandler ontransitionend;
206 [NotEnumerable, ImplementedAs=onwebkitAnimationEnd] attribute EventHandler onwebkitanimationend;
207 [NotEnumerable, ImplementedAs=onwebkitAnimationIteration] attribute EventHandler onwebkitanimationiteration;
208 [NotEnumerable, ImplementedAs=onwebkitAnimationStart] attribute EventHandler onwebkitanimationstart;
209 [NotEnumerable, ImplementedAs=onwebkitTransitionEnd] attribute EventHandler onwebkittransitionend;
210 [NotEnumerable, Conditional=IOS_GESTURE_EVENTS] attribute EventHandler ongesturechange;
211 [NotEnumerable, Conditional=IOS_GESTURE_EVENTS] attribute EventHandler ongestureend;
212 [NotEnumerable, Conditional=IOS_GESTURE_EVENTS] attribute EventHandler ongesturestart;
214 // Unique to DOMWindow
215 [NotEnumerable, Conditional=DEVICE_ORIENTATION] attribute EventHandler ondevicemotion;
216 [NotEnumerable, Conditional=DEVICE_ORIENTATION] attribute EventHandler ondeviceorientation;
217 [NotEnumerable, Conditional=PROXIMITY_EVENTS] attribute EventHandler onwebkitdeviceproximity;
220 DOMWindow implements GlobalEventHandlers;
221 DOMWindow implements WindowBase64;
222 DOMWindow implements WindowEventHandlers;
223 DOMWindow implements WindowTimers;