Changeset 205766 in webkit
- Timestamp:
- Sep 9, 2016 1:57:50 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 8 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r205765 r205766 1 2016-09-08 Dean Jackson <dino@apple.com> 2 3 Expose Apple Pencil data to Touch events 4 https://bugs.webkit.org/show_bug.cgi?id=161783 5 <rdar://problem/28218898> 6 7 Reviewed by Beth Dakin. 8 9 Four new tests that check data coming out of an Apple Pencil. 10 11 * fast/events/touch/ios/pencil-data-change-does-not-give-touchmove-expected.txt: Added. 12 * fast/events/touch/ios/pencil-data-change-does-not-give-touchmove.html: Added. 13 * fast/events/touch/ios/pencil-data-change-gives-touchforcechange-expected.txt: Added. 14 * fast/events/touch/ios/pencil-data-change-gives-touchforcechange.html: Added. 15 * fast/events/touch/ios/pencil-move-provides-stylus-data-expected.txt: Added. 16 * fast/events/touch/ios/pencil-move-provides-stylus-data.html: Added. 17 * fast/events/touch/ios/pencil-touch-registered-as-pencil-expected.txt: Added. 18 * fast/events/touch/ios/pencil-touch-registered-as-pencil.html: Added. 19 1 20 2016-09-09 Tim Horton <timothy_horton@apple.com> 2 21 -
trunk/Source/WebKit2/ChangeLog
r205765 r205766 1 2016-09-08 Dean Jackson <dino@apple.com> 2 3 Expose Apple Pencil data to Touch events 4 https://bugs.webkit.org/show_bug.cgi?id=161783 5 <rdar://problem/28218898> 6 7 Reviewed by Beth Dakin. 8 9 * Platform/spi/ios/UIKitSPI.h: Expose the new SPI. Since this is only used 10 on public builds, guard it against everything that is <= iOS 10.0. 11 * Shared/WebEvent.h: New properties. 12 (WebKit::WebPlatformTouchPoint::setAltitudeAngle): 13 (WebKit::WebPlatformTouchPoint::altitudeAngle): 14 (WebKit::WebPlatformTouchPoint::setAzimuthAngle): 15 (WebKit::WebPlatformTouchPoint::azimuthAngle): 16 (WebKit::WebPlatformTouchPoint::setTouchType): 17 (WebKit::WebPlatformTouchPoint::touchType): 18 (WebKit::WebPlatformTouchPoint::force): Deleted. 19 * Shared/WebEventConversion.cpp: 20 (WebKit::webPlatformTouchTypeToPlatform): 21 (WebKit::WebKit2PlatformTouchPoint::WebKit2PlatformTouchPoint): More 22 parameters sent to parent constructor. 23 * Shared/ios/NativeWebTouchEventIOS.mm: 24 (WebKit::convertTouchType): 25 (WebKit::NativeWebTouchEvent::extractWebTouchPoint): 26 * Shared/ios/WebPlatformTouchPointIOS.cpp: 27 (WebKit::WebPlatformTouchPoint::encode): 28 (WebKit::WebPlatformTouchPoint::decode): 29 1 30 2016-09-09 Tim Horton <timothy_horton@apple.com> 2 31 -
trunk/Source/WebKit2/Platform/spi/ios/UIKitSPI.h
r205531 r205766 644 644 } UIWebTouchEventType; 645 645 646 typedef enum { 647 UIWebTouchPointTypeDirect = 0, 648 UIWebTouchPointTypeStylus 649 } UIWebTouchPointType; 650 646 651 struct _UIWebTouchPoint { 647 652 CGPoint locationInScreenCoordinates; … … 649 654 unsigned identifier; 650 655 UITouchPhase phase; 651 CGFloat majorRadiusInScreenCoordinates; 656 #if __IPHONE_OS_VERSION_MIN_REQUIRED > 100000 657 CGFloat force; 658 CGFloat altitudeAngle; 659 CGFloat azimuthAngle; 660 UIWebTouchPointType touchType; 661 #endif 652 662 }; 653 663 -
trunk/Source/WebKit2/Shared/WebEvent.h
r204668 r205766 307 307 }; 308 308 309 enum class TouchType { 310 Direct, 311 Stylus 312 }; 313 309 314 WebPlatformTouchPoint() { } 310 315 WebPlatformTouchPoint(unsigned identifier, WebCore::IntPoint location, TouchPointState phase) … … 323 328 void setForce(double force) { m_force = force; } 324 329 double force() const { return m_force; } 330 void setAltitudeAngle(double altitudeAngle) { m_altitudeAngle = altitudeAngle; } 331 double altitudeAngle() const { return m_altitudeAngle; } 332 void setAzimuthAngle(double azimuthAngle) { m_azimuthAngle = azimuthAngle; } 333 double azimuthAngle() const { return m_azimuthAngle; } 334 void setTouchType(TouchType touchType) { m_touchType = static_cast<uint32_t>(touchType); } 335 TouchType touchType() const { return static_cast<TouchType>(m_touchType); } 325 336 #endif 326 337 … … 334 345 #if ENABLE(IOS_TOUCH_EVENTS) 335 346 double m_force { 0 }; 347 double m_altitudeAngle { 0 }; 348 double m_azimuthAngle { 0 }; 349 uint32_t m_touchType { static_cast<uint32_t>(TouchType::Direct) }; 336 350 #endif 337 351 }; -
trunk/Source/WebKit2/Shared/WebEventConversion.cpp
r191299 r205766 244 244 } 245 245 246 static WebCore::PlatformTouchPoint::TouchType webPlatformTouchTypeToPlatform(const WebPlatformTouchPoint::TouchType& webTouchType) 247 { 248 switch (webTouchType) { 249 case WebPlatformTouchPoint::TouchType::Direct: 250 return WebCore::PlatformTouchPoint::TouchType::Direct; 251 case WebPlatformTouchPoint::TouchType::Stylus: 252 return WebCore::PlatformTouchPoint::TouchType::Stylus; 253 } 254 } 255 246 256 class WebKit2PlatformTouchPoint : public WebCore::PlatformTouchPoint { 247 257 public: … … 249 259 : PlatformTouchPoint(webTouchPoint.identifier(), webTouchPoint.location(), touchEventType(webTouchPoint) 250 260 #if ENABLE(IOS_TOUCH_EVENTS) 251 , webTouchPoint.force()261 , webTouchPoint.force(), webTouchPoint.altitudeAngle(), webTouchPoint.azimuthAngle(), webPlatformTouchTypeToPlatform(webTouchPoint.touchType()) 252 262 #endif 253 263 ) -
trunk/Source/WebKit2/Shared/ios/NativeWebTouchEventIOS.mm
r190841 r205766 71 71 } 72 72 73 #if defined UI_WEB_TOUCH_EVENT_HAS_STYLUS_DATA && UI_WEB_TOUCH_EVENT_HAS_STYLUS_DATA 74 static WebPlatformTouchPoint::TouchType convertTouchType(UIWebTouchPointType touchType) 75 { 76 switch (touchType) { 77 case UIWebTouchPointTypeDirect: 78 return WebPlatformTouchPoint::TouchType::Direct; 79 case UIWebTouchPointTypeStylus: 80 return WebPlatformTouchPoint::TouchType::Stylus; 81 default: 82 ASSERT_NOT_REACHED(); 83 return WebPlatformTouchPoint::TouchType::Direct; 84 } 85 } 86 #endif 87 73 88 static inline WebCore::IntPoint positionForCGPoint(CGPoint position) 74 89 { … … 90 105 #if ENABLE(IOS_TOUCH_EVENTS) 91 106 platformTouchPoint.setForce(touchPoint.force); 107 #if defined UI_WEB_TOUCH_EVENT_HAS_STYLUS_DATA && UI_WEB_TOUCH_EVENT_HAS_STYLUS_DATA 108 platformTouchPoint.setAltitudeAngle(touchPoint.altitudeAngle); 109 platformTouchPoint.setAzimuthAngle(touchPoint.azimuthAngle); 110 platformTouchPoint.setTouchType(convertTouchType(touchPoint.touchType)); 111 #endif 92 112 #endif 93 113 touchPointList.uncheckedAppend(platformTouchPoint); -
trunk/Source/WebKit2/Shared/ios/WebPlatformTouchPointIOS.cpp
r204743 r205766 42 42 #if ENABLE(IOS_TOUCH_EVENTS) 43 43 encoder << m_force; 44 encoder << m_altitudeAngle; 45 encoder << m_azimuthAngle; 46 encoder << m_touchType; 44 47 #endif 45 48 } … … 56 59 if (!decoder.decode(result.m_force)) 57 60 return false; 61 if (!decoder.decode(result.m_altitudeAngle)) 62 return false; 63 if (!decoder.decode(result.m_azimuthAngle)) 64 return false; 65 if (!decoder.decode(result.m_touchType)) 66 return false; 58 67 #endif 59 68 return true; -
trunk/Tools/ChangeLog
r205764 r205766 1 2016-09-08 Dean Jackson <dino@apple.com> 2 3 Expose Apple Pencil data to Touch events 4 https://bugs.webkit.org/show_bug.cgi?id=161783 5 <rdar://problem/28218898> 6 7 Reviewed by Beth Dakin. 8 9 The values that IOHID expects are different from their 10 documentation, and from what UITouch interprets. Tweak 11 incoming data so it will produce the output we expect. 12 13 * WebKitTestRunner/ios/HIDEventGenerator.mm: 14 (-[HIDEventGenerator stylusDownAtPoint:azimuthAngle:altitudeAngle:pressure:]): 15 (-[HIDEventGenerator stylusMoveToPoint:azimuthAngle:altitudeAngle:pressure:]): 16 1 17 2016-09-09 JF Bastien <jfbastien@apple.com> 2 18 -
trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm
r205585 r205766 435 435 _activePoints[0].point = location; 436 436 _activePoints[0].isStylus = YES; 437 _activePoints[0].pathPressure = pressure; 438 _activePoints[0].azimuthAngle = azimuthAngle; 439 _activePoints[0].altitudeAngle = altitudeAngle; 437 438 // At the time of writing, the IOKit documentation isn't always correct. For example 439 // it says that pressure is a value [0,1], but in practice it is [0,500] for stylus 440 // data. It does not mention that the azimuth angle is offset from a full rotation. 441 // Also, UIKit and IOHID interpret the altitude as different adjacent angles. 442 _activePoints[0].pathPressure = pressure * 500; 443 _activePoints[0].azimuthAngle = M_PI * 2 - azimuthAngle; 444 _activePoints[0].altitudeAngle = M_PI_2 - altitudeAngle; 440 445 441 446 RetainPtr<IOHIDEventRef> eventRef = adoptCF([self _createIOHIDEventType:StylusEventTouched]); … … 448 453 _activePoints[0].point = location; 449 454 _activePoints[0].isStylus = YES; 450 _activePoints[0].pathPressure = pressure; 451 _activePoints[0].azimuthAngle = azimuthAngle; 452 _activePoints[0].altitudeAngle = altitudeAngle; 455 // See notes above for details on these calculations. 456 _activePoints[0].pathPressure = pressure * 500; 457 _activePoints[0].azimuthAngle = M_PI * 2 - azimuthAngle; 458 _activePoints[0].altitudeAngle = M_PI_2 - altitudeAngle; 453 459 454 460 RetainPtr<IOHIDEventRef> eventRef = adoptCF([self _createIOHIDEventType:StylusEventMoved]);
Note: See TracChangeset
for help on using the changeset viewer.