Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: Source/core/dom/Document.idl

Issue 961693004: Rearrange the Document interfaces to match the many specs (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/dom/XMLDocument.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org> 3 * Copyright (C) 2006, 2007 Samuel Weinig <sam@webkit.org>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 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 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, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 */ 19 */
20 20
21 callback CustomElementConstructor = Element (); 21 callback CustomElementConstructor = Element ();
22 22
23 typedef (CanvasRenderingContext2D or WebGLRenderingContext) RenderingContext; 23 typedef (CanvasRenderingContext2D or WebGLRenderingContext) RenderingContext;
24 24
25 // http://www.w3.org/TR/page-visibility/#VisibilityState 25 // http://www.w3.org/TR/page-visibility/#VisibilityState
26 enum VisibilityState { "hidden", "visible", "prerender", "unloaded" }; 26 enum VisibilityState { "hidden", "visible", "prerender", "unloaded" };
27 27
28 // https://dom.spec.whatwg.org/#interface-document
29
28 [ 30 [
29 TypeChecking=Unrestricted, 31 TypeChecking=Unrestricted,
30 ] interface Document : Node { 32 ] interface Document : Node {
33 readonly attribute DOMImplementation implementation;
34 readonly attribute DOMString URL;
35 [ImplementedAs=url] readonly attribute DOMString? documentURI;
36 readonly attribute DOMString origin;
37 readonly attribute DOMString compatMode;
38 readonly attribute DOMString? characterSet;
39 [MeasureAs=DocumentInputEncoding, ImplementedAs=characterSet] readonly attri bute DOMString? inputEncoding;
40 readonly attribute DOMString contentType;
31 41
32 // DOM Level 1 Core
33 readonly attribute DocumentType doctype; 42 readonly attribute DocumentType doctype;
34 readonly attribute DOMImplementation implementation;
35 readonly attribute Element documentElement; 43 readonly attribute Element documentElement;
44 HTMLCollection getElementsByTagName(DOMString localName);
45 HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString loc alName);
46 HTMLCollection getElementsByClassName(DOMString classNames);
36 47
37 [CustomElementCallbacks, PerWorldBindings, RaisesException] Element createEl ement(DOMString tagName); 48 [CustomElementCallbacks, PerWorldBindings, RaisesException] Element createEl ement(DOMString tagName);
49 [CustomElementCallbacks, RaisesException] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName);
38 DocumentFragment createDocumentFragment(); 50 DocumentFragment createDocumentFragment();
39 Text createTextNode(DOMString data); 51 Text createTextNode(DOMString data);
40 Comment createComment(DOMString data); 52 Comment createComment(DOMString data);
41 [RaisesException, MeasureAs=DocumentCreateCDATASection] CDATASection createC DATASection(DOMString data); // Removed from DOM4.
42 [RaisesException] ProcessingInstruction createProcessingInstruction(DOMStrin g target, DOMString data); 53 [RaisesException] ProcessingInstruction createProcessingInstruction(DOMStrin g target, DOMString data);
43 [RaisesException, MeasureAs=DocumentCreateAttribute] Attr createAttribute(DO MString name);
44 HTMLCollection getElementsByTagName(DOMString localName);
45
46 // Introduced in DOM Level 2:
47 54
48 [CustomElementCallbacks, RaisesException, TypeChecking=Interface] Node impor tNode(Node node, optional boolean deep = false); 55 [CustomElementCallbacks, RaisesException, TypeChecking=Interface] Node impor tNode(Node node, optional boolean deep = false);
49 [CustomElementCallbacks, RaisesException] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName);
50 [RaisesException, MeasureAs=DocumentCreateAttributeNS] Attr createAttributeN S(DOMString? namespaceURI, DOMString? qualifiedName);
51 HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString loc alName);
52 [PerWorldBindings] Element getElementById(DOMString elementId);
53
54 // DOM Level 3 Core
55
56 [MeasureAs=DocumentInputEncoding, ImplementedAs=characterSet] readonly attri bute DOMString? inputEncoding;
57
58 [MeasureAs=DocumentXMLEncoding] readonly attribute DOMString? xmlEncoding; / / Removed from DOM4.
59 [RaisesException=Setter, MeasureAs=DocumentXMLVersion] attribute DOMString? xmlVersion; // Removed from DOM4.
60 [RaisesException=Setter, MeasureAs=DocumentXMLStandalone] attribute boolean xmlStandalone; // Removed from DOM4.
61
62 [RaisesException, CustomElementCallbacks, TypeChecking=Interface] Node adopt Node(Node node); 56 [RaisesException, CustomElementCallbacks, TypeChecking=Interface] Node adopt Node(Node node);
63 57
64 [ImplementedAs=url] readonly attribute DOMString? documentURI; 58 [RaisesException, MeasureAs=DocumentCreateAttribute] Attr createAttribute(DO MString name);
65 readonly attribute DOMString origin; 59 [RaisesException, MeasureAs=DocumentCreateAttributeNS] Attr createAttributeN S(DOMString? namespaceURI, DOMString? qualifiedName);
66
67 // DOM Level 2 Events (DocumentEvents interface)
68 60
69 [RaisesException] Event createEvent(DOMString eventType); 61 [RaisesException] Event createEvent(DOMString eventType);
70 62
71 // DOM Level 2 Traversal and Range (DocumentRange interface)
72
73 Range createRange(); 63 Range createRange();
74 64
75 // DOM Level 2 Traversal and Range (DocumentTraversal interface) 65 // NodeFilter.SHOW_ALL = 0xFFFFFFFF
76
77 [RaisesException, TypeChecking=Interface] NodeIterator createNodeIterator(No de root, 66 [RaisesException, TypeChecking=Interface] NodeIterator createNodeIterator(No de root,
78 op tional unsigned long whatToShow = 0xFFFFFFFF, 67 op tional unsigned long whatToShow = 0xFFFFFFFF,
79 op tional NodeFilter? filter = null); 68 op tional NodeFilter? filter = null);
80 [RaisesException, TypeChecking=Interface] TreeWalker createTreeWalker(Node r oot, 69 [RaisesException, TypeChecking=Interface] TreeWalker createTreeWalker(Node r oot,
81 option al unsigned long whatToShow = 0xFFFFFFFF, 70 option al unsigned long whatToShow = 0xFFFFFFFF,
82 option al NodeFilter? filter = null); 71 option al NodeFilter? filter = null);
83 72
84 // DOM Level 2 Abstract Views (DocumentView interface) 73 // FIXME: CDATASection has been removed from the spec. crbug.com/437205
74 [RaisesException, MeasureAs=DocumentCreateCDATASection] CDATASection createC DATASection(DOMString data); // Removed from DOM4.
85 75
76 // FIXME: xmlEncoding/xmlVersion/xmlStandalone have been removed from the sp ec.
77 [MeasureAs=DocumentXMLEncoding] readonly attribute DOMString? xmlEncoding; / / Removed from DOM4.
78 [RaisesException=Setter, MeasureAs=DocumentXMLVersion] attribute DOMString? xmlVersion; // Removed from DOM4.
79 [RaisesException=Setter, MeasureAs=DocumentXMLStandalone] attribute boolean xmlStandalone; // Removed from DOM4.
80
81 // https://dom.spec.whatwg.org/#interface-nonelementparentnode
82
83 [PerWorldBindings] Element getElementById(DOMString elementId);
84
85 // https://html.spec.whatwg.org/#the-document-object
86
87 // resource metadata management
88 [PutForwards=href, Unforgeable] readonly attribute Location location;
89 [TreatNullAs=NullString, RaisesException=Setter] attribute DOMStrin g domain;
90 readonly attribute DOMString referrer;
91 [TreatNullAs=NullString, RaisesException] attribute DOMString cooki e;
92 readonly attribute DOMString lastModified;
93 [TreatReturnedNullStringAs=Undefined] readonly attribute DOMString readyStat e;
94
95 // DOM tree accessors
96 [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMStrin g title;
97 [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMStrin g dir;
98 [RaisesException=Setter, CustomElementCallbacks, PerWorldBindings, TypeCheck ing=Interface, ExposeJSAccessors] attribute HTMLElement? body;
99 readonly attribute HTMLHeadElement head;
100 readonly attribute HTMLCollection images;
101 readonly attribute HTMLCollection embeds;
102 [ImplementedAs=embeds] readonly attribute HTMLCollection plugins;
103 readonly attribute HTMLCollection links;
104 readonly attribute HTMLCollection forms;
105 readonly attribute HTMLCollection scripts;
106 [PerWorldBindings] NodeList getElementsByName(DOMString elementName);
107 readonly attribute HTMLScriptElement currentScript;
108
109 // user interaction
86 [ImplementedAs=domWindow] readonly attribute Window defaultView; 110 [ImplementedAs=domWindow] readonly attribute Window defaultView;
87 111 readonly attribute Element activeElement;
88 // DOM Level 2 Style (DocumentStyle interface) 112 boolean hasFocus();
89 113 [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMStrin g designMode;
90 readonly attribute StyleSheetList styleSheets;
91
92 // DOM Level 2 Style (DocumentCSS interface)
93
94 [MeasureAs=DocumentGetOverrideStyle] CSSStyleDeclaration getOverrideStyle();
95
96 // DOM 4
97 readonly attribute DOMString contentType;
98
99 // Common extensions
100 [CustomElementCallbacks] 114 [CustomElementCallbacks]
101 boolean execCommand(DOMString command, optional boolean showUI = false, opti onal DOMString value = ""); 115 boolean execCommand(DOMString command, optional boolean showUI = false, opti onal DOMString value = "");
102 boolean queryCommandEnabled(DOMString command); 116 boolean queryCommandEnabled(DOMString command);
103 boolean queryCommandIndeterm(DOMString command); 117 boolean queryCommandIndeterm(DOMString command);
104 boolean queryCommandState(DOMString command); 118 boolean queryCommandState(DOMString command);
105 boolean queryCommandSupported(DOMString command); 119 boolean queryCommandSupported(DOMString command);
106 DOMString queryCommandValue(DOMString command); 120 DOMString queryCommandValue(DOMString command);
107 121
108 // Moved down from HTMLDocument 122 // special event handler IDL attributes that only apply to Document objects
109 [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMStrin g dir; 123 attribute EventHandler onreadystatechange;
110 [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMStrin g designMode;
111 [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMStrin g title;
112 readonly attribute DOMString referrer;
113 [TreatNullAs=NullString, RaisesException=Setter] attribute DOMStrin g domain;
114 readonly attribute DOMString URL;
115 124
116 [TreatNullAs=NullString, RaisesException] attribute DOMString cooki e; 125 // https://html.spec.whatwg.org/#Document-partial
117 126
118 [RaisesException=Setter, CustomElementCallbacks, PerWorldBindings, TypeCheck ing=Interface, ExposeJSAccessors] attribute HTMLElement? body; 127 readonly attribute HTMLCollection anchors;
128 readonly attribute HTMLCollection applets;
119 129
120 readonly attribute HTMLHeadElement head; 130 // http://dev.w3.org/csswg/cssom/#extensions-to-the-document-interface
121 readonly attribute HTMLCollection images; 131 readonly attribute StyleSheetList styleSheets;
122 readonly attribute HTMLCollection applets; 132 attribute DOMString? selectedStylesheetSet;
123 readonly attribute HTMLCollection embeds; 133 readonly attribute DOMString? preferredStylesheetSet;
124 [ImplementedAs=embeds] readonly attribute HTMLCollection plugins;
125 readonly attribute HTMLCollection links;
126 readonly attribute HTMLCollection forms;
127 readonly attribute HTMLCollection scripts;
128 readonly attribute HTMLCollection anchors;
129 readonly attribute DOMString lastModified;
130 134
131 [PerWorldBindings] NodeList getElementsByName(DOMString elementName); 135 // http://dev.w3.org/csswg/cssom-view/#extensions-to-the-document-interface
132
133 [PutForwards=href, Unforgeable] readonly attribute Location location;
134
135 // IE extensions
136 [MeasureAs=DocumentCharset, TreatReturnedNullStringAs=Undefined, TreatNullAs =NullString] attribute DOMString charset;
137 [MeasureAs=DocumentDefaultCharset, TreatReturnedNullStringAs=Undefined] read only attribute DOMString defaultCharset;
138 [TreatReturnedNullStringAs=Undefined] readonly attribute DOMString readyStat e;
139
140 Element elementFromPoint(long x, long y); 136 Element elementFromPoint(long x, long y);
141 Element[] elementsFromPoint(long x, long y); 137 Element[] elementsFromPoint(long x, long y);
142 [MeasureAs=DocumentCaretRangeFromPoint]
143 Range caretRangeFromPoint([Default=Undefined] optional long x,
144 [Default=Undefined] optional long y);
145 138
146 // Mozilla extensions 139 // http://w3c.github.io/selection-api/#extensions-to-document-interface
147 Selection getSelection(); 140 Selection getSelection();
148 readonly attribute DOMString? characterSet;
149 141
150 // WebKit extensions 142 // https://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html#extensions -to-the-document-interface
151
152 readonly attribute DOMString? preferredStylesheetSet;
153 attribute DOMString? selectedStylesheetSet;
154
155 [MeasureAs=DocumentGetCSSCanvasContext] RenderingContext getCSSCanvasContext (DOMString contextId, DOMString name, long width, long height);
156
157 // HTML 5
158 HTMLCollection getElementsByClassName(DOMString classNames);
159 readonly attribute Element activeElement;
160 boolean hasFocus();
161
162 readonly attribute DOMString compatMode;
163
164 [MeasureAs=DocumentExitPointerLock] void exitPointerLock();
165 [MeasureAs=DocumentPointerLockElement] readonly attribute Element pointerLoc kElement;
166
167 // Event handler attributes
168 attribute EventHandler onbeforecopy;
169 attribute EventHandler onbeforecut;
170 attribute EventHandler onbeforepaste;
171 attribute EventHandler oncopy;
172 attribute EventHandler oncut;
173 attribute EventHandler onpaste;
174 attribute EventHandler onpointerlockchange; 143 attribute EventHandler onpointerlockchange;
175 attribute EventHandler onpointerlockerror; 144 attribute EventHandler onpointerlockerror;
176 attribute EventHandler onreadystatechange; 145 [MeasureAs=DocumentPointerLockElement] readonly attribute Element pointerLoc kElement;
177 attribute EventHandler onsearch; 146 [MeasureAs=DocumentExitPointerLock] void exitPointerLock();
178 [RuntimeEnabled=ExperimentalContentSecurityPolicyFeatures] attribute EventHa ndler onsecuritypolicyviolation;
179 attribute EventHandler onselectionchange;
180 attribute EventHandler onselectstart;
181 [RuntimeEnabled=Touch] attribute EventHandler ontouchcancel;
182 [RuntimeEnabled=Touch] attribute EventHandler ontouchend;
183 [RuntimeEnabled=Touch] attribute EventHandler ontouchmove;
184 [RuntimeEnabled=Touch] attribute EventHandler ontouchstart;
185 attribute EventHandler onwheel;
186 147
148 // http://www.w3.org/TR/touch-events/#extensions-to-the-document-interface
187 [RuntimeEnabled=Touch] Touch createTouch([Default=Undefined] optional Window window, 149 [RuntimeEnabled=Touch] Touch createTouch([Default=Undefined] optional Window window,
188 [Default=Undefined] optional EventT arget target, 150 [Default=Undefined] optional EventT arget target,
189 [Default=Undefined] optional long i dentifier, 151 [Default=Undefined] optional long i dentifier,
190 [Default=Undefined] optional unrest ricted double pageX, 152 [Default=Undefined] optional unrest ricted double pageX,
191 [Default=Undefined] optional unrest ricted double pageY, 153 [Default=Undefined] optional unrest ricted double pageY,
192 [Default=Undefined] optional unrest ricted double screenX, 154 [Default=Undefined] optional unrest ricted double screenX,
193 [Default=Undefined] optional unrest ricted double screenY, 155 [Default=Undefined] optional unrest ricted double screenY,
194 [Default=Undefined] optional unrest ricted double webkitRadiusX, 156 [Default=Undefined] optional unrest ricted double webkitRadiusX,
195 [Default=Undefined] optional unrest ricted double webkitRadiusY, 157 [Default=Undefined] optional unrest ricted double webkitRadiusY,
196 [Default=Undefined] optional unrest ricted float webkitRotationAngle, 158 [Default=Undefined] optional unrest ricted float webkitRotationAngle,
197 [Default=Undefined] optional unrest ricted float webkitForce); 159 [Default=Undefined] optional unrest ricted float webkitForce);
198 [RuntimeEnabled=Touch] TouchList createTouchList(Touch... touches); 160 [RuntimeEnabled=Touch] TouchList createTouchList(Touch... touches);
199 161
162 [RuntimeEnabled=Touch] attribute EventHandler ontouchstart;
163 [RuntimeEnabled=Touch] attribute EventHandler ontouchend;
164 [RuntimeEnabled=Touch] attribute EventHandler ontouchmove;
165 [RuntimeEnabled=Touch] attribute EventHandler ontouchcancel;
166
167 // http://w3c.github.io/webcomponents/spec/custom/#extensions-to-document-in terface-to-register
200 [CallWith=ScriptState, CustomElementCallbacks, RaisesException, MeasureAs=Do cumentRegisterElement] CustomElementConstructor registerElement(DOMString name, optional ElementRegistrationOptions options); 168 [CallWith=ScriptState, CustomElementCallbacks, RaisesException, MeasureAs=Do cumentRegisterElement] CustomElementConstructor registerElement(DOMString name, optional ElementRegistrationOptions options);
169
170 // http://w3c.github.io/webcomponents/spec/custom/#extensions-to-document-in terface-to-instantiate
201 [CustomElementCallbacks, PerWorldBindings, RaisesException] Element createEl ement(DOMString localName, DOMString? typeExtension); 171 [CustomElementCallbacks, PerWorldBindings, RaisesException] Element createEl ement(DOMString localName, DOMString? typeExtension);
202 [CustomElementCallbacks, RaisesException] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName, DOMString? typeExtension); 172 [CustomElementCallbacks, RaisesException] Element createElementNS(DOMString? namespaceURI, DOMString qualifiedName, DOMString? typeExtension);
203 173
204 // Page visibility API. 174 // http://www.w3.org/TR/page-visibility/#sec-document-interface
175 readonly attribute boolean hidden;
205 readonly attribute VisibilityState visibilityState; 176 readonly attribute VisibilityState visibilityState;
206 readonly attribute boolean hidden; 177
178 // Non-standard APIs
179 [MeasureAs=DocumentGetOverrideStyle] CSSStyleDeclaration getOverrideStyle();
180 [MeasureAs=DocumentCharset, TreatReturnedNullStringAs=Undefined, TreatNullAs =NullString] attribute DOMString charset;
181 [MeasureAs=DocumentDefaultCharset, TreatReturnedNullStringAs=Undefined] read only attribute DOMString defaultCharset;
182 [MeasureAs=DocumentCaretRangeFromPoint]
183 Range caretRangeFromPoint([Default=Undefined] optional long x,
184 [Default=Undefined] optional long y);
185 [MeasureAs=DocumentGetCSSCanvasContext] RenderingContext getCSSCanvasContext (DOMString contextId, DOMString name, long width, long height);
207 186
208 // Deprecated prefixed page visibility API. 187 // Deprecated prefixed page visibility API.
209 // TODO(davidben): This is a property so attaching a deprecation warning res ults in false positives when outputting 188 // TODO(davidben): This is a property so attaching a deprecation warning res ults in false positives when outputting
210 // document in the console. It's possible http://crbug.com/43394 will resolv e this. 189 // document in the console. It's possible http://crbug.com/43394 will resolv e this.
211 [MeasureAs=PrefixedPageVisibility, ImplementedAs=visibilityState] readonly a ttribute DOMString webkitVisibilityState; 190 [MeasureAs=PrefixedPageVisibility, ImplementedAs=visibilityState] readonly a ttribute DOMString webkitVisibilityState;
212 [MeasureAs=PrefixedPageVisibility, ImplementedAs=hidden] readonly attribute boolean webkitHidden; 191 [MeasureAs=PrefixedPageVisibility, ImplementedAs=hidden] readonly attribute boolean webkitHidden;
213 192
214 readonly attribute HTMLScriptElement currentScript; 193 // Event handler attributes
194 attribute EventHandler onbeforecopy;
195 attribute EventHandler onbeforecut;
196 attribute EventHandler onbeforepaste;
197 attribute EventHandler oncopy;
198 attribute EventHandler oncut;
199 attribute EventHandler onpaste;
200 attribute EventHandler onsearch;
201 [RuntimeEnabled=ExperimentalContentSecurityPolicyFeatures] attribute EventHa ndler onsecuritypolicyviolation;
202 attribute EventHandler onselectionchange;
203 attribute EventHandler onselectstart;
204 attribute EventHandler onwheel;
215 }; 205 };
216 206
217 Document implements GlobalEventHandlers; 207 Document implements GlobalEventHandlers;
218 Document implements ParentNode; 208 Document implements ParentNode;
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/XMLDocument.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698