Bug 1403055 Part1: Revise the implementation to fire boundary events by handling pointercancel and pointerup. r=masayuki

We don't need to call GenerateMouseEnterExit twice when handling pointercancel. The second one is redundant since we do some checks in GenerateMouseEnterExit. And we should call GenerateMouseEnterExit before removing the entry in mPointersEnterLeaveHelper, which is used in GenerateMouseEnterExit.

MozReview-Commit-ID: 844bIFkPYfj
This commit is contained in:
Stone Shih 2017-09-26 12:02:34 +08:00
Родитель 92986dd48f
Коммит db10708428
1 изменённых файлов: 6 добавлений и 20 удалений

Просмотреть файл

@ -3202,34 +3202,20 @@ EventStateManager::PostHandleEvent(nsPresContext* aPresContext,
SetActiveManager(this, activeContent);
}
break;
case ePointerCancel: {
if(WidgetMouseEvent* pointerEvent = aEvent->AsPointerEvent()) {
// Implicitly releasing capture for given pointer. ePointerLostCapture
// should be send after ePointerUp or ePointerCancel.
PointerEventHandler::ImplicitlyReleasePointerCapture(pointerEvent);
GenerateMouseEnterExit(pointerEvent);
// After UP/Cancel Touch pointers become invalid so we can remove relevant
// helper from Table. Mouse/Pen pointers are valid all the time (not only
// between down/up)
if (pointerEvent->inputSource == nsIDOMMouseEvent::MOZ_SOURCE_TOUCH) {
mPointersEnterLeaveHelper.Remove(pointerEvent->pointerId);
GenerateMouseEnterExit(pointerEvent);
}
}
break;
}
case ePointerCancel:
case ePointerUp: {
WidgetPointerEvent* pointerEvent = aEvent->AsPointerEvent();
MOZ_ASSERT(pointerEvent);
// Implicitly releasing capture for given pointer. ePointerLostCapture
// should be send after ePointerUp or ePointerCancel.
PointerEventHandler::ImplicitlyReleasePointerCapture(pointerEvent);
// After UP/Cancel Touch pointers become invalid so we can remove relevant helper from Table
// Mouse/Pen pointers are valid all the time (not only between down/up)
if (pointerEvent->inputSource == nsIDOMMouseEvent::MOZ_SOURCE_TOUCH) {
mPointersEnterLeaveHelper.Remove(pointerEvent->pointerId);
// After UP/Cancel Touch pointers become invalid so we can remove relevant
// helper from Table Mouse/Pen pointers are valid all the time (not only
// between down/up)
GenerateMouseEnterExit(pointerEvent);
mPointersEnterLeaveHelper.Remove(pointerEvent->pointerId);
}
break;
}