dom/webidl/DataTransfer.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://www.whatwg.org/specs/web-apps/current-work/#the-datatransfer-interface
michael@0 8 */
michael@0 9
michael@0 10 [ChromeConstructor(DOMString eventType, boolean isExternal)]
michael@0 11 interface DataTransfer {
michael@0 12 attribute DOMString dropEffect;
michael@0 13 attribute DOMString effectAllowed;
michael@0 14
michael@0 15 //readonly attribute DataTransferItemList items;
michael@0 16
michael@0 17 [Throws]
michael@0 18 void setDragImage(Element image, long x, long y);
michael@0 19
michael@0 20 readonly attribute DOMStringList types;
michael@0 21 [Throws]
michael@0 22 DOMString getData(DOMString format);
michael@0 23 [Throws]
michael@0 24 void setData(DOMString format, DOMString data);
michael@0 25 [Throws]
michael@0 26 void clearData(optional DOMString format);
michael@0 27 [Throws]
michael@0 28 readonly attribute FileList? files;
michael@0 29 };
michael@0 30
michael@0 31 // Mozilla specific stuff
michael@0 32 partial interface DataTransfer {
michael@0 33 /*
michael@0 34 * Set the drag source. Usually you would not change this, but it will
michael@0 35 * affect which node the drag and dragend events are fired at. The
michael@0 36 * default target is the node that was dragged.
michael@0 37 *
michael@0 38 * @param element drag source to use
michael@0 39 * @throws NO_MODIFICATION_ALLOWED_ERR if the item cannot be modified
michael@0 40 */
michael@0 41 [Throws]
michael@0 42 void addElement(Element element);
michael@0 43
michael@0 44 /**
michael@0 45 * The number of items being dragged.
michael@0 46 */
michael@0 47 readonly attribute unsigned long mozItemCount;
michael@0 48
michael@0 49 /**
michael@0 50 * Sets the drag cursor state. Primarily used to control the cursor during
michael@0 51 * tab drags, but could be expanded to other uses. XXX Currently implemented
michael@0 52 * on Win32 only.
michael@0 53 *
michael@0 54 * Possible values:
michael@0 55 * auto - use default system behavior.
michael@0 56 * default - set the cursor to an arrow during the drag operation.
michael@0 57 *
michael@0 58 * Values other than 'default' are indentical to setting mozCursor to
michael@0 59 * 'auto'.
michael@0 60 */
michael@0 61 attribute DOMString mozCursor;
michael@0 62
michael@0 63 /**
michael@0 64 * Holds a list of the format types of the data that is stored for an item
michael@0 65 * at the specified index. If the index is not in the range from 0 to
michael@0 66 * itemCount - 1, an empty string list is returned.
michael@0 67 */
michael@0 68 [Throws]
michael@0 69 DOMStringList mozTypesAt(unsigned long index);
michael@0 70
michael@0 71 /**
michael@0 72 * Remove the data associated with the given format for an item at the
michael@0 73 * specified index. The index is in the range from zero to itemCount - 1.
michael@0 74 *
michael@0 75 * If the last format for the item is removed, the entire item is removed,
michael@0 76 * reducing the itemCount by one.
michael@0 77 *
michael@0 78 * If format is empty, then the data associated with all formats is removed.
michael@0 79 * If the format is not found, then this method has no effect.
michael@0 80 *
michael@0 81 * @param format the format to remove
michael@0 82 * @throws NS_ERROR_DOM_INDEX_SIZE_ERR if index is greater or equal than itemCount
michael@0 83 * @throws NO_MODIFICATION_ALLOWED_ERR if the item cannot be modified
michael@0 84 */
michael@0 85 [Throws]
michael@0 86 void mozClearDataAt(DOMString format, unsigned long index);
michael@0 87
michael@0 88 /*
michael@0 89 * A data transfer may store multiple items, each at a given zero-based
michael@0 90 * index. setDataAt may only be called with an index argument less than
michael@0 91 * itemCount in which case an existing item is modified, or equal to
michael@0 92 * itemCount in which case a new item is added, and the itemCount is
michael@0 93 * incremented by one.
michael@0 94 *
michael@0 95 * Data should be added in order of preference, with the most specific
michael@0 96 * format added first and the least specific format added last. If data of
michael@0 97 * the given format already exists, it is replaced in the same position as
michael@0 98 * the old data.
michael@0 99 *
michael@0 100 * The data should be either a string, a primitive boolean or number type
michael@0 101 * (which will be converted into a string) or an nsISupports.
michael@0 102 *
michael@0 103 * @param format the format to add
michael@0 104 * @param data the data to add
michael@0 105 * @throws NS_ERROR_NULL_POINTER if the data is null
michael@0 106 * @throws NS_ERROR_DOM_INDEX_SIZE_ERR if index is greater than itemCount
michael@0 107 * @throws NO_MODIFICATION_ALLOWED_ERR if the item cannot be modified
michael@0 108 */
michael@0 109 [Throws]
michael@0 110 void mozSetDataAt(DOMString format, any data, unsigned long index);
michael@0 111
michael@0 112 /**
michael@0 113 * Retrieve the data associated with the given format for an item at the
michael@0 114 * specified index, or null if it does not exist. The index should be in the
michael@0 115 * range from zero to itemCount - 1.
michael@0 116 *
michael@0 117 * @param format the format of the data to look up
michael@0 118 * @returns the data of the given format, or null if it doesn't exist.
michael@0 119 * @throws NS_ERROR_DOM_INDEX_SIZE_ERR if index is greater or equal than itemCount
michael@0 120 */
michael@0 121 [Throws]
michael@0 122 any mozGetDataAt(DOMString format, unsigned long index);
michael@0 123
michael@0 124 /**
michael@0 125 * Will be true when the user has cancelled the drag (typically by pressing
michael@0 126 * Escape) and when the drag has been cancelled unexpectedly. This will be
michael@0 127 * false otherwise, including when the drop has been rejected by its target.
michael@0 128 * This property is only relevant for the dragend event.
michael@0 129 */
michael@0 130 readonly attribute boolean mozUserCancelled;
michael@0 131
michael@0 132 /**
michael@0 133 * The node that the mouse was pressed over to begin the drag. For external
michael@0 134 * drags, or if the caller cannot access this node, this will be null.
michael@0 135 */
michael@0 136 readonly attribute Node? mozSourceNode;
michael@0 137 };

mercurial