[iOS] Dispatch additional events along with pointerdown and pointerup
authorgraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Feb 2019 17:52:34 +0000 (17:52 +0000)
committergraouts@webkit.org <graouts@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Feb 2019 17:52:34 +0000 (17:52 +0000)
commit8204ba9da22092dd6fbc383cb94cd4497261a19a
treed296312e0164aa52a952f6561bded19d8a2deacf
parent253b7a3d71c0c30c106d358a0df8d45fefd8956a
[iOS] Dispatch additional events along with pointerdown and pointerup
https://bugs.webkit.org/show_bug.cgi?id=194776
<rdar://problem/48164284>

Reviewed by Brent Fulgham.

Source/WebCore:

The Pointer Events specification mandates that "pointerover" and "pointerenter" events precede a "pointerdown" event and that "pointerout"
and "pointerleave" events follow a "pointerup" event. We remove the EventHandler::dispatchPointerEventForTouchAtIndex() method and replace
it with a PointerCaptureController::dispatchEventForTouchAtIndex() that can handle the dispatch of such additional events correctly, also
allowing for two PointerCaptureController methods (pointerEventWillBeDispatched and pointerEventWasDispatched) to become private.

Test: pointerevents/ios/over-enter-out-leave.html

* dom/EventNames.h: Add the new "pointerover", "pointerenter", "pointerout" and "pointerleave" event types.
* dom/PointerEvent.h:
* dom/ios/PointerEventIOS.cpp:
(WebCore::PointerEvent::create):
* page/EventHandler.cpp:
(WebCore::EventHandler::dispatchPointerEventForTouchAtIndex): Deleted.
* page/EventHandler.h:
* page/PointerCaptureController.cpp:
(WebCore::PointerCaptureController::dispatchEventForTouchAtIndex): Take the existing code from EventHandler::dispatchPointerEventForTouchAtIndex()
and extend it to dispatch additional events as mandated. Since several events may be dispatched we check whether the dispatch of any of those events
had defaultPrevented() or defaultHanded() return true and return those values as a pair.
(WebCore::PointerCaptureController::pointerEventWasDispatched):
* page/PointerCaptureController.h:

LayoutTests:

Added a new test that checks that "pointerover" and "pointerenter" precede "pointerdown" and that "pointerout" and "pointerleave" follow "pointerup".

* pointerevents/ios/over-enter-out-leave-expected.txt: Added.
* pointerevents/ios/over-enter-out-leave.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241723 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/pointerevents/ios/over-enter-out-leave-expected.txt [new file with mode: 0644]
LayoutTests/pointerevents/ios/over-enter-out-leave.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/EventNames.h
Source/WebCore/dom/PointerEvent.h
Source/WebCore/dom/ios/PointerEventIOS.cpp
Source/WebCore/page/EventHandler.cpp
Source/WebCore/page/EventHandler.h
Source/WebCore/page/PointerCaptureController.cpp
Source/WebCore/page/PointerCaptureController.h