Expose Apple Pencil data to Touch events
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Sep 2016 20:57:50 +0000 (20:57 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 9 Sep 2016 20:57:50 +0000 (20:57 +0000)
commit5387fcc9612b8bec8407fbaf4895252ecca5d246
tree3393a916a4d7ac4e1704be9c89ed8f1a78adc956
parente05acf9db974e440fcdda4c140ed3b1ce9a8c339
Expose Apple Pencil data to Touch events
https://bugs.webkit.org/show_bug.cgi?id=161783
<rdar://problem/28218898>

Reviewed by Beth Dakin.

Source/WebKit2:

* Platform/spi/ios/UIKitSPI.h: Expose the new SPI. Since this is only used
on public builds, guard it against everything that is <= iOS 10.0.
* Shared/WebEvent.h: New properties.
(WebKit::WebPlatformTouchPoint::setAltitudeAngle):
(WebKit::WebPlatformTouchPoint::altitudeAngle):
(WebKit::WebPlatformTouchPoint::setAzimuthAngle):
(WebKit::WebPlatformTouchPoint::azimuthAngle):
(WebKit::WebPlatformTouchPoint::setTouchType):
(WebKit::WebPlatformTouchPoint::touchType):
(WebKit::WebPlatformTouchPoint::force): Deleted.
* Shared/WebEventConversion.cpp:
(WebKit::webPlatformTouchTypeToPlatform):
(WebKit::WebKit2PlatformTouchPoint::WebKit2PlatformTouchPoint): More
parameters sent to parent constructor.
* Shared/ios/NativeWebTouchEventIOS.mm:
(WebKit::convertTouchType):
(WebKit::NativeWebTouchEvent::extractWebTouchPoint):
* Shared/ios/WebPlatformTouchPointIOS.cpp:
(WebKit::WebPlatformTouchPoint::encode):
(WebKit::WebPlatformTouchPoint::decode):

Tools:

The values that IOHID expects are different from their
documentation, and from what UITouch interprets. Tweak
incoming data so it will produce the output we expect.

* WebKitTestRunner/ios/HIDEventGenerator.mm:
(-[HIDEventGenerator stylusDownAtPoint:azimuthAngle:altitudeAngle:pressure:]):
(-[HIDEventGenerator stylusMoveToPoint:azimuthAngle:altitudeAngle:pressure:]):

LayoutTests:

Four new tests that check data coming out of an Apple Pencil.

* fast/events/touch/ios/pencil-data-change-does-not-give-touchmove-expected.txt: Added.
* fast/events/touch/ios/pencil-data-change-does-not-give-touchmove.html: Added.
* fast/events/touch/ios/pencil-data-change-gives-touchforcechange-expected.txt: Added.
* fast/events/touch/ios/pencil-data-change-gives-touchforcechange.html: Added.
* fast/events/touch/ios/pencil-move-provides-stylus-data-expected.txt: Added.
* fast/events/touch/ios/pencil-move-provides-stylus-data.html: Added.
* fast/events/touch/ios/pencil-touch-registered-as-pencil-expected.txt: Added.
* fast/events/touch/ios/pencil-touch-registered-as-pencil.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205766 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/events/touch/ios/pencil-data-change-does-not-give-touchmove-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/touch/ios/pencil-data-change-does-not-give-touchmove.html [new file with mode: 0644]
LayoutTests/fast/events/touch/ios/pencil-data-change-gives-touchforcechange-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/touch/ios/pencil-data-change-gives-touchforcechange.html [new file with mode: 0644]
LayoutTests/fast/events/touch/ios/pencil-move-provides-stylus-data-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/touch/ios/pencil-move-provides-stylus-data.html [new file with mode: 0644]
LayoutTests/fast/events/touch/ios/pencil-touch-registered-as-pencil-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/touch/ios/pencil-touch-registered-as-pencil.html [new file with mode: 0644]
Source/WebKit2/ChangeLog
Source/WebKit2/Platform/spi/ios/UIKitSPI.h
Source/WebKit2/Shared/WebEvent.h
Source/WebKit2/Shared/WebEventConversion.cpp
Source/WebKit2/Shared/ios/NativeWebTouchEventIOS.mm
Source/WebKit2/Shared/ios/WebPlatformTouchPointIOS.cpp
Tools/ChangeLog
Tools/WebKitTestRunner/ios/HIDEventGenerator.mm