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