Bug 1852149 Part 1 - Add margin-rule pref r=firefox-style-system-reviewers,emilio
[gecko.git] / widget / nsIDragService.idl
blobaa2042f0c1c7173fc6109eb59885beaf20f8332d
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsIArray.idl"
8 #include "nsISupports.idl"
9 #include "nsIDragSession.idl"
10 #include "nsIContentPolicy.idl"
12 webidl DragEvent;
13 webidl Element;
14 webidl Node;
15 webidl Selection;
17 interface nsICookieJarSettings;
19 %{C++
20 #include "mozilla/EventForwards.h"
22 namespace mozilla {
23 namespace dom {
24 class ContentParent;
25 class DataTransfer;
26 class RemoteDragStartData;
27 } // namespace dom
28 } // namespace mozilla
31 [ptr] native ContentParentPtr(mozilla::dom::ContentParent);
32 [ptr] native DataTransferPtr(mozilla::dom::DataTransfer);
33 [ptr] native RemoteDragStartDataPtr(mozilla::dom::RemoteDragStartData);
34 native EventMessage(mozilla::EventMessage);
36 [scriptable, uuid(ebd6b3a2-af16-43af-a698-3091a087dd62), builtinclass]
37 interface nsIDragService : nsISupports
39 const long DRAGDROP_ACTION_NONE = 0;
40 const long DRAGDROP_ACTION_COPY = 1;
41 const long DRAGDROP_ACTION_MOVE = 2;
42 const long DRAGDROP_ACTION_LINK = 4;
43 const long DRAGDROP_ACTION_UNINITIALIZED = 64;
45 /**
46 * Starts a modal drag session with an array of transaferables.
48 * Note: This method is deprecated for non-native code.
50 * @param aPrincipal - the triggering principal of the drag, or null if
51 * it's from browser chrome or OS
52 * @param aCsp - The csp of the triggering Document
53 * @param aTransferables - an array of transferables to be dragged
54 * @param aActionType - specified which of copy/move/link are allowed
55 * @param aContentPolicyType - the contentPolicyType that will be
56 * passed to the loadInfo when creating a new channel
57 * (defaults to TYPE_OTHER)
59 [can_run_script]
60 void invokeDragSession (in Node aDOMNode,
61 in nsIPrincipal aPrincipal,
62 in nsIContentSecurityPolicy aCsp,
63 in nsICookieJarSettings aCookieJarSettings,
64 in nsIArray aTransferables,
65 in unsigned long aActionType,
66 [optional] in nsContentPolicyType aContentPolicyType);
68 /**
69 * Starts a modal drag session using an image. The first four arguments are
70 * the same as invokeDragSession.
72 * Note: This method is deprecated for non-native code.
74 * A custom image may be specified using the aImage argument. If this is
75 * supplied, the aImageX and aImageY arguments specify the offset within
76 * the image where the cursor would be positioned. That is, when the image
77 * is drawn, it is offset up and left the amount so that the cursor appears
78 * at that location within the image.
80 * If aImage is null, aImageX and aImageY are not used and the image is instead
81 * determined from the source node aDOMNode, and the offset calculated so that
82 * the initial location for the image appears in the same screen position as
83 * where the element is located. The node must be within a document.
85 * Currently, supported images are all DOM nodes. If this is an HTML <image> or
86 * <canvas>, the drag image is taken from the image data. If the element is in
87 * a document, it will be rendered at its displayed size, othewise, it will be
88 * rendered at its real size. For other types of elements, the element is
89 * rendered into an offscreen buffer in the same manner as it is currently
90 * displayed. The document selection is hidden while drawing.
92 * The aDragEvent must be supplied as the current screen coordinates of the
93 * event are needed to calculate the image location.
95 [noscript, can_run_script]
96 void invokeDragSessionWithImage(in Node aDOMNode,
97 in nsIPrincipal aPrincipal,
98 in nsIContentSecurityPolicy aCsp,
99 in nsICookieJarSettings aCookieJarSettings,
100 in nsIArray aTransferableArray,
101 in unsigned long aActionType,
102 in Node aImage,
103 in long aImageX,
104 in long aImageY,
105 in DragEvent aDragEvent,
106 in DataTransferPtr aDataTransfer);
108 /** Start a drag session with the data in aDragStartData from a child process.
109 * Other arguments are the same as invokeDragSessionWithImage.
111 [noscript, can_run_script]
112 void invokeDragSessionWithRemoteImage(in Node aDOMNode,
113 in nsIPrincipal aPrincipal,
114 in nsIContentSecurityPolicy aCsp,
115 in nsICookieJarSettings aCookieJarSettings,
116 in nsIArray aTransferableArray,
117 in unsigned long aActionType,
118 in RemoteDragStartDataPtr aDragStartData,
119 in DragEvent aDragEvent,
120 in DataTransferPtr aDataTransfer);
123 * Start a modal drag session using the selection as the drag image.
124 * The aDragEvent must be supplied as the current screen coordinates of the
125 * event are needed to calculate the image location.
127 * Note: This method is deprecated for non-native code.
129 [can_run_script]
130 void invokeDragSessionWithSelection(in Selection aSelection,
131 in nsIPrincipal aPrincipal,
132 in nsIContentSecurityPolicy aCsp,
133 in nsICookieJarSettings aCookieJarSettings,
134 in nsIArray aTransferableArray,
135 in unsigned long aActionType,
136 in DragEvent aDragEvent,
137 in DataTransferPtr aDataTransfer);
140 * Returns the current Drag Session
142 nsIDragSession getCurrentSession();
145 * Tells the Drag Service to start a drag session. This is called when
146 * an external drag occurs
148 void startDragSession() ;
151 * Similar to startDragSession(), automated tests may want to start
152 * session for emulating an external drag. At that time, this should
153 * be used instead of startDragSession().
155 * @param aAllowedEffect Set default drag action which means allowed effects
156 * in the session and every DnD events are initialized
157 * with one of specified value. So, the value can be
158 * DRAGDROP_ACTION_NONE, or one or more values of
159 * DRAGDROP_ACTION_(MOVE|COPY|LINK).
161 void startDragSessionForTests(in unsigned long aAllowedEffect);
164 * Tells the Drag Service to end a drag session. This is called when
165 * an external drag occurs
167 * If aDoneDrag is true, the drag has finished, otherwise the drag has
168 * just left the window.
170 [can_run_script]
171 void endDragSession(in boolean aDoneDrag,
172 [optional] in unsigned long aKeyModifiers);
175 * Fire a drag event at the source of the drag
177 [noscript, can_run_script]
178 void fireDragEventAtSource(in EventMessage aEventMessage,
179 in unsigned long aKeyModifiers);
182 * Increase/decrease dragging suppress level by one.
183 * If level is greater than one, dragging is disabled.
185 [can_run_script]
186 void suppress();
187 void unsuppress();
190 * aX and aY are in LayoutDevice pixels.
192 [noscript] void dragMoved(in long aX, in long aY);
194 [notxpcom, nostdcall] boolean maybeAddChildProcess(in ContentParentPtr aChild);
195 [notxpcom, nostdcall] boolean removeAllChildProcesses();
198 * Called when HTMLEditor maybe deleted the source node from the document.
200 * @param aEditingHost The editing host when the editor deletes selection.
202 [noscript] void maybeEditorDeletedSourceNode(in Element aEditingHost);
206 %{ C++