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