gecko-dev/widget/nsIDragSession.idl

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

126 строки
3.8 KiB
Plaintext
Исходник Обычный вид История

/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
1999-08-25 12:34:46 +04:00
*
2012-05-21 15:12:37 +04:00
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
1999-08-25 12:34:46 +04:00
#include "nsISupports.idl"
#include "nsITransferable.idl"
1999-08-25 12:34:46 +04:00
1999-08-25 12:34:46 +04:00
%{ C++
#include "nsSize.h"
%}
interface nsIContentSecurityPolicy;
1999-08-25 12:34:46 +04:00
native nsSize(nsSize);
1999-08-25 12:34:46 +04:00
webidl DataTransfer;
webidl Document;
webidl Node;
[scriptable, builtinclass, uuid(25bce737-73f0-43c7-bc20-c71044a73c5a)]
1999-08-25 12:34:46 +04:00
interface nsIDragSession : nsISupports
{
/**
* Set the current state of the drag, whether it can be dropped or not.
1999-08-25 12:34:46 +04:00
* usually the target "frame" sets this so the native system can render the correct feedback
*/
attribute boolean canDrop;
/**
* Indicates if the drop event should be dispatched only to chrome.
*/
attribute boolean onlyChromeDrop;
1999-08-25 12:34:46 +04:00
/**
* Sets the action (copy, move, link, et.c) for the current drag
*/
attribute unsigned long dragAction;
1999-08-25 12:34:46 +04:00
/**
* Get the number of items that were dropped
1999-08-25 12:34:46 +04:00
*/
readonly attribute unsigned long numDropItems;
/**
* The document where the drag was started, which will be null if the
* drag originated outside the application. Useful for determining if a drop
* originated in the same document.
*/
[infallible]
readonly attribute Document sourceDocument;
1999-08-25 12:34:46 +04:00
/**
* The dom node that was originally dragged to start the session, which will be null if the
* drag originated outside the application.
*/
readonly attribute Node sourceNode;
/**
* the triggering principal. This may be different than sourceNode's
* principal when sourceNode is xul:browser and the drag is
* triggered in a browsing context inside it.
*/
attribute nsIPrincipal triggeringPrincipal;
/**
* the triggering csp. This may be different than sourceNode's
* csp when sourceNode is xul:browser and the drag is
* triggered in a browsing context inside it.
*/
attribute nsIContentSecurityPolicy csp;
/**
* The data transfer object for the current drag.
*/
[binaryname(DataTransferXPCOM)]
attribute DataTransfer dataTransfer;
[notxpcom, nostdcall] DataTransfer getDataTransfer();
[notxpcom, nostdcall] void setDataTransfer(in DataTransfer aDataTransfer);
1999-08-25 12:34:46 +04:00
/**
* Get data from a Drag&Drop. Can be called while the drag is in process
* or after the drop has completed.
1999-08-25 12:34:46 +04:00
*
* @param aTransferable the transferable for the data to be put into
* @param aItemIndex which of multiple drag items, zero-based
*/
void getData ( in nsITransferable aTransferable, in unsigned long aItemIndex ) ;
1999-08-25 12:34:46 +04:00
/**
* Check to set if any of the native data on the clipboard matches this data flavor
1999-08-25 12:34:46 +04:00
*/
boolean isDataFlavorSupported ( in string aDataFlavor ) ;
void userCancelled();
void dragEventDispatchedToChildProcess();
// Called when nsIDragSession implementation should update the UI for the
// drag-and-drop based on the data got from the child process in response to
// NS_DRAGDROP_OVER sent from parent process to child process.
void updateDragEffect();
// Change the drag image, using similar arguments as
// nsIDragService::InvokeDragSessionWithImage.
void updateDragImage(in Node aImage, in long aImageX, in long aImageY);
1999-08-25 12:34:46 +04:00
Bug 1603074 - part 1: Make `synthesizePlainDragAndDrop()` synthesize drag events without `DataTransfer` object r=smaug `synthesizePlainDragAndDrop()` synthesizes drag events with `DataTransfer` object which is set to `DragEvent.dataTransfer` of `dragstart` after starting drag session explicitly. However, this causes `EventStateManager::DoDefaltDragStart()` does not initialize `nsIDragService` instance. Therefore, synthesized drag events cannot work with editor because `DragEvent::GetMozSourceNode()` returns `nullptr` due to `nsIDragSession::GetSourceNode()` returning `nullptr`. On the other hand, synthesized drag events cannot use `nsIDragService::InvodeDragSession()` normally because of hitting an assertion. https://searchfox.org/mozilla-central/rev/690e903ef689a4eca335b96bd903580394864a1c/widget/nsBaseDragService.cpp#230-233 This patch does: - mark drag events caused by synthesized mouse events as "synthesized for tests" - make `synthesizePlainDragAndDrop()` stop using `nsIDragService.startDragSession()` - make `nsBaseDragService` initialize and start session even for synthesized `dragstart` event - make `synthesizePlainDragAndDrop()` stop synthesizing drag events with `DataTransfer` object since it's normal behavior and it'll be initialized with `nsIDragService::GetDataTransfer()` - make `nsBaseDragService` store `effectAllowed` for the session only when it's synthesized session because it's required at initializing synthesized default `dropEffect` value of `dragenter`, `dragover`, `dragexit` and `drop` events' `dataTransfer` - make all tests which use `nsIDragService.startDragSession()` use new API, `nsIDragService.startDragSessionForTests()` to initialize session's `effectAllowed` value - make `EventStateManager::PostHandleEvent()` set drag end point of the test session to `eDrop` event's screen point - make `synthesizePlainDragAndDrop()` set drag end point of the session if it does not synthesize `drop` event because following `endDragSession()` use it at dispatching `dragend` event on the source element Additionally, this adds `dumpFunc` new param to `synthesizePlainDragAndDrop()` because it's really useful to investigate the reason why requesting DnD isn't performed as expected. Differential Revision: https://phabricator.services.mozilla.com/D57425 --HG-- extra : moz-landing-system : lando
2019-12-21 15:27:06 +03:00
/**
* Returns effects allowed at starting the session for tests.
*/
[notxpcom, nostdcall] unsigned long getEffectAllowedForTests();
1999-08-25 12:34:46 +04:00
Bug 1603074 - part 1: Make `synthesizePlainDragAndDrop()` synthesize drag events without `DataTransfer` object r=smaug `synthesizePlainDragAndDrop()` synthesizes drag events with `DataTransfer` object which is set to `DragEvent.dataTransfer` of `dragstart` after starting drag session explicitly. However, this causes `EventStateManager::DoDefaltDragStart()` does not initialize `nsIDragService` instance. Therefore, synthesized drag events cannot work with editor because `DragEvent::GetMozSourceNode()` returns `nullptr` due to `nsIDragSession::GetSourceNode()` returning `nullptr`. On the other hand, synthesized drag events cannot use `nsIDragService::InvodeDragSession()` normally because of hitting an assertion. https://searchfox.org/mozilla-central/rev/690e903ef689a4eca335b96bd903580394864a1c/widget/nsBaseDragService.cpp#230-233 This patch does: - mark drag events caused by synthesized mouse events as "synthesized for tests" - make `synthesizePlainDragAndDrop()` stop using `nsIDragService.startDragSession()` - make `nsBaseDragService` initialize and start session even for synthesized `dragstart` event - make `synthesizePlainDragAndDrop()` stop synthesizing drag events with `DataTransfer` object since it's normal behavior and it'll be initialized with `nsIDragService::GetDataTransfer()` - make `nsBaseDragService` store `effectAllowed` for the session only when it's synthesized session because it's required at initializing synthesized default `dropEffect` value of `dragenter`, `dragover`, `dragexit` and `drop` events' `dataTransfer` - make all tests which use `nsIDragService.startDragSession()` use new API, `nsIDragService.startDragSessionForTests()` to initialize session's `effectAllowed` value - make `EventStateManager::PostHandleEvent()` set drag end point of the test session to `eDrop` event's screen point - make `synthesizePlainDragAndDrop()` set drag end point of the session if it does not synthesize `drop` event because following `endDragSession()` use it at dispatching `dragend` event on the source element Additionally, this adds `dumpFunc` new param to `synthesizePlainDragAndDrop()` because it's really useful to investigate the reason why requesting DnD isn't performed as expected. Differential Revision: https://phabricator.services.mozilla.com/D57425 --HG-- extra : moz-landing-system : lando
2019-12-21 15:27:06 +03:00
/**
* Returns true if current session was started with synthesized drag start.
*/
[notxpcom, nostdcall] bool isSynthesizedForTests();
1999-08-25 12:34:46 +04:00
Bug 1603074 - part 1: Make `synthesizePlainDragAndDrop()` synthesize drag events without `DataTransfer` object r=smaug `synthesizePlainDragAndDrop()` synthesizes drag events with `DataTransfer` object which is set to `DragEvent.dataTransfer` of `dragstart` after starting drag session explicitly. However, this causes `EventStateManager::DoDefaltDragStart()` does not initialize `nsIDragService` instance. Therefore, synthesized drag events cannot work with editor because `DragEvent::GetMozSourceNode()` returns `nullptr` due to `nsIDragSession::GetSourceNode()` returning `nullptr`. On the other hand, synthesized drag events cannot use `nsIDragService::InvodeDragSession()` normally because of hitting an assertion. https://searchfox.org/mozilla-central/rev/690e903ef689a4eca335b96bd903580394864a1c/widget/nsBaseDragService.cpp#230-233 This patch does: - mark drag events caused by synthesized mouse events as "synthesized for tests" - make `synthesizePlainDragAndDrop()` stop using `nsIDragService.startDragSession()` - make `nsBaseDragService` initialize and start session even for synthesized `dragstart` event - make `synthesizePlainDragAndDrop()` stop synthesizing drag events with `DataTransfer` object since it's normal behavior and it'll be initialized with `nsIDragService::GetDataTransfer()` - make `nsBaseDragService` store `effectAllowed` for the session only when it's synthesized session because it's required at initializing synthesized default `dropEffect` value of `dragenter`, `dragover`, `dragexit` and `drop` events' `dataTransfer` - make all tests which use `nsIDragService.startDragSession()` use new API, `nsIDragService.startDragSessionForTests()` to initialize session's `effectAllowed` value - make `EventStateManager::PostHandleEvent()` set drag end point of the test session to `eDrop` event's screen point - make `synthesizePlainDragAndDrop()` set drag end point of the session if it does not synthesize `drop` event because following `endDragSession()` use it at dispatching `dragend` event on the source element Additionally, this adds `dumpFunc` new param to `synthesizePlainDragAndDrop()` because it's really useful to investigate the reason why requesting DnD isn't performed as expected. Differential Revision: https://phabricator.services.mozilla.com/D57425 --HG-- extra : moz-landing-system : lando
2019-12-21 15:27:06 +03:00
/**
* Sets drag end point of synthesized session when the test does not dispatch
* "drop" event.
*/
void setDragEndPointForTests(in long aScreenX, in long aScreenY);
};