mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 458613, set relatedTarget for dragenter and dragleave events, r=smaug,sr=roc
This commit is contained in:
parent
6205031244
commit
f661817f49
@ -77,13 +77,19 @@ NS_INTERFACE_MAP_END_INHERITING(nsDOMMouseEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMDragEvent::InitDragEvent(const nsAString & aType,
|
||||
PRBool aCanBubble,
|
||||
PRBool aCancelable,
|
||||
nsIDOMAbstractView* aView,
|
||||
PRInt32 aDetail,
|
||||
PRBool aCanBubble, PRBool aCancelable,
|
||||
nsIDOMAbstractView* aView, PRInt32 aDetail,
|
||||
PRInt32 aScreenX, PRInt32 aScreenY,
|
||||
PRInt32 aClientX, PRInt32 aClientY,
|
||||
PRBool aCtrlKey, PRBool aAltKey, PRBool aShiftKey,
|
||||
PRBool aMetaKey, PRUint16 aButton,
|
||||
nsIDOMEventTarget *aRelatedTarget,
|
||||
nsIDOMDataTransfer* aDataTransfer)
|
||||
{
|
||||
nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
|
||||
nsresult rv = nsDOMMouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable,
|
||||
aView, aDetail, aScreenX, aScreenY, aClientX, aClientY,
|
||||
aCtrlKey, aAltKey, aShiftKey, aMetaKey, aButton,
|
||||
aRelatedTarget);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (mEventIsInternal && mEvent) {
|
||||
@ -97,10 +103,13 @@ nsDOMDragEvent::InitDragEvent(const nsAString & aType,
|
||||
NS_IMETHODIMP
|
||||
nsDOMDragEvent::InitDragEventNS(const nsAString & aNamespaceURIArg,
|
||||
const nsAString & aType,
|
||||
PRBool aCanBubble,
|
||||
PRBool aCancelable,
|
||||
nsIDOMAbstractView* aView,
|
||||
PRInt32 aDetail,
|
||||
PRBool aCanBubble, PRBool aCancelable,
|
||||
nsIDOMAbstractView* aView, PRInt32 aDetail,
|
||||
PRInt32 aScreenX, PRInt32 aScreenY,
|
||||
PRInt32 aClientX, PRInt32 aClientY,
|
||||
PRBool aCtrlKey, PRBool aAltKey, PRBool aShiftKey,
|
||||
PRBool aMetaKey, PRUint16 aButton,
|
||||
nsIDOMEventTarget *aRelatedTarget,
|
||||
nsIDOMDataTransfer* aDataTransfer)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
@ -106,11 +106,12 @@ nsDOMMouseEvent::InitMouseEvent(const nsAString & aType, PRBool aCanBubble, PRBo
|
||||
{
|
||||
nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
switch(mEvent->eventStructType)
|
||||
{
|
||||
case NS_MOUSE_EVENT:
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
case NS_DRAG_EVENT:
|
||||
{
|
||||
static_cast<nsMouseEvent_base*>(mEvent)->relatedTarget = aRelatedTarget;
|
||||
static_cast<nsMouseEvent_base*>(mEvent)->button = aButton;
|
||||
@ -163,6 +164,7 @@ nsDOMMouseEvent::GetButton(PRUint16* aButton)
|
||||
{
|
||||
case NS_MOUSE_EVENT:
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
case NS_DRAG_EVENT:
|
||||
*aButton = static_cast<nsMouseEvent_base*>(mEvent)->button;
|
||||
break;
|
||||
default:
|
||||
@ -183,6 +185,7 @@ nsDOMMouseEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
|
||||
{
|
||||
case NS_MOUSE_EVENT:
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
case NS_DRAG_EVENT:
|
||||
relatedTarget = static_cast<nsMouseEvent_base*>(mEvent)->relatedTarget;
|
||||
break;
|
||||
default:
|
||||
|
@ -54,12 +54,14 @@ function afterDragTests()
|
||||
var evt = document.createEvent("dragevent");
|
||||
ok(evt instanceof DragEvent, "synthetic dragevent class")
|
||||
ok(evt instanceof MouseEvent, "synthetic event inherits from MouseEvent")
|
||||
evt.initDragEvent("dragstart", true, true, window, 1, null);
|
||||
evt.initDragEvent("dragstart", true, true, window, 1, 40, 35, 20, 15,
|
||||
false, true, false, false, 0, null, null);
|
||||
$("synthetic").dispatchEvent(evt);
|
||||
|
||||
var evt = document.createEvent("dragevents");
|
||||
ok(evt instanceof DragEvent, "synthetic dragevents class")
|
||||
evt.initDragEvent("dragover", true, true, window, 0, null);
|
||||
evt.initDragEvent("dragover", true, true, window, 0, 40, 35, 20, 15,
|
||||
true, false, true, true, 2, document.documentElement, null);
|
||||
$("synthetic2").dispatchEvent(evt);
|
||||
|
||||
// next, dragging links and images
|
||||
@ -434,13 +436,22 @@ function doDragStartInput(event)
|
||||
function doDragStartSynthetic(event)
|
||||
{
|
||||
is(event.type, "dragstart", "synthetic dragstart event type");
|
||||
return;
|
||||
var dt = event.dataTransfer;
|
||||
ok(dt instanceof DataTransfer, "synthetic dragstart dataTransfer is DataTransfer");
|
||||
|
||||
checkTypes(dt, [], 0, "synthetic dragstart");
|
||||
var dt = event.dataTransfer;
|
||||
// ok(dt instanceof DataTransfer, "synthetic dragstart dataTransfer is DataTransfer");
|
||||
// checkTypes(dt, [], 0, "synthetic dragstart");
|
||||
|
||||
is(event.detail, 1, "synthetic dragstart detail");
|
||||
is(event.screenX, 40, "synthetic dragstart screenX");
|
||||
is(event.screenY, 35, "synthetic dragstart screenY");
|
||||
is(event.clientX, 20, "synthetic dragstart clientX");
|
||||
is(event.clientY, 15, "synthetic dragstart clientY");
|
||||
is(event.ctrlKey, false, "synthetic dragstart ctrlKey");
|
||||
is(event.altKey, true, "synthetic dragstart altKey");
|
||||
is(event.shiftKey, false, "synthetic dragstart shiftKey");
|
||||
is(event.metaKey, false, "synthetic dragstart metaKey");
|
||||
is(event.button, 0, "synthetic dragstart button ");
|
||||
is(event.relatedTarget, null, "synthetic dragstart relatedTarget");
|
||||
|
||||
dt.setData("text/plain", "Text");
|
||||
is(dt.getData("text/plain"), "Text", "synthetic dragstart data is set after adding");
|
||||
@ -449,12 +460,22 @@ return;
|
||||
function doDragOverSynthetic(event)
|
||||
{
|
||||
is(event.type, "dragover", "synthetic dragover event type");
|
||||
return;
|
||||
|
||||
var dt = event.dataTransfer;
|
||||
ok(dt instanceof DataTransfer, "synthetic dragover dataTransfer is DataTransfer");
|
||||
// ok(dt instanceof DataTransfer, "synthetic dragover dataTransfer is DataTransfer");
|
||||
// checkTypes(dt, [], 0, "synthetic dragover");
|
||||
|
||||
checkTypes(dt, [], 0, "synthetic dragover");
|
||||
is(event.detail, 0, "synthetic dragover detail");
|
||||
is(event.screenX, 40, "synthetic dragover screenX");
|
||||
is(event.screenY, 35, "synthetic dragover screenY");
|
||||
is(event.clientX, 20, "synthetic dragover clientX");
|
||||
is(event.clientY, 15, "synthetic dragover clientY");
|
||||
is(event.ctrlKey, true, "synthetic dragover ctrlKey");
|
||||
is(event.altKey, false, "synthetic dragover altKey");
|
||||
is(event.shiftKey, true, "synthetic dragover shiftKey");
|
||||
is(event.metaKey, true, "synthetic dragover metaKey");
|
||||
is(event.button, 2, "synthetic dragover button");
|
||||
is(event.relatedTarget, document.documentElement, "synthetic dragover relatedTarget");
|
||||
|
||||
dt.setData("text/plain", "Text");
|
||||
is(dt.getData("text/plain"), "Text", "synthetic dragover data is set after adding");
|
||||
|
@ -41,7 +41,7 @@
|
||||
interface nsIDOMAbstractView;
|
||||
interface nsIDOMDataTransfer;
|
||||
|
||||
[scriptable, uuid(18FEEFD7-A461-4865-BCF1-4DC8A2F30584)]
|
||||
[scriptable, uuid(D52CF140-FB90-44DF-8D69-4B2BAB4D461F)]
|
||||
interface nsIDOMDragEvent : nsIDOMMouseEvent
|
||||
{
|
||||
readonly attribute nsIDOMDataTransfer dataTransfer;
|
||||
@ -50,7 +50,17 @@ interface nsIDOMDragEvent : nsIDOMMouseEvent
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in nsIDOMAbstractView aView,
|
||||
in PRInt32 aDetail,
|
||||
in long aDetail,
|
||||
in long aScreenX,
|
||||
in long aScreenY,
|
||||
in long aClientX,
|
||||
in long aClientY,
|
||||
in boolean aCtrlKey,
|
||||
in boolean aAltKey,
|
||||
in boolean aShiftKey,
|
||||
in boolean aMetaKey,
|
||||
in unsigned short aButton,
|
||||
in nsIDOMEventTarget aRelatedTarget,
|
||||
in nsIDOMDataTransfer aDataTransfer);
|
||||
|
||||
void initDragEventNS(in DOMString namespaceURIArg,
|
||||
@ -58,6 +68,16 @@ interface nsIDOMDragEvent : nsIDOMMouseEvent
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in nsIDOMAbstractView aView,
|
||||
in PRInt32 aDetail,
|
||||
in long aDetail,
|
||||
in long aScreenX,
|
||||
in long aScreenY,
|
||||
in long aClientX,
|
||||
in long aClientY,
|
||||
in boolean aCtrlKey,
|
||||
in boolean aAltKey,
|
||||
in boolean aShiftKey,
|
||||
in boolean aMetaKey,
|
||||
in unsigned short aButton,
|
||||
in nsIDOMEventTarget aRelatedTarget,
|
||||
in nsIDOMDataTransfer aDataTransfer);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user