2 * Copyright (C) 2006, 2007, 2008, 2009 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 COMPUTER, 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 COMPUTER, 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.
28 // http://www.w3.org/html/wg/drafts/html/master/browsers.html#window
29 // FIXME: explain all uses of [DoNotCheckSecurity]
33 ImplementedAs=LocalDOMWindow,
35 WillBeGarbageCollected,
36 ] interface Window : EventTarget {
38 readonly attribute Screen screen;
39 readonly attribute History history;
40 [Replaceable, MeasureAs=BarPropLocationbar] readonly attribute BarProp locationbar;
41 [Replaceable, MeasureAs=BarPropMenubar] readonly attribute BarProp menubar;
42 [Replaceable, MeasureAs=BarPropPersonalbar] readonly attribute BarProp personalbar;
43 [Replaceable, MeasureAs=BarPropScrollbars] readonly attribute BarProp scrollbars;
44 [Replaceable, MeasureAs=BarPropStatusbar] readonly attribute BarProp statusbar;
45 [Replaceable, MeasureAs=BarPropToolbar] readonly attribute BarProp toolbar;
46 [LogActivity=GetterOnly] readonly attribute Navigator navigator;
47 [Replaceable] readonly attribute Navigator clientInformation;
48 [DoNotCheckSecurity, Unforgeable, Replaceable, LogActivity, PutForwards=href] readonly attribute Location location;
49 [Custom, MeasureAs=WindowEvent, NotEnumerable] attribute Event event;
51 Selection getSelection();
53 [CheckSecurity=Node, Custom=Getter] readonly attribute Element frameElement;
55 [DoNotCheckSecurity, CallWith=ExecutionContext] void focus();
56 [DoNotCheckSecurity] void blur();
57 [DoNotCheckSecurity, CallWith=ExecutionContext] void close();
62 [Custom] Window open(DOMString url,
64 optional DOMString options);
66 [RuntimeEnabled=ShowModalDialog, Custom] any showModalDialog(DOMString url,
67 optional any dialogArgs,
68 optional DOMString featureArgs);
71 void alert(DOMString message);
72 boolean confirm(optional DOMString message = null);
73 [TreatReturnedNullStringAs=Null] DOMString prompt(optional DOMString message = null,
74 optional DOMString defaultValue = null);
76 boolean find([Default=Undefined] optional DOMString string,
77 [Default=Undefined] optional boolean caseSensitive,
78 [Default=Undefined] optional boolean backwards,
79 [Default=Undefined] optional boolean wrap,
80 [Default=Undefined] optional boolean wholeWord,
81 [Default=Undefined] optional boolean searchInFrames,
82 [Default=Undefined] optional boolean showDialog);
84 [Replaceable, MeasureAs=WindowOffscreenBuffering] readonly attribute boolean offscreenBuffering;
86 [Replaceable] readonly attribute long outerHeight;
87 [Replaceable] readonly attribute long outerWidth;
88 [Replaceable] readonly attribute long innerHeight;
89 [Replaceable] readonly attribute long innerWidth;
90 [Replaceable] readonly attribute long screenX;
91 [Replaceable] readonly attribute long screenY;
92 [Replaceable] readonly attribute long screenLeft;
93 [Replaceable] readonly attribute long screenTop;
94 [Replaceable] readonly attribute long scrollX;
95 [Replaceable] readonly attribute long scrollY;
96 readonly attribute long pageXOffset;
97 readonly attribute long pageYOffset;
99 // Overloading can be replaced by optional if RuntimeEnabled is removed, by
100 // changing the third argument to *optional* Dictionary scrollOptions
101 void scrollBy(long x, long y);
102 [RuntimeEnabled=CSSOMSmoothScroll, RaisesException] void scrollBy(long x, long y, Dictionary scrollOptions);
103 void scrollTo(long x, long y);
104 [RuntimeEnabled=CSSOMSmoothScroll, RaisesException] void scrollTo(long x, long y, Dictionary scrollOptions);
105 void scroll(long x, long y);
106 [RuntimeEnabled=CSSOMSmoothScroll, RaisesException] void scroll(long x, long y, Dictionary scrollOptions);
107 void moveBy([Default=Undefined] optional float x, [Default=Undefined] optional float y); // FIXME: this should take longs not floats.
108 void moveTo([Default=Undefined] optional float x, [Default=Undefined] optional float y); // FIXME: this should take longs not floats.
109 void resizeBy([Default=Undefined] optional float x, [Default=Undefined] optional float y); // FIXME: this should take longs not floats.
110 void resizeTo([Default=Undefined] optional float width, [Default=Undefined] optional float height); // FIXME: this should take longs not floats.
112 [DoNotCheckSecurity] readonly attribute boolean closed;
114 [Replaceable, DoNotCheckSecurity] readonly attribute unsigned long length;
116 attribute DOMString name;
118 attribute DOMString status;
119 [MeasureAs=WindowDefaultStatus] attribute DOMString defaultStatus;
120 // This attribute is an alias of defaultStatus and is necessary for legacy uses.
121 [ImplementedAs=defaultStatus, MeasureAs=WindowDefaultstatus] attribute DOMString defaultstatus;
123 // Self referential attributes
124 [Replaceable, DoNotCheckSecurity] readonly attribute Window self;
125 [DoNotCheckSecurity, Unforgeable] readonly attribute Window window;
126 [Replaceable, DoNotCheckSecurity] readonly attribute Window frames;
128 [DoNotCheckSecurity, Custom=Setter] attribute Window opener;
129 [Replaceable, DoNotCheckSecurity] readonly attribute Window parent;
130 [DoNotCheckSecurity, Unforgeable] readonly attribute Window top;
132 // DOM Level 2 AbstractView Interface
133 readonly attribute Document document;
136 MediaQueryList matchMedia(DOMString query);
138 // styleMedia has been removed from the CSSOM View specification.
139 readonly attribute StyleMedia styleMedia;
141 // DOM Level 2 Style Interface
142 CSSStyleDeclaration getComputedStyle([Default=Undefined] optional Element element,
143 [TreatNullAs=NullString, TreatUndefinedAs=NullString, Default=Undefined] optional DOMString pseudoElement);
146 [MeasureAs=GetMatchedCSSRules] CSSRuleList getMatchedCSSRules([Default=Undefined] optional Element element,
147 [TreatNullAs=NullString, TreatUndefinedAs=NullString, Default=Undefined] optional DOMString pseudoElement);
149 [Replaceable] readonly attribute double devicePixelRatio;
151 [MeasureAs=PrefixedConvertPointFromPageToNode] WebKitPoint webkitConvertPointFromPageToNode([Default=Undefined] optional Node node,
152 [Default=Undefined] optional WebKitPoint p);
153 [MeasureAs=PrefixedConvertPointFromNodeToPage] WebKitPoint webkitConvertPointFromNodeToPage([Default=Undefined] optional Node node,
154 [Default=Undefined] optional WebKitPoint p);
156 [RuntimeEnabled=ApplicationCache, LogActivity=GetterOnly] readonly attribute ApplicationCache applicationCache;
158 [RuntimeEnabled=SessionStorage, LogActivity=GetterOnly, RaisesException=Getter] readonly attribute Storage sessionStorage;
159 [RuntimeEnabled=LocalStorage, LogActivity=GetterOnly, RaisesException=Getter] readonly attribute Storage localStorage;
161 // This is the interface orientation in degrees. Some examples are:
162 // 0 is straight up; -90 is when the device is rotated 90 clockwise;
163 // 90 is when rotated counter clockwise.
164 [RuntimeEnabled=OrientationEvent, MeasureAs=WindowOrientation] readonly attribute long orientation;
166 [Replaceable] readonly attribute Console console;
168 // cross-document messaging
169 [DoNotCheckSecurity, Custom, RaisesException] void postMessage(SerializedScriptValue message, DOMString targetOrigin, optional MessagePort[] messagePorts);
171 [Replaceable] readonly attribute Performance performance;
173 [MeasureAs=UnprefixedRequestAnimationFrame] long requestAnimationFrame(RequestAnimationFrameCallback callback);
174 void cancelAnimationFrame(long id);
175 [DeprecateAs=PrefixedRequestAnimationFrame] long webkitRequestAnimationFrame(RequestAnimationFrameCallback callback);
176 [DeprecateAs=PrefixedCancelAnimationFrame, ImplementedAs=cancelAnimationFrame] void webkitCancelAnimationFrame(long id);
177 [DeprecateAs=PrefixedCancelRequestAnimationFrame, ImplementedAs=cancelAnimationFrame] void webkitCancelRequestAnimationFrame(long id);
179 [Replaceable] readonly attribute CSS CSS;
181 // Event handler attributes
182 [RuntimeEnabled=CSSAnimationUnprefixed] attribute EventHandler onanimationend;
183 [RuntimeEnabled=CSSAnimationUnprefixed] attribute EventHandler onanimationiteration;
184 [RuntimeEnabled=CSSAnimationUnprefixed] attribute EventHandler onanimationstart;
185 [RuntimeEnabled=OrientationEvent] attribute EventHandler onorientationchange;
186 attribute EventHandler onsearch;
187 [RuntimeEnabled=Touch] attribute EventHandler ontouchcancel;
188 [RuntimeEnabled=Touch] attribute EventHandler ontouchend;
189 [RuntimeEnabled=Touch] attribute EventHandler ontouchmove;
190 [RuntimeEnabled=Touch] attribute EventHandler ontouchstart;
191 attribute EventHandler ontransitionend;
192 attribute EventHandler onwebkitanimationend;
193 attribute EventHandler onwebkitanimationiteration;
194 attribute EventHandler onwebkitanimationstart;
195 attribute EventHandler onwebkittransitionend;
196 [LogActivity=SetterOnly] attribute EventHandler onwheel;
198 [MeasureAs=WindowCaptureEvents] void captureEvents();
199 [MeasureAs=WindowReleaseEvents] void releaseEvents();
201 // Additional constructors.
202 [MeasureAs=PrefixedTransitionEventConstructor] attribute TransitionEventConstructor WebKitTransitionEvent;
203 [RuntimeEnabled=CSSAnimationUnprefixed] attribute WebKitAnimationEventConstructor AnimationEvent;
204 [MeasureAs=PrefixedWindowURL] attribute URLConstructor webkitURL; // FIXME: deprecate this.
205 [MeasureAs=PrefixedMutationObserverConstructor] attribute MutationObserverConstructor WebKitMutationObserver;
207 // window.toString() requires special handling in V8
208 [DoNotCheckSignature, DoNotCheckSecurity, Custom, NotEnumerable] DOMString toString();
210 [NotEnumerable] getter Window (unsigned long index);
211 [Custom, NotEnumerable] getter Window (DOMString name);
214 Window implements GlobalEventHandlers;
215 Window implements WindowBase64;
216 Window implements WindowEventHandlers;
217 Window implements WindowTimers;