1 /* 2 * Copyright (C) 2006, 2007 Apple Inc. All rights reserved. 3 * Copyright (C) 2006, 2007 Samuel Weinig <sam (at) 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 CustomMarkFunction, 27 InlineGetOwnPropertySlot 28 ] Document : Node { 29 30 // DOM Level 1 Core 31 readonly attribute DocumentType doctype; 32 readonly attribute [V8Custom] 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_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C 223 [V8Custom] DOMObject getCSSCanvasContext(in DOMString contextId, in DOMString name, in long width, in long height); 224 #endif 225 226 // HTML 5 227 NodeList getElementsByClassName(in DOMString tagname); 228 229 // NodeSelector - Selector API 230 Element querySelector(in DOMString selectors) 231 raises(DOMException); 232 NodeList querySelectorAll(in DOMString selectors) 233 raises(DOMException); 234 235 #if defined(ENABLE_WML) && ENABLE_WML 236 // Only used from within WML layout tests, WML doesn't have JS support at all. 237 [DontEnum] void resetWMLPageState(); 238 [DontEnum] void initializeWMLPageState(); 239 #endif 240 241 #if !defined(LANGUAGE_OBJECTIVE_C) || !LANGUAGE_OBJECTIVE_C 242 // Event handler DOM attributes 243 attribute [DontEnum] EventListener onabort; 244 attribute [DontEnum] EventListener onblur; 245 attribute [DontEnum] EventListener onchange; 246 attribute [DontEnum] EventListener onclick; 247 attribute [DontEnum] EventListener oncontextmenu; 248 attribute [DontEnum] EventListener ondblclick; 249 attribute [DontEnum] EventListener ondrag; 250 attribute [DontEnum] EventListener ondragend; 251 attribute [DontEnum] EventListener ondragenter; 252 attribute [DontEnum] EventListener ondragleave; 253 attribute [DontEnum] EventListener ondragover; 254 attribute [DontEnum] EventListener ondragstart; 255 attribute [DontEnum] EventListener ondrop; 256 attribute [DontEnum] EventListener onerror; 257 attribute [DontEnum] EventListener onfocus; 258 attribute [DontEnum] EventListener oninput; 259 attribute [DontEnum] EventListener oninvalid; 260 attribute [DontEnum] EventListener onkeydown; 261 attribute [DontEnum] EventListener onkeypress; 262 attribute [DontEnum] EventListener onkeyup; 263 attribute [DontEnum] EventListener onload; 264 attribute [DontEnum] EventListener onmousedown; 265 attribute [DontEnum] EventListener onmousemove; 266 attribute [DontEnum] EventListener onmouseout; 267 attribute [DontEnum] EventListener onmouseover; 268 attribute [DontEnum] EventListener onmouseup; 269 attribute [DontEnum] EventListener onmousewheel; 270 attribute [DontEnum] EventListener onscroll; 271 attribute [DontEnum] EventListener onselect; 272 attribute [DontEnum] EventListener onsubmit; 273 274 // attribute [DontEnum] EventListener oncanplay; 275 // attribute [DontEnum] EventListener oncanplaythrough; 276 // attribute [DontEnum] EventListener ondurationchange; 277 // attribute [DontEnum] EventListener onemptied; 278 // attribute [DontEnum] EventListener onended; 279 // attribute [DontEnum] EventListener onformchange; 280 // attribute [DontEnum] EventListener onforminput; 281 // attribute [DontEnum] EventListener onloadeddata; 282 // attribute [DontEnum] EventListener onloadedmetadata; 283 // attribute [DontEnum] EventListener onloadstart; 284 // attribute [DontEnum] EventListener onpause; 285 // attribute [DontEnum] EventListener onplay; 286 // attribute [DontEnum] EventListener onplaying; 287 // attribute [DontEnum] EventListener onprogress; 288 // attribute [DontEnum] EventListener onratechange; 289 // attribute [DontEnum] EventListener onreadystatechange; 290 // attribute [DontEnum] EventListener onseeked; 291 // attribute [DontEnum] EventListener onseeking; 292 // attribute [DontEnum] EventListener onshow; 293 // attribute [DontEnum] EventListener onstalled; 294 // attribute [DontEnum] EventListener onsuspend; 295 // attribute [DontEnum] EventListener ontimeupdate; 296 // attribute [DontEnum] EventListener onvolumechange; 297 // attribute [DontEnum] EventListener onwaiting; 298 299 // WebKit extensions 300 attribute [DontEnum] EventListener onbeforecut; 301 attribute [DontEnum] EventListener oncut; 302 attribute [DontEnum] EventListener onbeforecopy; 303 attribute [DontEnum] EventListener oncopy; 304 attribute [DontEnum] EventListener onbeforepaste; 305 attribute [DontEnum] EventListener onpaste; 306 attribute [DontEnum] EventListener onreset; 307 attribute [DontEnum] EventListener onsearch; 308 attribute [DontEnum] EventListener onselectstart; 309 #if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS 310 attribute [DontEnum] EventListener ontouchstart; 311 attribute [DontEnum] EventListener ontouchmove; 312 attribute [DontEnum] EventListener ontouchend; 313 attribute [DontEnum] EventListener ontouchcancel; 314 #endif 315 #endif 316 }; 317 318 } 319