| OLD | NEW |
| 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, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 // https://dom.spec.whatwg.org/#interface-document | 29 // https://dom.spec.whatwg.org/#interface-document |
| 30 | 30 |
| 31 // FIXME: Document should have a constructor. crbug.com/238234 | 31 // FIXME: Document should have a constructor. crbug.com/238234 |
| 32 interface Document : Node { | 32 interface Document : Node { |
| 33 [SameObject] readonly attribute DOMImplementation implementation; | 33 [SameObject] readonly attribute DOMImplementation implementation; |
| 34 readonly attribute DOMString URL; | 34 readonly attribute DOMString URL; |
| 35 // FIXME: documentURI should not be nullable. | 35 // FIXME: documentURI should not be nullable. |
| 36 [ImplementedAs=url] readonly attribute DOMString? documentURI; | 36 [ImplementedAs=url] readonly attribute DOMString? documentURI; |
| 37 readonly attribute DOMString origin; | 37 readonly attribute DOMString origin; |
| 38 [RuntimeEnabled=suborigins] readonly attribute DOMString suborigin; |
| 38 readonly attribute DOMString compatMode; | 39 readonly attribute DOMString compatMode; |
| 39 | 40 |
| 40 readonly attribute DOMString characterSet; | 41 readonly attribute DOMString characterSet; |
| 41 [MeasureAs=DocumentInputEncoding, ImplementedAs=characterSet] readonly attri
bute DOMString inputEncoding; // legacy alias of .characterSet | 42 [ImplementedAs=characterSet] readonly attribute DOMString charset; // legacy
alias of .characterSet |
| 43 [ImplementedAs=characterSet] readonly attribute DOMString inputEncoding; //
legacy alias of .characterSet |
| 42 readonly attribute DOMString contentType; | 44 readonly attribute DOMString contentType; |
| 43 | 45 |
| 44 readonly attribute DocumentType? doctype; | 46 readonly attribute DocumentType? doctype; |
| 45 readonly attribute Element? documentElement; | 47 readonly attribute Element? documentElement; |
| 46 HTMLCollection getElementsByTagName(DOMString localName); | 48 HTMLCollection getElementsByTagName(DOMString localName); |
| 47 HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString loc
alName); | 49 HTMLCollection getElementsByTagNameNS(DOMString? namespaceURI, DOMString loc
alName); |
| 48 HTMLCollection getElementsByClassName(DOMString classNames); | 50 HTMLCollection getElementsByClassName(DOMString classNames); |
| 49 | 51 |
| 50 [NewObject, CustomElementCallbacks, PerWorldBindings, RaisesException] Eleme
nt createElement(DOMString localName); | 52 [NewObject, CustomElementCallbacks, PerWorldBindings, RaisesException] Eleme
nt createElement(DOMString localName); |
| 51 [NewObject, CustomElementCallbacks, RaisesException] Element createElementNS
(DOMString? namespaceURI, DOMString qualifiedName); | 53 [NewObject, CustomElementCallbacks, RaisesException] Element createElementNS
(DOMString? namespaceURI, DOMString qualifiedName); |
| 52 [NewObject] DocumentFragment createDocumentFragment(); | 54 [NewObject] DocumentFragment createDocumentFragment(); |
| 53 [NewObject] Text createTextNode(DOMString data); | 55 [NewObject] Text createTextNode(DOMString data); |
| 54 [NewObject] Comment createComment(DOMString data); | 56 [NewObject] Comment createComment(DOMString data); |
| 55 [NewObject, RaisesException] ProcessingInstruction createProcessingInstructi
on(DOMString target, DOMString data); | 57 [NewObject, RaisesException] ProcessingInstruction createProcessingInstructi
on(DOMString target, DOMString data); |
| 56 | 58 |
| 57 [NewObject, CustomElementCallbacks, RaisesException, TypeChecking=Interface]
Node importNode(Node node, optional boolean deep = false); | 59 [NewObject, CustomElementCallbacks, RaisesException] Node importNode(Node no
de, optional boolean deep = false); |
| 58 [RaisesException, CustomElementCallbacks, TypeChecking=Interface] Node adopt
Node(Node node); | 60 [RaisesException, CustomElementCallbacks] Node adoptNode(Node node); |
| 59 | 61 |
| 60 [NewObject, RaisesException, MeasureAs=DocumentCreateAttribute] Attr createA
ttribute(DOMString localName); | 62 [NewObject, RaisesException, MeasureAs=DocumentCreateAttribute] Attr createA
ttribute(DOMString localName); |
| 61 [NewObject, RaisesException, MeasureAs=DocumentCreateAttributeNS] Attr creat
eAttributeNS(DOMString? namespaceURI, DOMString qualifiedName); | 63 [NewObject, RaisesException, MeasureAs=DocumentCreateAttributeNS] Attr creat
eAttributeNS(DOMString? namespaceURI, DOMString qualifiedName); |
| 62 | 64 |
| 63 [NewObject, RaisesException] Event createEvent(DOMString eventType); | 65 [NewObject, RaisesException, CallWith=ExecutionContext] Event createEvent(DO
MString eventType); |
| 64 | 66 |
| 65 [NewObject] Range createRange(); | 67 [NewObject] Range createRange(); |
| 66 | 68 |
| 67 // NodeFilter.SHOW_ALL = 0xFFFFFFFF | 69 // NodeFilter.SHOW_ALL = 0xFFFFFFFF |
| 68 [NewObject, RaisesException, TypeChecking=Interface] NodeIterator createNode
Iterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional Nod
eFilter? filter = null); | 70 [NewObject] NodeIterator createNodeIterator(Node root, optional unsigned lon
g whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null); |
| 69 [NewObject, RaisesException, TypeChecking=Interface] TreeWalker createTreeWa
lker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFil
ter? filter = null); | 71 [NewObject] TreeWalker createTreeWalker(Node root, optional unsigned long wh
atToShow = 0xFFFFFFFF, optional NodeFilter? filter = null); |
| 70 | 72 |
| 71 // FIXME: CDATASection has been removed from the spec. crbug.com/437205 | 73 // FIXME: CDATASection has been removed from the spec. crbug.com/437205 |
| 72 [RaisesException, MeasureAs=DocumentCreateCDATASection] CDATASection createC
DATASection(DOMString data); | 74 [RaisesException, MeasureAs=DocumentCreateCDATASection] CDATASection createC
DATASection(DOMString data); |
| 73 | 75 |
| 74 // FIXME: xmlEncoding/xmlVersion/xmlStandalone have been removed from the sp
ec. | 76 // FIXME: xmlEncoding/xmlVersion/xmlStandalone have been removed from the sp
ec. |
| 75 [MeasureAs=DocumentXMLEncoding] readonly attribute DOMString? xmlEncoding; | 77 [MeasureAs=DocumentXMLEncoding] readonly attribute DOMString? xmlEncoding; |
| 76 [RaisesException=Setter, MeasureAs=DocumentXMLVersion] attribute DOMString?
xmlVersion; | 78 [RaisesException=Setter, MeasureAs=DocumentXMLVersion] attribute DOMString?
xmlVersion; |
| 77 [RaisesException=Setter, MeasureAs=DocumentXMLStandalone] attribute boolean
xmlStandalone; | 79 [RaisesException=Setter, MeasureAs=DocumentXMLStandalone] attribute boolean
xmlStandalone; |
| 78 | 80 |
| 79 // HTML | 81 // HTML |
| 80 // https://html.spec.whatwg.org/#the-document-object | 82 // https://html.spec.whatwg.org/#the-document-object |
| 81 | 83 |
| 82 // resource metadata management | 84 // resource metadata management |
| 85 |
| 86 // Inheritance of [Unforgeable] attributes is not supported. So we have to |
| 87 // define the same unforgeable attributes in derived interfaces as well. |
| 88 // See that HTMLDocument and XMLDocument redefine 'location' attribute. |
| 89 // Keep all the definitions consistent. |
| 90 // TODO(yukishiino): Support inheritance of attributes defined on instance. |
| 83 [PutForwards=href, Unforgeable] readonly attribute Location? location; | 91 [PutForwards=href, Unforgeable] readonly attribute Location? location; |
| 84 [RaisesException=Setter] attribute DOMString domain; | 92 [RaisesException=Setter] attribute DOMString domain; |
| 85 readonly attribute DOMString referrer; | 93 readonly attribute DOMString referrer; |
| 86 // FIXME: cookie should not have [TreatNullAs=NullString]. | 94 [RaisesException] attribute DOMString cookie; |
| 87 [TreatNullAs=NullString, RaisesException] attribute DOMString cookie; | |
| 88 readonly attribute DOMString lastModified; | 95 readonly attribute DOMString lastModified; |
| 89 readonly attribute DocumentReadyState readyState; | 96 readonly attribute DocumentReadyState readyState; |
| 90 | 97 |
| 91 // DOM tree accessors | 98 // DOM tree accessors |
| 92 // FIXME: title and dir should not have [TreatNullAs=NullString]. | 99 [CustomElementCallbacks] attribute DOMString title; |
| 93 [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString title; | 100 [CustomElementCallbacks] attribute DOMString dir; |
| 94 [TreatNullAs=NullString, CustomElementCallbacks] attribute DOMString dir; | 101 [RaisesException=Setter, CustomElementCallbacks, PerWorldBindings] attribute
HTMLElement? body; |
| 95 [RaisesException=Setter, CustomElementCallbacks, PerWorldBindings, TypeCheck
ing=Interface] attribute HTMLElement? body; | |
| 96 readonly attribute HTMLHeadElement? head; | 102 readonly attribute HTMLHeadElement? head; |
| 97 [SameObject] readonly attribute HTMLCollection images; | 103 [SameObject] readonly attribute HTMLCollection images; |
| 98 [SameObject] readonly attribute HTMLCollection embeds; | 104 [SameObject] readonly attribute HTMLCollection embeds; |
| 99 [SameObject, ImplementedAs=embeds] readonly attribute HTMLCollection plugins
; | 105 [SameObject, ImplementedAs=embeds] readonly attribute HTMLCollection plugins
; |
| 100 [SameObject] readonly attribute HTMLCollection links; | 106 [SameObject] readonly attribute HTMLCollection links; |
| 101 [SameObject] readonly attribute HTMLCollection forms; | 107 [SameObject] readonly attribute HTMLCollection forms; |
| 102 [SameObject] readonly attribute HTMLCollection scripts; | 108 [SameObject] readonly attribute HTMLCollection scripts; |
| 103 [PerWorldBindings] NodeList getElementsByName(DOMString elementName); | 109 [PerWorldBindings] NodeList getElementsByName(DOMString elementName); |
| 104 readonly attribute HTMLScriptElement? currentScript; | 110 readonly attribute HTMLScriptElement? currentScript; |
| 105 | 111 |
| 106 // dynamic markup insertion | 112 // dynamic markup insertion |
| 107 // FIXME: There are two open() methods in the spec. | 113 // FIXME: There are two open() methods in the spec. |
| 108 [Custom, CustomElementCallbacks, RaisesException] void open(); | 114 [Custom, CustomElementCallbacks, RaisesException] void open(); |
| 109 [RaisesException] void close(); | 115 [RaisesException] void close(); |
| 110 [CallWith=ActiveWindow, CustomElementCallbacks, RaisesException] void write(
DOMString... text); | 116 [CallWith=FirstWindow, CustomElementCallbacks, RaisesException] void write(D
OMString... text); |
| 111 [CallWith=ActiveWindow, CustomElementCallbacks, RaisesException] void writel
n(DOMString... text); | 117 [CallWith=FirstWindow, CustomElementCallbacks, RaisesException] void writeln
(DOMString... text); |
| 112 | 118 |
| 113 // user interaction | 119 // user interaction |
| 114 [ImplementedAs=domWindow] readonly attribute Window? defaultView; | 120 [ImplementedAs=domWindow] readonly attribute Window? defaultView; |
| 115 readonly attribute Element? activeElement; | 121 readonly attribute Element? activeElement; |
| 116 boolean hasFocus(); | 122 boolean hasFocus(); |
| 117 // FIXME: designMode should not have [TreatNullAs=NullString]. | 123 [CustomElementCallbacks, MeasureAs=DocumentDesignMode] attribute DOMString d
esignMode; |
| 118 [TreatNullAs=NullString, CustomElementCallbacks, MeasureAs=DocumentDesignMod
e] attribute DOMString designMode; | |
| 119 [CustomElementCallbacks, RaisesException] boolean execCommand(DOMString comm
andId, optional boolean showUI = false, optional DOMString value = ""); | 124 [CustomElementCallbacks, RaisesException] boolean execCommand(DOMString comm
andId, optional boolean showUI = false, optional DOMString value = ""); |
| 120 [RaisesException] boolean queryCommandEnabled(DOMString commandId); | 125 [RaisesException] boolean queryCommandEnabled(DOMString commandId); |
| 121 [RaisesException] boolean queryCommandIndeterm(DOMString commandId); | 126 [RaisesException] boolean queryCommandIndeterm(DOMString commandId); |
| 122 [RaisesException] boolean queryCommandState(DOMString commandId); | 127 [RaisesException] boolean queryCommandState(DOMString commandId); |
| 123 [RaisesException] boolean queryCommandSupported(DOMString commandId); | 128 [RaisesException] boolean queryCommandSupported(DOMString commandId); |
| 124 [RaisesException] DOMString queryCommandValue(DOMString commandId); | 129 [RaisesException] DOMString queryCommandValue(DOMString commandId); |
| 125 | 130 |
| 126 [LenientThis] attribute EventHandler onreadystatechange; | 131 [LenientThis] attribute EventHandler onreadystatechange; |
| 127 | 132 |
| 128 // HTML obsolete features | 133 // HTML obsolete features |
| (...skipping 26 matching lines...) Expand all Loading... |
| 155 // Pointer Lock | 160 // Pointer Lock |
| 156 // https://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html#extensions
-to-the-document-interface | 161 // https://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html#extensions
-to-the-document-interface |
| 157 attribute EventHandler onpointerlockchange; | 162 attribute EventHandler onpointerlockchange; |
| 158 attribute EventHandler onpointerlockerror; | 163 attribute EventHandler onpointerlockerror; |
| 159 [MeasureAs=DocumentPointerLockElement] readonly attribute Element? pointerLo
ckElement; | 164 [MeasureAs=DocumentPointerLockElement] readonly attribute Element? pointerLo
ckElement; |
| 160 [MeasureAs=DocumentExitPointerLock] void exitPointerLock(); | 165 [MeasureAs=DocumentExitPointerLock] void exitPointerLock(); |
| 161 | 166 |
| 162 // Touch Events | 167 // Touch Events |
| 163 // http://rawgit.com/w3c/touch-events/v1-errata/touchevents.html#extensions-
to-the-document-interface | 168 // http://rawgit.com/w3c/touch-events/v1-errata/touchevents.html#extensions-
to-the-document-interface |
| 164 // FIXME: The arguments should not be optional. | 169 // FIXME: The arguments should not be optional. |
| 165 [RuntimeEnabled=Touch, Measure] Touch createTouch([Default=Undefined] option
al Window window, | 170 [RuntimeEnabled=Touch, Measure, LegacyInterfaceTypeChecking] Touch createTou
ch([Default=Undefined] optional Window window, |
| 166 [Default=Undefined] option
al EventTarget target, | 171
[Default=Undefined] optional EventTarget target, |
| 167 [Default=Undefined] option
al long identifier, | 172
[Default=Undefined] optional long identifier, |
| 168 [Default=Undefined] option
al unrestricted double pageX, | 173
[Default=Undefined] optional unrestricted double pageX, |
| 169 [Default=Undefined] option
al unrestricted double pageY, | 174
[Default=Undefined] optional unrestricted double pageY, |
| 170 [Default=Undefined] option
al unrestricted double screenX, | 175
[Default=Undefined] optional unrestricted double screenX, |
| 171 [Default=Undefined] option
al unrestricted double screenY, | 176
[Default=Undefined] optional unrestricted double screenY, |
| 172 [Default=Undefined] option
al unrestricted double radiusX, | 177
[Default=Undefined] optional unrestricted double radiusX, |
| 173 [Default=Undefined] option
al unrestricted double radiusY, | 178
[Default=Undefined] optional unrestricted double radiusY, |
| 174 [Default=Undefined] option
al unrestricted float rotationAngle, | 179
[Default=Undefined] optional unrestricted float rotationAngle, |
| 175 [Default=Undefined] option
al unrestricted float force); | 180
[Default=Undefined] optional unrestricted float force); |
| 176 [RuntimeEnabled=Touch] TouchList createTouchList(Touch... touches); | 181 [RuntimeEnabled=Touch] TouchList createTouchList(Touch... touches); |
| 177 | 182 |
| 178 // FIXME: The spec doesn't define these event handler attributes. | |
| 179 [RuntimeEnabled=Touch] attribute EventHandler ontouchstart; | |
| 180 [RuntimeEnabled=Touch] attribute EventHandler ontouchend; | |
| 181 [RuntimeEnabled=Touch] attribute EventHandler ontouchmove; | |
| 182 [RuntimeEnabled=Touch] attribute EventHandler ontouchcancel; | |
| 183 | |
| 184 // Custom Elements | 183 // Custom Elements |
| 185 // http://w3c.github.io/webcomponents/spec/custom/#extensions-to-document-in
terface-to-register | 184 // http://w3c.github.io/webcomponents/spec/custom/#extensions-to-document-in
terface-to-register |
| 186 // FIXME: The registerElement return type should be Function. | 185 // FIXME: The registerElement return type should be Function. |
| 187 [CallWith=ScriptState, CustomElementCallbacks, RaisesException, MeasureAs=Do
cumentRegisterElement] CustomElementConstructor registerElement(DOMString type,
optional ElementRegistrationOptions options); | 186 [CallWith=ScriptState, CustomElementCallbacks, RaisesException, MeasureAs=Do
cumentRegisterElement] CustomElementConstructor registerElement(DOMString type,
optional ElementRegistrationOptions options); |
| 188 // http://w3c.github.io/webcomponents/spec/custom/#extensions-to-document-in
terface-to-instantiate | 187 // http://w3c.github.io/webcomponents/spec/custom/#extensions-to-document-in
terface-to-instantiate |
| 189 // FIXME: The typeExtension arguments should not be nullable. | 188 // FIXME: The typeExtension arguments should not be nullable. |
| 190 [CustomElementCallbacks, PerWorldBindings, RaisesException] Element createEl
ement(DOMString localName, DOMString? typeExtension); | 189 [CustomElementCallbacks, PerWorldBindings, RaisesException] Element createEl
ement(DOMString localName, DOMString? typeExtension); |
| 191 [CustomElementCallbacks, RaisesException] Element createElementNS(DOMString?
namespaceURI, DOMString qualifiedName, DOMString? typeExtension); | 190 [CustomElementCallbacks, RaisesException] Element createElementNS(DOMString?
namespaceURI, DOMString qualifiedName, DOMString? typeExtension); |
| 192 | 191 |
| 193 // Page Visibility | 192 // Page Visibility |
| 194 // http://www.w3.org/TR/page-visibility/#sec-document-interface | 193 // http://www.w3.org/TR/page-visibility/#sec-document-interface |
| 195 readonly attribute boolean hidden; | 194 readonly attribute boolean hidden; |
| 196 readonly attribute VisibilityState visibilityState; | 195 readonly attribute VisibilityState visibilityState; |
| 197 | 196 |
| 198 // Non-standard APIs | 197 // Non-standard APIs |
| 199 [MeasureAs=DocumentCharset] readonly attribute DOMString charset; | |
| 200 [MeasureAs=DocumentDefaultCharset, TreatReturnedNullStringAs=Undefined] read
only attribute DOMString defaultCharset; | |
| 201 [MeasureAs=DocumentCaretRangeFromPoint] Range caretRangeFromPoint([Default=U
ndefined] optional long x, [Default=Undefined] optional long y); | 198 [MeasureAs=DocumentCaretRangeFromPoint] Range caretRangeFromPoint([Default=U
ndefined] optional long x, [Default=Undefined] optional long y); |
| 202 [CallWith=ScriptState, DeprecateAs=DocumentGetCSSCanvasContext] any getCSSCa
nvasContext(DOMString contextId, DOMString name, long width, long height); | |
| 203 | 199 |
| 204 // Deprecated prefixed page visibility API. | 200 // Deprecated prefixed page visibility API. |
| 205 // TODO(davidben): This is a property so attaching a deprecation warning res
ults in false positives when outputting | 201 // TODO(davidben): This is a property so attaching a deprecation warning res
ults in false positives when outputting |
| 206 // document in the console. It's possible http://crbug.com/43394 will resolv
e this. | 202 // document in the console. It's possible http://crbug.com/43394 will resolv
e this. |
| 207 [MeasureAs=PrefixedPageVisibility, ImplementedAs=visibilityState] readonly a
ttribute DOMString webkitVisibilityState; | 203 [MeasureAs=PrefixedPageVisibility, ImplementedAs=visibilityState] readonly a
ttribute DOMString webkitVisibilityState; |
| 208 [MeasureAs=PrefixedPageVisibility, ImplementedAs=hidden] readonly attribute
boolean webkitHidden; | 204 [MeasureAs=PrefixedPageVisibility, ImplementedAs=hidden] readonly attribute
boolean webkitHidden; |
| 209 | 205 |
| 210 // Event handler attributes | 206 // Event handler attributes |
| 211 attribute EventHandler onbeforecopy; | 207 attribute EventHandler onbeforecopy; |
| 212 attribute EventHandler onbeforecut; | 208 attribute EventHandler onbeforecut; |
| 213 attribute EventHandler onbeforepaste; | 209 attribute EventHandler onbeforepaste; |
| 214 attribute EventHandler oncopy; | 210 attribute EventHandler oncopy; |
| 215 attribute EventHandler oncut; | 211 attribute EventHandler oncut; |
| 216 attribute EventHandler onpaste; | 212 attribute EventHandler onpaste; |
| 217 attribute EventHandler onsearch; | 213 attribute EventHandler onsearch; |
| 218 [RuntimeEnabled=ExperimentalContentSecurityPolicyFeatures] attribute EventHa
ndler onsecuritypolicyviolation; | 214 [RuntimeEnabled=ExperimentalContentSecurityPolicyFeatures] attribute EventHa
ndler onsecuritypolicyviolation; |
| 219 attribute EventHandler onselectionchange; | 215 attribute EventHandler onselectionchange; |
| 220 attribute EventHandler onselectstart; | 216 attribute EventHandler onselectstart; |
| 221 attribute EventHandler onwheel; | 217 attribute EventHandler onwheel; |
| 222 }; | 218 }; |
| 223 | 219 |
| 224 Document implements GlobalEventHandlers; | 220 Document implements GlobalEventHandlers; |
| 225 Document implements ParentNode; | 221 Document implements ParentNode; |
| 226 Document implements NonElementParentNode; | 222 Document implements NonElementParentNode; |
| OLD | NEW |