dom/webidl/Document.webidl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
michael@0 4 * You can obtain one at http://mozilla.org/MPL/2.0/.
michael@0 5 *
michael@0 6 * The origin of this IDL file is:
michael@0 7 * http://dom.spec.whatwg.org/#interface-document
michael@0 8 * http://www.whatwg.org/specs/web-apps/current-work/#the-document-object
michael@0 9 * http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#api
michael@0 10 * http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html#extensions-to-the-document-interface
michael@0 11 * http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview.html#sec-document-interface
michael@0 12 * http://dev.w3.org/csswg/cssom/#extensions-to-the-document-interface
michael@0 13 * http://dev.w3.org/csswg/cssom-view/#extensions-to-the-document-interface
michael@0 14 *
michael@0 15 * http://mxr.mozilla.org/mozilla-central/source/dom/interfaces/core/nsIDOMDocument.idl
michael@0 16 */
michael@0 17
michael@0 18 interface WindowProxy;
michael@0 19 interface nsISupports;
michael@0 20 interface URI;
michael@0 21 interface nsIDocShell;
michael@0 22
michael@0 23 enum VisibilityState { "hidden", "visible" };
michael@0 24
michael@0 25 /* http://dom.spec.whatwg.org/#interface-document */
michael@0 26 [Constructor]
michael@0 27 interface Document : Node {
michael@0 28 [Throws]
michael@0 29 readonly attribute DOMImplementation implementation;
michael@0 30 [Pure]
michael@0 31 readonly attribute DOMString URL;
michael@0 32 [Pure]
michael@0 33 readonly attribute DOMString documentURI;
michael@0 34 [Pure]
michael@0 35 readonly attribute DOMString compatMode;
michael@0 36 [Pure]
michael@0 37 readonly attribute DOMString characterSet;
michael@0 38 [Pure]
michael@0 39 readonly attribute DOMString contentType;
michael@0 40
michael@0 41 [Pure]
michael@0 42 readonly attribute DocumentType? doctype;
michael@0 43 [Pure]
michael@0 44 readonly attribute Element? documentElement;
michael@0 45 [Pure]
michael@0 46 HTMLCollection getElementsByTagName(DOMString localName);
michael@0 47 [Pure, Throws]
michael@0 48 HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName);
michael@0 49 [Pure]
michael@0 50 HTMLCollection getElementsByClassName(DOMString classNames);
michael@0 51 [Pure]
michael@0 52 Element? getElementById(DOMString elementId);
michael@0 53
michael@0 54 [NewObject, Throws]
michael@0 55 Element createElement(DOMString localName);
michael@0 56 [NewObject, Throws]
michael@0 57 Element createElementNS(DOMString? namespace, DOMString qualifiedName);
michael@0 58 [NewObject]
michael@0 59 DocumentFragment createDocumentFragment();
michael@0 60 [NewObject]
michael@0 61 Text createTextNode(DOMString data);
michael@0 62 [NewObject]
michael@0 63 Comment createComment(DOMString data);
michael@0 64 [NewObject, Throws]
michael@0 65 ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);
michael@0 66
michael@0 67 [Throws]
michael@0 68 Node importNode(Node node, optional boolean deep = false);
michael@0 69 [Throws]
michael@0 70 Node adoptNode(Node node);
michael@0 71
michael@0 72 [NewObject, Throws]
michael@0 73 Event createEvent(DOMString interface);
michael@0 74
michael@0 75 [NewObject, Throws]
michael@0 76 Range createRange();
michael@0 77
michael@0 78 // NodeFilter.SHOW_ALL = 0xFFFFFFFF
michael@0 79 [NewObject, Throws]
michael@0 80 NodeIterator createNodeIterator(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
michael@0 81 [NewObject, Throws]
michael@0 82 TreeWalker createTreeWalker(Node root, optional unsigned long whatToShow = 0xFFFFFFFF, optional NodeFilter? filter = null);
michael@0 83
michael@0 84 // NEW
michael@0 85 // No support for prepend/append yet
michael@0 86 // void prepend((Node or DOMString)... nodes);
michael@0 87 // void append((Node or DOMString)... nodes);
michael@0 88
michael@0 89 // These are not in the spec, but leave them for now for backwards compat.
michael@0 90 // So sort of like Gecko extensions
michael@0 91 [NewObject, Throws]
michael@0 92 CDATASection createCDATASection(DOMString data);
michael@0 93 [NewObject, Throws]
michael@0 94 Attr createAttribute(DOMString name);
michael@0 95 [NewObject, Throws]
michael@0 96 Attr createAttributeNS(DOMString? namespace, DOMString name);
michael@0 97 [Pure]
michael@0 98 readonly attribute DOMString? inputEncoding;
michael@0 99 };
michael@0 100
michael@0 101 // http://www.whatwg.org/specs/web-apps/current-work/#the-document-object
michael@0 102 partial interface Document {
michael@0 103 [PutForwards=href, Unforgeable] readonly attribute Location? location;
michael@0 104 //(HTML only) attribute DOMString domain;
michael@0 105 readonly attribute DOMString referrer;
michael@0 106 //(HTML only) attribute DOMString cookie;
michael@0 107 readonly attribute DOMString lastModified;
michael@0 108 readonly attribute DOMString readyState;
michael@0 109
michael@0 110 // DOM tree accessors
michael@0 111 //(Not proxy yet)getter object (DOMString name);
michael@0 112 [SetterThrows, Pure]
michael@0 113 attribute DOMString title;
michael@0 114 [Pure]
michael@0 115 attribute DOMString dir;
michael@0 116 //(HTML only) attribute HTMLElement? body;
michael@0 117 //(HTML only)readonly attribute HTMLHeadElement? head;
michael@0 118 //(HTML only)readonly attribute HTMLCollection images;
michael@0 119 //(HTML only)readonly attribute HTMLCollection embeds;
michael@0 120 //(HTML only)readonly attribute HTMLCollection plugins;
michael@0 121 //(HTML only)readonly attribute HTMLCollection links;
michael@0 122 //(HTML only)readonly attribute HTMLCollection forms;
michael@0 123 //(HTML only)readonly attribute HTMLCollection scripts;
michael@0 124 //(HTML only)NodeList getElementsByName(DOMString elementName);
michael@0 125 //(HTML only)NodeList getItems(optional DOMString typeNames); // microdata
michael@0 126 //(Not implemented)readonly attribute DOMElementMap cssElementMap;
michael@0 127
michael@0 128 // dynamic markup insertion
michael@0 129 //(HTML only)Document open(optional DOMString type, optional DOMString replace);
michael@0 130 //(HTML only)WindowProxy open(DOMString url, DOMString name, DOMString features, optional boolean replace);
michael@0 131 //(HTML only)void close();
michael@0 132 //(HTML only)void write(DOMString... text);
michael@0 133 //(HTML only)void writeln(DOMString... text);
michael@0 134
michael@0 135 // user interaction
michael@0 136 [Pure]
michael@0 137 readonly attribute WindowProxy? defaultView;
michael@0 138 readonly attribute Element? activeElement;
michael@0 139 [Throws]
michael@0 140 boolean hasFocus();
michael@0 141 //(HTML only) attribute DOMString designMode;
michael@0 142 //(HTML only)boolean execCommand(DOMString commandId);
michael@0 143 //(HTML only)boolean execCommand(DOMString commandId, boolean showUI);
michael@0 144 //(HTML only)boolean execCommand(DOMString commandId, boolean showUI, DOMString value);
michael@0 145 //(HTML only)boolean queryCommandEnabled(DOMString commandId);
michael@0 146 //(HTML only)boolean queryCommandIndeterm(DOMString commandId);
michael@0 147 //(HTML only)boolean queryCommandState(DOMString commandId);
michael@0 148 //(HTML only)boolean queryCommandSupported(DOMString commandId);
michael@0 149 //(HTML only)DOMString queryCommandValue(DOMString commandId);
michael@0 150 //(Not implemented)readonly attribute HTMLCollection commands;
michael@0 151
michael@0 152 // special event handler IDL attributes that only apply to Document objects
michael@0 153 [LenientThis] attribute EventHandler onreadystatechange;
michael@0 154
michael@0 155 // Gecko extensions?
michael@0 156 attribute EventHandler onwheel;
michael@0 157 attribute EventHandler oncopy;
michael@0 158 attribute EventHandler oncut;
michael@0 159 attribute EventHandler onpaste;
michael@0 160 attribute EventHandler onbeforescriptexecute;
michael@0 161 attribute EventHandler onafterscriptexecute;
michael@0 162 /**
michael@0 163 * True if this document is synthetic : stand alone image, video, audio file,
michael@0 164 * etc.
michael@0 165 */
michael@0 166 [Func="IsChromeOrXBL"] readonly attribute boolean mozSyntheticDocument;
michael@0 167 /**
michael@0 168 * Returns the script element whose script is currently being processed.
michael@0 169 *
michael@0 170 * @see <https://developer.mozilla.org/en/DOM/document.currentScript>
michael@0 171 */
michael@0 172 [Pure]
michael@0 173 readonly attribute Element? currentScript;
michael@0 174 /**
michael@0 175 * Release the current mouse capture if it is on an element within this
michael@0 176 * document.
michael@0 177 *
michael@0 178 * @see <https://developer.mozilla.org/en/DOM/document.releaseCapture>
michael@0 179 */
michael@0 180 void releaseCapture();
michael@0 181 /**
michael@0 182 * Use the given DOM element as the source image of target |-moz-element()|.
michael@0 183 *
michael@0 184 * This function introduces a new special ID (called "image element ID"),
michael@0 185 * which is only used by |-moz-element()|, and associates it with the given
michael@0 186 * DOM element. Image elements ID's have the higher precedence than general
michael@0 187 * HTML id's, so if |document.mozSetImageElement(<id>, <element>)| is called,
michael@0 188 * |-moz-element(#<id>)| uses |<element>| as the source image even if there
michael@0 189 * is another element with id attribute = |<id>|. To unregister an image
michael@0 190 * element ID |<id>|, call |document.mozSetImageElement(<id>, null)|.
michael@0 191 *
michael@0 192 * Example:
michael@0 193 * <script>
michael@0 194 * canvas = document.createElement("canvas");
michael@0 195 * canvas.setAttribute("width", 100);
michael@0 196 * canvas.setAttribute("height", 100);
michael@0 197 * // draw to canvas
michael@0 198 * document.mozSetImageElement("canvasbg", canvas);
michael@0 199 * </script>
michael@0 200 * <div style="background-image: -moz-element(#canvasbg);"></div>
michael@0 201 *
michael@0 202 * @param aImageElementId an image element ID to associate with
michael@0 203 * |aImageElement|
michael@0 204 * @param aImageElement a DOM element to be used as the source image of
michael@0 205 * |-moz-element(#aImageElementId)|. If this is null, the function will
michael@0 206 * unregister the image element ID |aImageElementId|.
michael@0 207 *
michael@0 208 * @see <https://developer.mozilla.org/en/DOM/document.mozSetImageElement>
michael@0 209 */
michael@0 210 void mozSetImageElement(DOMString aImageElementId,
michael@0 211 Element? aImageElement);
michael@0 212
michael@0 213 [ChromeOnly]
michael@0 214 readonly attribute URI? documentURIObject;
michael@0 215
michael@0 216 };
michael@0 217
michael@0 218 // http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html#api
michael@0 219 partial interface Document {
michael@0 220 // Note: Per spec the 'S' in these two is lowercase, but the "Moz"
michael@0 221 // versions hve it uppercase.
michael@0 222 readonly attribute boolean mozFullScreenEnabled;
michael@0 223 [Throws]
michael@0 224 readonly attribute Element? mozFullScreenElement;
michael@0 225
michael@0 226 //(Renamed?)void exitFullscreen();
michael@0 227
michael@0 228 // Gecko-specific fullscreen bits
michael@0 229 readonly attribute boolean mozFullScreen;
michael@0 230 void mozCancelFullScreen();
michael@0 231 };
michael@0 232
michael@0 233 // http://dvcs.w3.org/hg/pointerlock/raw-file/default/index.html#extensions-to-the-document-interface
michael@0 234 partial interface Document {
michael@0 235 readonly attribute Element? mozPointerLockElement;
michael@0 236 void mozExitPointerLock ();
michael@0 237 };
michael@0 238
michael@0 239 //http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html#dfn-document-register
michael@0 240 partial interface Document {
michael@0 241 [Throws, Func="nsDocument::IsRegisterElementEnabled"]
michael@0 242 object registerElement(DOMString name, optional ElementRegistrationOptions options);
michael@0 243 };
michael@0 244
michael@0 245 //http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/custom/index.html#dfn-document-register
michael@0 246 partial interface Document {
michael@0 247 [NewObject, Throws]
michael@0 248 Element createElement(DOMString localName, DOMString typeExtension);
michael@0 249 [NewObject, Throws]
michael@0 250 Element createElementNS(DOMString? namespace, DOMString qualifiedName, DOMString typeExtension);
michael@0 251 };
michael@0 252
michael@0 253 // http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview.html#sec-document-interface
michael@0 254 partial interface Document {
michael@0 255 readonly attribute boolean hidden;
michael@0 256 readonly attribute boolean mozHidden;
michael@0 257 readonly attribute VisibilityState visibilityState;
michael@0 258 readonly attribute VisibilityState mozVisibilityState;
michael@0 259 };
michael@0 260
michael@0 261 // http://dev.w3.org/csswg/cssom/#extensions-to-the-document-interface
michael@0 262 partial interface Document {
michael@0 263 [Constant]
michael@0 264 readonly attribute StyleSheetList styleSheets;
michael@0 265 attribute DOMString? selectedStyleSheetSet;
michael@0 266 readonly attribute DOMString? lastStyleSheetSet;
michael@0 267 readonly attribute DOMString? preferredStyleSheetSet;
michael@0 268 [Constant]
michael@0 269 readonly attribute DOMStringList styleSheetSets;
michael@0 270 void enableStyleSheetsForSet (DOMString? name);
michael@0 271 };
michael@0 272
michael@0 273 // http://dev.w3.org/csswg/cssom-view/#extensions-to-the-document-interface
michael@0 274 partial interface Document {
michael@0 275 Element? elementFromPoint (float x, float y);
michael@0 276
michael@0 277 CaretPosition? caretPositionFromPoint (float x, float y);
michael@0 278 };
michael@0 279
michael@0 280 // http://dvcs.w3.org/hg/undomanager/raw-file/tip/undomanager.html
michael@0 281 partial interface Document {
michael@0 282 [Pref="dom.undo_manager.enabled"]
michael@0 283 readonly attribute UndoManager? undoManager;
michael@0 284 };
michael@0 285
michael@0 286 // http://dev.w3.org/2006/webapi/selectors-api2/#interface-definitions
michael@0 287 partial interface Document {
michael@0 288 [Throws, Pure]
michael@0 289 Element? querySelector(DOMString selectors);
michael@0 290 [Throws, Pure]
michael@0 291 NodeList querySelectorAll(DOMString selectors);
michael@0 292
michael@0 293 //(Not implemented)Element? find(DOMString selectors, optional (Element or sequence<Node>)? refNodes);
michael@0 294 //(Not implemented)NodeList findAll(DOMString selectors, optional (Element or sequence<Node>)? refNodes);
michael@0 295 };
michael@0 296
michael@0 297 // Mozilla extensions of various sorts
michael@0 298 partial interface Document {
michael@0 299 // nsIDOMDocumentXBL. Wish we could make these [ChromeOnly], but
michael@0 300 // that would likely break bindings running with the page principal.
michael@0 301 [Func="IsChromeOrXBL"]
michael@0 302 NodeList? getAnonymousNodes(Element elt);
michael@0 303 [Func="IsChromeOrXBL"]
michael@0 304 Element? getAnonymousElementByAttribute(Element elt, DOMString attrName,
michael@0 305 DOMString attrValue);
michael@0 306 [Func="IsChromeOrXBL"]
michael@0 307 Element? getBindingParent(Node node);
michael@0 308 [Throws, Func="IsChromeOrXBL"]
michael@0 309 void loadBindingDocument(DOMString documentURL);
michael@0 310
michael@0 311 // nsIDOMDocumentTouch
michael@0 312 // XXXbz I can't find the sane spec for this stuff, so just cribbing
michael@0 313 // from our xpidl for now.
michael@0 314 [NewObject, Func="nsGenericHTMLElement::TouchEventsEnabled"]
michael@0 315 Touch createTouch(optional Window? view = null,
michael@0 316 optional EventTarget? target = null,
michael@0 317 optional long identifier = 0,
michael@0 318 optional long pageX = 0,
michael@0 319 optional long pageY = 0,
michael@0 320 optional long screenX = 0,
michael@0 321 optional long screenY = 0,
michael@0 322 optional long clientX = 0,
michael@0 323 optional long clientY = 0,
michael@0 324 optional long radiusX = 0,
michael@0 325 optional long radiusY = 0,
michael@0 326 optional float rotationAngle = 0,
michael@0 327 optional float force = 0);
michael@0 328 // XXXbz a hack to get around the fact that we don't support variadics as
michael@0 329 // distinguishing arguments yet. Once this hack is removed. we can also
michael@0 330 // remove the corresponding overload on nsIDocument, since Touch... and
michael@0 331 // sequence<Touch> look the same in the C++.
michael@0 332 [NewObject, Func="nsGenericHTMLElement::TouchEventsEnabled"]
michael@0 333 TouchList createTouchList(Touch touch, Touch... touches);
michael@0 334 // XXXbz and another hack for the fact that we can't usefully have optional
michael@0 335 // distinguishing arguments but need a working zero-arg form of
michael@0 336 // createTouchList().
michael@0 337 [NewObject, Func="nsGenericHTMLElement::TouchEventsEnabled"]
michael@0 338 TouchList createTouchList();
michael@0 339 [NewObject, Func="nsGenericHTMLElement::TouchEventsEnabled"]
michael@0 340 TouchList createTouchList(sequence<Touch> touches);
michael@0 341
michael@0 342 [ChromeOnly]
michael@0 343 attribute boolean styleSheetChangeEventsEnabled;
michael@0 344
michael@0 345 [ChromeOnly, Throws]
michael@0 346 void obsoleteSheet(URI sheetURI);
michael@0 347 [ChromeOnly, Throws]
michael@0 348 void obsoleteSheet(DOMString sheetURI);
michael@0 349
michael@0 350 [ChromeOnly] readonly attribute nsIDocShell? docShell;
michael@0 351
michael@0 352 [ChromeOnly] readonly attribute DOMString contentLanguage;
michael@0 353 };
michael@0 354
michael@0 355 // Extension to give chrome JS the ability to determine when a document was
michael@0 356 // created to satisfy an iframe with srcdoc attribute.
michael@0 357 partial interface Document {
michael@0 358 [ChromeOnly] readonly attribute boolean isSrcdocDocument;
michael@0 359 };
michael@0 360
michael@0 361 Document implements XPathEvaluator;
michael@0 362 Document implements GlobalEventHandlers;
michael@0 363 Document implements TouchEventHandlers;
michael@0 364 Document implements ParentNode;
michael@0 365 Document implements OnErrorEventHandlerForNodes;

mercurial