initial import
[vuplus_webkit] / Source / WebCore / dom / Document.idl
1 /*
2  * Copyright (C) 2006, 2007, 2011 Apple Inc. All rights reserved.
3  * Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public License
16  * along with this library; see the file COPYING.LIB.  If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20
21 module core {
22
23     interface [
24         CustomToJS,
25         GenerateNativeConverter,
26         InlineGetOwnPropertySlot
27     ] Document : Node {
28
29         // DOM Level 1 Core
30         readonly attribute DocumentType doctype;
31         readonly attribute DOMImplementation implementation;
32         readonly attribute Element documentElement;
33
34         [ReturnsNew] Element createElement(in [ConvertNullToNullString,Optional=CallWithDefaultValue] DOMString tagName)
35             raises (DOMException);
36         DocumentFragment   createDocumentFragment();
37         [ReturnsNew] Text createTextNode(in [Optional=CallWithDefaultValue] DOMString data);
38         [ReturnsNew] Comment createComment(in [Optional=CallWithDefaultValue] DOMString data);
39         [ReturnsNew] CDATASection createCDATASection(in [Optional=CallWithDefaultValue] DOMString data)
40             raises(DOMException);
41         [OldStyleObjC, ReturnsNew] ProcessingInstruction createProcessingInstruction(in [Optional=CallWithDefaultValue] DOMString target,
42                                                                                      in [Optional=CallWithDefaultValue] DOMString data)
43             raises (DOMException);
44         [ReturnsNew] Attr createAttribute(in [Optional=CallWithDefaultValue] DOMString name)
45             raises (DOMException);
46         [ReturnsNew] EntityReference createEntityReference(in [Optional=CallWithDefaultValue] DOMString name)
47             raises(DOMException);
48         NodeList           getElementsByTagName(in [Optional=CallWithDefaultValue] DOMString tagname);
49
50         // Introduced in DOM Level 2:
51
52         [OldStyleObjC, ReturnsNew] Node importNode(in [Optional=CallWithDefaultValue] Node importedNode,
53                                                    in [Optional=CallWithDefaultValue] boolean deep)
54             raises (DOMException);
55         [OldStyleObjC, ReturnsNew] Element createElementNS(in [ConvertNullToNullString,Optional=CallWithDefaultValue] DOMString namespaceURI,
56                                                            in [ConvertNullToNullString,Optional=CallWithDefaultValue] DOMString qualifiedName)
57             raises (DOMException);
58         [OldStyleObjC, ReturnsNew] Attr createAttributeNS(in [ConvertNullToNullString,Optional=CallWithDefaultValue] DOMString namespaceURI,
59                                                           in [ConvertNullToNullString,Optional=CallWithDefaultValue] DOMString qualifiedName)
60             raises (DOMException);
61         [OldStyleObjC] NodeList getElementsByTagNameNS(in [ConvertNullToNullString,Optional=CallWithDefaultValue] DOMString namespaceURI,
62                                                        in [Optional=CallWithDefaultValue] DOMString localName);
63         Element            getElementById(in [Optional=CallWithDefaultValue] DOMString elementId);
64
65         // DOM Level 3 Core
66
67         readonly attribute [ConvertNullStringTo=Null] DOMString inputEncoding;
68
69         readonly attribute [ConvertNullStringTo=Null] DOMString xmlEncoding;
70                  attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString xmlVersion
71                     setter raises (DOMException);
72                  attribute boolean xmlStandalone
73                     setter raises (DOMException);
74
75         Node               adoptNode(in [Optional=CallWithDefaultValue] Node source)
76             raises (DOMException);
77
78                  attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString documentURI;
79
80         // DOM Level 2 Events (DocumentEvents interface)
81
82         Event              createEvent(in [Optional=CallWithDefaultValue] DOMString eventType)
83             raises(DOMException);
84
85         // DOM Level 2 Tranversal and Range (DocumentRange interface)
86
87         Range              createRange();
88
89         // DOM Level 2 Tranversal and Range (DocumentTraversal interface)
90
91         [OldStyleObjC] NodeIterator createNodeIterator(in [Optional=CallWithDefaultValue] Node root,
92                                                        in [Optional=CallWithDefaultValue] unsigned long whatToShow,
93                                                        in [Optional=CallWithDefaultValue] NodeFilter filter,
94                                                        in [Optional=CallWithDefaultValue] boolean expandEntityReferences)
95             raises(DOMException);
96         [OldStyleObjC] TreeWalker createTreeWalker(in [Optional=CallWithDefaultValue] Node root,
97                                                    in [Optional=CallWithDefaultValue] unsigned long whatToShow,
98                                                    in [Optional=CallWithDefaultValue] NodeFilter filter,
99                                                    in [Optional=CallWithDefaultValue] boolean expandEntityReferences)
100             raises(DOMException);
101
102         // DOM Level 2 Abstract Views (DocumentView interface)
103
104         readonly attribute DOMWindow defaultView;
105
106         // DOM Level 2 Style (DocumentStyle interface)
107
108         readonly attribute StyleSheetList styleSheets;
109
110         // DOM Level 2 Style (DocumentCSS interface)
111
112         [OldStyleObjC] CSSStyleDeclaration getOverrideStyle(in [Optional=CallWithDefaultValue] Element element,
113                                                             in [Optional=CallWithDefaultValue] DOMString pseudoElement);
114 #if defined(ENABLE_XPATH) && ENABLE_XPATH
115         // DOM Level 3 XPath (XPathEvaluator interface)
116         [OldStyleObjC] XPathExpression createExpression(in [Optional=CallWithDefaultValue] DOMString expression,
117                                                         in [Optional=CallWithDefaultValue] XPathNSResolver resolver)
118             raises(DOMException);
119         XPathNSResolver    createNSResolver(in Node nodeResolver);
120         [OldStyleObjC, V8Custom] XPathResult evaluate(in [Optional=CallWithDefaultValue] DOMString expression,
121                                                       in [Optional=CallWithDefaultValue] Node contextNode,
122                                                       in [Optional=CallWithDefaultValue] XPathNSResolver resolver,
123                                                       in [Optional=CallWithDefaultValue] unsigned short type,
124                                                       in [Optional=CallWithDefaultValue] XPathResult inResult)
125             raises(DOMException);
126 #endif // ENABLE_XPATH
127
128         // Common extensions
129
130         boolean            execCommand(in [Optional=CallWithDefaultValue] DOMString command,
131                                        in [Optional=CallWithDefaultValue] boolean userInterface,
132                                        in [ConvertUndefinedOrNullToNullString,Optional=CallWithDefaultValue] DOMString value);
133
134 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
135         // FIXME: remove the these two versions once [Optional] is implemented for Objective-C.
136         boolean            execCommand(in DOMString command,
137                                        in boolean userInterface);
138         boolean            execCommand(in DOMString command);
139 #endif
140
141         boolean            queryCommandEnabled(in [Optional=CallWithDefaultValue] DOMString command);
142         boolean            queryCommandIndeterm(in [Optional=CallWithDefaultValue] DOMString command);
143         boolean            queryCommandState(in [Optional=CallWithDefaultValue] DOMString command);
144         boolean            queryCommandSupported(in [Optional=CallWithDefaultValue] DOMString command);
145         [ConvertNullStringTo=False] DOMString queryCommandValue(in [Optional=CallWithDefaultValue] DOMString command);
146
147         // Moved down from HTMLDocument
148
149                  attribute [ConvertNullToNullString] DOMString title;
150         readonly attribute DOMString referrer;
151 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
152                  attribute [ConvertNullToNullString] DOMString domain
153                      setter raises (DOMException);
154 #else
155         readonly attribute DOMString domain;
156 #endif
157         readonly attribute DOMString URL;
158
159                  attribute [ConvertNullToNullString] DOMString cookie
160                      setter raises (DOMException),
161                      getter raises (DOMException);
162
163         // FIXME: the DOM spec does NOT have this attribute
164         // raising an exception.
165                  attribute HTMLElement body
166                      setter raises (DOMException);
167
168         readonly attribute HTMLHeadElement head;
169         readonly attribute HTMLCollection images;
170         readonly attribute HTMLCollection applets;
171         readonly attribute HTMLCollection links;
172         readonly attribute HTMLCollection forms;
173         readonly attribute HTMLCollection anchors;
174         readonly attribute DOMString lastModified;
175
176         NodeList getElementsByName(in [Optional=CallWithDefaultValue] DOMString elementName);
177
178 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
179                  attribute [Custom] Location location;
180 #endif
181
182         // IE extensions
183
184                  attribute [ConvertNullStringTo=Undefined, ConvertNullToNullString] DOMString charset;
185         readonly attribute [ConvertNullStringTo=Undefined] DOMString defaultCharset;
186         readonly attribute [ConvertNullStringTo=Undefined] DOMString readyState;
187
188         Element            elementFromPoint(in [Optional=CallWithDefaultValue] long x, 
189                                             in [Optional=CallWithDefaultValue] long y);
190         Range              caretRangeFromPoint(in [Optional=CallWithDefaultValue] long x, 
191                                                in [Optional=CallWithDefaultValue] long y);
192
193         // Mozilla extensions
194 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
195         DOMSelection       getSelection();
196 #endif
197         readonly attribute [ConvertNullStringTo=Null] DOMString characterSet;
198
199         // WebKit extensions
200
201         readonly attribute [ConvertNullStringTo=Null] DOMString preferredStylesheetSet;
202                  attribute [ConvertNullStringTo=Null, ConvertNullToNullString] DOMString selectedStylesheetSet;
203
204 #if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT
205         CSSStyleDeclaration createCSSStyleDeclaration();
206 #endif
207
208 #if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C
209         // DOM Level 2 Style Interface
210         [OldStyleObjC, UsesView] CSSStyleDeclaration getComputedStyle(in Element element,
211                                                                       in DOMString pseudoElement);
212
213         // WebKit extension
214         // FIXME: remove the first version once [Optional] is implemented for Objective-C.
215         [UsesView] CSSRuleList getMatchedCSSRules(in Element element,
216                                                   in DOMString pseudoElement);
217         [UsesView] CSSRuleList getMatchedCSSRules(in Element element,
218                                                   in DOMString pseudoElement,
219                                                   in [Optional] boolean authorOnly);
220                                                   
221 #endif
222
223 #if !defined(LANGUAGE_CPP) || !LANGUAGE_CPP
224 #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C
225         [V8Custom] DOMObject getCSSCanvasContext(in DOMString contextId, in DOMString name, in long width, in long height);
226 #endif
227 #endif
228
229         // HTML 5
230         NodeList getElementsByClassName(in [Optional=CallWithDefaultValue] DOMString tagname);
231
232         readonly attribute DOMString compatMode;
233
234         // NodeSelector - Selector API
235         Element querySelector(in DOMString selectors)
236             raises(DOMException);
237         NodeList querySelectorAll(in DOMString selectors)
238             raises(DOMException);
239
240 #if defined(ENABLE_FULLSCREEN_API) && ENABLE_FULLSCREEN_API
241         readonly attribute [EnabledAtRuntime] boolean webkitIsFullScreen;
242         readonly attribute [EnabledAtRuntime] boolean webkitFullScreenKeyboardInputAllowed;
243         readonly attribute [EnabledAtRuntime] Element webkitCurrentFullScreenElement;
244         [EnabledAtRuntime] void webkitCancelFullScreen();
245 #endif
246
247 #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C
248         // Event handler DOM attributes
249         attribute [DontEnum] EventListener onabort;
250         attribute [DontEnum] EventListener onblur;
251         attribute [DontEnum] EventListener onchange;
252         attribute [DontEnum] EventListener onclick;
253         attribute [DontEnum] EventListener oncontextmenu;
254         attribute [DontEnum] EventListener ondblclick;
255         attribute [DontEnum] EventListener ondrag;
256         attribute [DontEnum] EventListener ondragend;
257         attribute [DontEnum] EventListener ondragenter;
258         attribute [DontEnum] EventListener ondragleave;
259         attribute [DontEnum] EventListener ondragover;
260         attribute [DontEnum] EventListener ondragstart;
261         attribute [DontEnum] EventListener ondrop;
262         attribute [DontEnum] EventListener onerror;
263         attribute [DontEnum] EventListener onfocus;
264         attribute [DontEnum] EventListener oninput;
265         attribute [DontEnum] EventListener oninvalid;
266         attribute [DontEnum] EventListener onkeydown;
267         attribute [DontEnum] EventListener onkeypress;
268         attribute [DontEnum] EventListener onkeyup;
269         attribute [DontEnum] EventListener onload;
270         attribute [DontEnum] EventListener onmousedown;
271         attribute [DontEnum] EventListener onmousemove;
272         attribute [DontEnum] EventListener onmouseout;
273         attribute [DontEnum] EventListener onmouseover;
274         attribute [DontEnum] EventListener onmouseup;
275         attribute [DontEnum] EventListener onmousewheel;
276         attribute [DontEnum] EventListener onreadystatechange;
277         attribute [DontEnum] EventListener onscroll;
278         attribute [DontEnum] EventListener onselect;
279         attribute [DontEnum] EventListener onsubmit;
280
281         // attribute [DontEnum] EventListener oncanplay;
282         // attribute [DontEnum] EventListener oncanplaythrough;
283         // attribute [DontEnum] EventListener ondurationchange;
284         // attribute [DontEnum] EventListener onemptied;
285         // attribute [DontEnum] EventListener onended;
286         // attribute [DontEnum] EventListener onloadeddata;
287         // attribute [DontEnum] EventListener onloadedmetadata;
288         // attribute [DontEnum] EventListener onloadstart;
289         // attribute [DontEnum] EventListener onpause;
290         // attribute [DontEnum] EventListener onplay;
291         // attribute [DontEnum] EventListener onplaying;
292         // attribute [DontEnum] EventListener onprogress;
293         // attribute [DontEnum] EventListener onratechange;
294         // attribute [DontEnum] EventListener onseeked;
295         // attribute [DontEnum] EventListener onseeking;
296         // attribute [DontEnum] EventListener onshow;
297         // attribute [DontEnum] EventListener onstalled;
298         // attribute [DontEnum] EventListener onsuspend;
299         // attribute [DontEnum] EventListener ontimeupdate;
300         // attribute [DontEnum] EventListener onvolumechange;
301         // attribute [DontEnum] EventListener onwaiting;
302
303         // WebKit extensions
304         attribute [DontEnum] EventListener onbeforecut;
305         attribute [DontEnum] EventListener oncut;
306         attribute [DontEnum] EventListener onbeforecopy;
307         attribute [DontEnum] EventListener oncopy;
308         attribute [DontEnum] EventListener onbeforepaste;
309         attribute [DontEnum] EventListener onpaste;
310         attribute [DontEnum] EventListener onreset;
311         attribute [DontEnum] EventListener onsearch;
312         attribute [DontEnum] EventListener onselectstart;
313         attribute [DontEnum] EventListener onselectionchange;
314         attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchstart;
315         attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchmove;
316         attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchend;
317         attribute [DontEnum,Conditional=TOUCH_EVENTS,EnabledAtRuntime] EventListener ontouchcancel;
318         attribute [DontEnum, Conditional=FULLSCREEN_API] EventListener onwebkitfullscreenchange;
319 #endif
320
321 #if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
322         [ReturnsNew, EnabledAtRuntime] Touch createTouch(in [Optional=CallWithDefaultValue] DOMWindow window,
323                                                          in [Optional=CallWithDefaultValue] EventTarget target,
324                                                          in [Optional=CallWithDefaultValue] long identifier,
325                                                          in [Optional=CallWithDefaultValue] long pageX,
326                                                          in [Optional=CallWithDefaultValue] long pageY,
327                                                          in [Optional=CallWithDefaultValue] long screenX,
328                                                          in [Optional=CallWithDefaultValue] long screenY,
329                                                          in [Optional=CallWithDefaultValue] long webkitRadiusX,
330                                                          in [Optional=CallWithDefaultValue] long webkitRadiusY,
331                                                          in [Optional=CallWithDefaultValue] float webkitRotationAngle,
332                                                          in [Optional=CallWithDefaultValue] float webkitForce)
333             raises (DOMException);
334         [ReturnsNew, EnabledAtRuntime, Custom] TouchList createTouchList()
335             raises (DOMException);
336 #endif
337
338 #if defined(LANGUAGE_CPP) && LANGUAGE_CPP
339         // Extra WebCore methods exposed to allow compile-time casting in C++
340         boolean isHTMLDocument();
341 #endif
342
343         // Page visibility API.
344         readonly attribute [Conditional=PAGE_VISIBILITY_API] DOMString webkitVisibilityState;
345         readonly attribute [Conditional=PAGE_VISIBILITY_API] boolean webkitHidden;
346
347     };
348
349 }