a25113068f65b05760b2ca57bd00b1abe3600520
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / 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 callback CustomElementConstructor = Element ();
22
23 typedef (CanvasRenderingContext2D or WebGLRenderingContext) RenderingContext;
24
25 [
26     SpecialWrapFor=(HTMLDocument,XMLDocument)
27 ] interface 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     [CustomElementCallbacks, PerWorldBindings, RaisesException] Element createElement(DOMString tagName);
35     DocumentFragment createDocumentFragment();
36     Text createTextNode(DOMString data);
37     Comment createComment(DOMString data);
38     [RaisesException, MeasureAs=DocumentCreateCDATASection] CDATASection createCDATASection([Default=Undefined] optional DOMString data); // Removed from DOM4.
39     [RaisesException] ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
40     [RaisesException, MeasureAs=DocumentCreateAttribute] Attr createAttribute([Default=Undefined] optional DOMString name); // Removed from DOM4.
41     HTMLCollection getElementsByTagName(DOMString localName);
42
43     // Introduced in DOM Level 2:
44
45     [CustomElementCallbacks, RaisesException, TypeChecking=Interface] Node importNode(Node node, optional boolean deep = false);
46     [CustomElementCallbacks, RaisesException] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName);
47     [RaisesException, DeprecateAs=DocumentCreateAttributeNS] Attr createAttributeNS([Default=Undefined] optional DOMString? namespaceURI,
48                                                                                     [Default=Undefined] optional DOMString? qualifiedName); // Removed from DOM4.
49     HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString localName);
50     [PerWorldBindings] Element getElementById(DOMString elementId);
51
52     // DOM Level 3 Core
53
54     [MeasureAs=DocumentInputEncoding] readonly attribute DOMString? inputEncoding; // Removed from DOM4.
55
56     [MeasureAs=DocumentXMLEncoding] readonly attribute DOMString? xmlEncoding; // Removed from DOM4.
57     [RaisesException=Setter, MeasureAs=DocumentXMLVersion] attribute DOMString? xmlVersion; // Removed from DOM4.
58     [RaisesException=Setter, MeasureAs=DocumentXMLStandalone] attribute boolean xmlStandalone; // Removed from DOM4.
59
60     [RaisesException, CustomElementCallbacks, TypeChecking=Interface] Node adoptNode(Node node);
61
62     [ImplementedAs=url] readonly attribute DOMString? documentURI;
63
64     // DOM Level 2 Events (DocumentEvents interface)
65
66     [RaisesException] Event createEvent(DOMString eventType);
67
68     // DOM Level 2 Traversal and Range (DocumentRange interface)
69
70     Range createRange();
71
72     // DOM Level 2 Traversal and Range (DocumentTraversal interface)
73
74     [RaisesException, TypeChecking=Interface] NodeIterator createNodeIterator(Node root,
75                                                                               optional unsigned long whatToShow = 0xFFFFFFFF,
76                                                                               optional NodeFilter? filter = null);
77     [RaisesException, TypeChecking=Interface] TreeWalker createTreeWalker(Node root,
78                                                                           optional unsigned long whatToShow = 0xFFFFFFFF,
79                                                                           optional NodeFilter? filter = null);
80
81     // DOM Level 2 Abstract Views (DocumentView interface)
82
83     [ImplementedAs=domWindow] readonly attribute Window defaultView;
84
85     // DOM Level 2 Style (DocumentStyle interface)
86
87     readonly attribute StyleSheetList styleSheets;
88
89     // DOM Level 2 Style (DocumentCSS interface)
90
91     CSSStyleDeclaration getOverrideStyle([Default=Undefined] optional Element element,
92                                          [Default=Undefined] optional DOMString pseudoElement);
93
94     // DOM 4
95     readonly attribute DOMString contentType;
96
97     // Common extensions
98     [CustomElementCallbacks]
99     boolean            execCommand([Default=Undefined] optional DOMString command,
100                                    [Default=Undefined] optional boolean userInterface,
101                                    [TreatUndefinedAs=NullString, Default=Undefined] optional DOMString? value);
102
103     boolean            queryCommandEnabled([Default=Undefined] optional DOMString command);
104     boolean            queryCommandIndeterm([Default=Undefined] optional DOMString command);
105     boolean            queryCommandState([Default=Undefined] optional DOMString command);
106     boolean            queryCommandSupported([Default=Undefined] optional DOMString command);
107     DOMString          queryCommandValue([Default=Undefined] optional DOMString command);
108
109     // Moved down from HTMLDocument
110              [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString dir;
111              [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString designMode;
112              [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString title;
113     readonly attribute DOMString referrer;
114              [TreatNullAs=NullString, RaisesException=Setter] attribute DOMString domain;
115     readonly attribute DOMString URL;
116
117              [TreatNullAs=NullString, RaisesException] attribute DOMString cookie;
118
119     [RaisesException=Setter, CustomElementCallbacks, PerWorldBindings, TypeChecking=Interface] attribute HTMLElement? body;
120
121     readonly attribute HTMLHeadElement head;
122     readonly attribute HTMLCollection images;
123     readonly attribute HTMLCollection applets;
124     readonly attribute HTMLCollection embeds;
125     [ImplementedAs=embeds] readonly attribute HTMLCollection plugins;
126     readonly attribute HTMLCollection links;
127     readonly attribute HTMLCollection forms;
128     readonly attribute HTMLCollection scripts;
129     readonly attribute HTMLCollection anchors;
130     readonly attribute DOMString lastModified;
131
132     [PerWorldBindings] NodeList getElementsByName([Default=Undefined] optional DOMString elementName);
133
134     [PutForwards=href] readonly attribute Location location;
135
136     // IE extensions
137     [MeasureAs=DocumentCharset, TreatReturnedNullStringAs=Undefined, TreatNullAs=NullString] attribute DOMString charset;
138     [MeasureAs=DocumentDefaultCharset, TreatReturnedNullStringAs=Undefined] readonly attribute DOMString defaultCharset;
139     [TreatReturnedNullStringAs=Undefined] readonly attribute DOMString readyState;
140
141     Element            elementFromPoint([Default=Undefined] optional long x,
142                                         [Default=Undefined] optional long y);
143     [MeasureAs=DocumentCaretRangeFromPoint]
144     Range              caretRangeFromPoint([Default=Undefined] optional long x,
145                                            [Default=Undefined] optional long y);
146
147     // Mozilla extensions
148     Selection          getSelection();
149     readonly attribute DOMString? characterSet;
150
151     // WebKit extensions
152
153     readonly attribute DOMString? preferredStylesheetSet;
154              attribute DOMString? selectedStylesheetSet;
155
156     [MeasureAs=DocumentGetCSSCanvasContext] RenderingContext getCSSCanvasContext(DOMString contextId, DOMString name, long width, long height);
157
158     // HTML 5
159     HTMLCollection getElementsByClassName(DOMString classNames);
160     readonly attribute Element activeElement;
161     boolean hasFocus();
162
163     readonly attribute DOMString compatMode;
164
165     [MeasureAs=DocumentExitPointerLock] void exitPointerLock();
166     [MeasureAs=DocumentPointerLockElement] readonly attribute Element pointerLockElement;
167
168     // Event handler attributes
169     attribute EventHandler onbeforecopy;
170     attribute EventHandler onbeforecut;
171     attribute EventHandler onbeforepaste;
172     attribute EventHandler oncopy;
173     attribute EventHandler oncut;
174     attribute EventHandler onpaste;
175     attribute EventHandler onpointerlockchange;
176     attribute EventHandler onpointerlockerror;
177     attribute EventHandler onreadystatechange;
178     attribute EventHandler onsearch;
179     [RuntimeEnabled=ExperimentalContentSecurityPolicyFeatures] attribute EventHandler onsecuritypolicyviolation;
180     attribute EventHandler onselectionchange;
181     attribute EventHandler onselectstart;
182     [RuntimeEnabled=Touch] attribute EventHandler ontouchcancel;
183     [RuntimeEnabled=Touch] attribute EventHandler ontouchend;
184     [RuntimeEnabled=Touch] attribute EventHandler ontouchmove;
185     [RuntimeEnabled=Touch] attribute EventHandler ontouchstart;
186     attribute EventHandler onwheel;
187
188     [RuntimeEnabled=Touch] Touch createTouch([Default=Undefined] optional Window window,
189                                              [Default=Undefined] optional EventTarget target,
190                                              [Default=Undefined] optional long identifier,
191                                              [Default=Undefined] optional double pageX,
192                                              [Default=Undefined] optional double pageY,
193                                              [Default=Undefined] optional double screenX,
194                                              [Default=Undefined] optional double screenY,
195                                              [Default=Undefined] optional double webkitRadiusX,
196                                              [Default=Undefined] optional double webkitRadiusY,
197                                              [Default=Undefined] optional float webkitRotationAngle,
198                                              [Default=Undefined] optional float webkitForce);
199     [RuntimeEnabled=Touch] TouchList createTouchList(Touch... touches);
200
201     [CallWith=ScriptState, CustomElementCallbacks, RaisesException, MeasureAs=DocumentRegisterElement] CustomElementConstructor registerElement(DOMString name, optional Dictionary options);
202     [CustomElementCallbacks, PerWorldBindings, RaisesException] Element createElement(DOMString localName, DOMString? typeExtension);
203     [CustomElementCallbacks, RaisesException] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName, DOMString? typeExtension);
204
205     // Page visibility API.
206     readonly attribute DOMString visibilityState;
207     readonly attribute boolean hidden;
208
209     // Deprecated prefixed page visibility API.
210     // TODO(davidben): This is a property so attaching a deprecation warning results in false positives when outputting
211     // document in the console. It's possible http://crbug.com/43394 will resolve this.
212     [MeasureAs=PrefixedPageVisibility, ImplementedAs=visibilityState] readonly attribute DOMString webkitVisibilityState;
213     [MeasureAs=PrefixedPageVisibility, ImplementedAs=hidden] readonly attribute boolean webkitHidden;
214
215     readonly attribute HTMLScriptElement currentScript;
216 };
217
218 Document implements GlobalEventHandlers;
219 Document implements ParentNode;