зеркало из https://github.com/mozilla/gecko-dev.git
Bug 974177 - PointerCancel must trigger PointerOut event. r=smaug
--HG-- extra : rebase_source : cd88e856cbae08f21aed564899195f9697053f3a
This commit is contained in:
Родитель
f26c3eae26
Коммит
642a56c268
|
@ -1094,6 +1094,11 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
|||
}
|
||||
break;
|
||||
}
|
||||
case NS_POINTER_CANCEL:
|
||||
{
|
||||
GenerateMouseEnterExit(mouseEvent);
|
||||
break;
|
||||
}
|
||||
case NS_MOUSE_EXIT:
|
||||
// If the event is not a top-level window exit, then it's not
|
||||
// really an exit --- we may have traversed widget boundaries but
|
||||
|
@ -4440,6 +4445,7 @@ nsEventStateManager::GenerateMouseEnterExit(WidgetMouseEvent* aMouseEvent)
|
|||
}
|
||||
break;
|
||||
case NS_POINTER_LEAVE:
|
||||
case NS_POINTER_CANCEL:
|
||||
case NS_MOUSE_EXIT:
|
||||
{
|
||||
// This is actually the window mouse exit or pointer leave event. We're not moving
|
||||
|
|
|
@ -263,6 +263,36 @@ function runTests() {
|
|||
};
|
||||
sendTouchEvent(cwu, "touchmove", getTouchEventForTarget(d1, cwu, 2), 0);
|
||||
|
||||
// Test for cancel trigger pointerOut (Touch Pointer must be at d1 now)
|
||||
pointerCancelTriggered = 0;
|
||||
var pointerOutTriggeredForCancelEvent = 0;
|
||||
var pointerLeaveTriggeredForCancelEvent = 0;
|
||||
d1.onpointerout = function(e) {
|
||||
if (pointerOutTriggeredForCancelEvent == 0) {
|
||||
is(e.pointerId, 3, "Wrong Pointer type, should be id from Touch event");
|
||||
is(e.pointerType, "touch", "Wrong Pointer type, should be touch type");
|
||||
} else {
|
||||
is(e.pointerId, 0, "Wrong Pointer type, should be id from mouse event");
|
||||
is(e.pointerType, "mouse", "Wrong Pointer type, should be mouse type");
|
||||
}
|
||||
pointerOutTriggeredForCancelEvent = 1;
|
||||
};
|
||||
d1.onpointerleave = function(e) {
|
||||
is(pointerOutTriggeredForCancelEvent, 1, "Pointer Out must be dispatched bedore Pointer leave");
|
||||
if (pointerLeaveTriggeredForCancelEvent == 0) {
|
||||
is(e.pointerId, 3, "Wrong Pointer type, should be id from Touch event");
|
||||
is(e.pointerType, "touch", "Wrong Pointer type, should be touch type");
|
||||
} else {
|
||||
is(e.pointerId, 0, "Wrong Pointer type, should be id from mouse event");
|
||||
is(e.pointerType, "mouse", "Wrong Pointer type, should be mouse type");
|
||||
}
|
||||
pointerLeaveTriggeredForCancelEvent = 1;
|
||||
}
|
||||
|
||||
sendTouchEvent(cwu, "touchcancel", getTouchEventForTarget(d1, cwu, 3), 0);
|
||||
is(pointerOutTriggeredForCancelEvent, 1, "Pointer Out not dispatched on PointerCancel");
|
||||
is(pointerLeaveTriggeredForCancelEvent, 1, "Pointer Leave not dispatched on PointerCancel");
|
||||
|
||||
finishTest();
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче