Bug 1614845 [wpt PR 21744] - Revert "[Shape Detection] Use IDL dictionaries for resul...
[gecko.git] / widget / nsIDragSession.idl
blob2c4b4d78586c448d844c6a3b045a972bedc55d1a
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 "nsISupports.idl"
8 #include "nsITransferable.idl"
12 %{ C++
13 #include "nsSize.h"
15 interface nsIContentSecurityPolicy;
17 native nsSize (nsSize);
19 webidl DataTransfer;
20 webidl Document;
21 webidl Node;
23 [scriptable, builtinclass, uuid(25bce737-73f0-43c7-bc20-c71044a73c5a)]
24 interface nsIDragSession : nsISupports
26 /**
27 * Set the current state of the drag, whether it can be dropped or not.
28 * usually the target "frame" sets this so the native system can render the correct feedback
30 attribute boolean canDrop;
32 /**
33 * Indicates if the drop event should be dispatched only to chrome.
35 attribute boolean onlyChromeDrop;
37 /**
38 * Sets the action (copy, move, link, et.c) for the current drag
40 attribute unsigned long dragAction;
42 /**
43 * Get the number of items that were dropped
45 readonly attribute unsigned long numDropItems;
47 /**
48 * The document where the drag was started, which will be null if the
49 * drag originated outside the application. Useful for determining if a drop
50 * originated in the same document.
52 readonly attribute Document sourceDocument;
54 /**
55 * The dom node that was originally dragged to start the session, which will be null if the
56 * drag originated outside the application.
58 readonly attribute Node sourceNode;
60 /**
61 * the triggering principal. This may be different than sourceNode's
62 * principal when sourceNode is xul:browser and the drag is
63 * triggered in a browsing context inside it.
65 attribute nsIPrincipal triggeringPrincipal;
67 /**
68 * the triggering csp. This may be different than sourceNode's
69 * csp when sourceNode is xul:browser and the drag is
70 * triggered in a browsing context inside it.
72 attribute nsIContentSecurityPolicy csp;
74 /**
75 * The data transfer object for the current drag.
77 [binaryname(DataTransferXPCOM)]
78 attribute DataTransfer dataTransfer;
79 [notxpcom, nostdcall] DataTransfer getDataTransfer();
80 [notxpcom, nostdcall] void setDataTransfer(in DataTransfer aDataTransfer);
82 /**
83 * Get data from a Drag&Drop. Can be called while the drag is in process
84 * or after the drop has completed.
86 * @param aTransferable the transferable for the data to be put into
87 * @param aItemIndex which of multiple drag items, zero-based
89 void getData ( in nsITransferable aTransferable, in unsigned long aItemIndex ) ;
91 /**
92 * Check to set if any of the native data on the clipboard matches this data flavor
94 boolean isDataFlavorSupported ( in string aDataFlavor ) ;
96 void userCancelled();
98 void dragEventDispatchedToChildProcess();
100 // Called when nsIDragSession implementation should update the UI for the
101 // drag-and-drop based on the data got from the child process in response to
102 // NS_DRAGDROP_OVER sent from parent process to child process.
103 void updateDragEffect();
105 // Change the drag image, using similar arguments as
106 // nsIDragService::InvokeDragSessionWithImage.
107 void updateDragImage(in Node aImage, in long aImageX, in long aImageY);
110 * Returns effects allowed at starting the session for tests.
112 [notxpcom, nostdcall] unsigned long getEffectAllowedForTests();
115 * Returns true if current session was started with synthesized drag start.
117 [notxpcom, nostdcall] bool isSynthesizedForTests();
120 * Sets drag end point of synthesized session when the test does not dispatch
121 * "drop" event.
123 void setDragEndPointForTests(in long aScreenX, in long aScreenY);