Changeset 206282 in webkit
- Timestamp:
- Sep 22, 2016 4:53:33 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r206280 r206282 1 2016-09-22 Megan Gardner <megan_gardner@apple.com> 2 3 Add long press selection test 4 https://bugs.webkit.org/show_bug.cgi?id=162367 5 6 Reviewed by Simon Fraser. 7 8 Added test for long press selection. 9 10 * fast/events/touch/ios/long-press-to-select-text-expected.txt: Added. 11 * fast/events/touch/ios/long-press-to-select-text.html: Added. 12 1 13 2016-09-22 Brady Eidson <beidson@apple.com> 2 14 -
trunk/Tools/ChangeLog
r206261 r206282 1 2016-09-22 Megan Gardner <megan_gardner@apple.com> 2 3 Add long press selection test 4 https://bugs.webkit.org/show_bug.cgi?id=162367 5 6 Reviewed by Simon Fraser. 7 8 Add support to UIScriptController to synthesize long press events on iOS. 9 This required adding long-press functionality to HIDEventGenerator. 10 11 HIDEventGenerator sends the touchDown, but must then send the touchUp with 12 a dispatch_after (rather than sleeping, as we do for other events) in order 13 for the gesture recognizers to correctly detect a long press. 14 15 Use the long press synthesis in a test that detects whether a long press 16 gesture triggers text selection. 17 18 Fixed incorrect constants. NSTimeInterval is in seconds, original numbers 19 were nanoseconds and typedefed to long without regard to the type 20 differences. Redid constants to be the right value, and converted upon use. 21 22 Cleaned up unused enum types. 23 24 * DumpRenderTree/ios/UIScriptControllerIOS.mm: 25 (WTR::UIScriptController::longPressAtPoint): 26 (WTR::UIScriptController::forcePressAtPoint): 27 (WTR::UIScriptController::dragFromPointToPoint): Deleted. 28 * Scripts/webkitpy/common/config/contributors.json: 29 * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: 30 * TestRunnerShared/UIScriptContext/UIScriptController.cpp: 31 (WTR::UIScriptController::longPressAtPoint): 32 (WTR::UIScriptController::forcePressAtPoint): 33 (WTR::UIScriptController::dragFromPointToPoint): Deleted. 34 * TestRunnerShared/UIScriptContext/UIScriptController.h: 35 * WebKitTestRunner/ios/HIDEventGenerator.h: 36 * WebKitTestRunner/ios/HIDEventGenerator.mm: 37 (-[HIDEventGenerator _createIOHIDEventType:]): 38 (-[HIDEventGenerator sendTaps:location:withNumberOfTouches:completionBlock:]): 39 (-[HIDEventGenerator clearTap:]): 40 (-[HIDEventGenerator longPressTimerCall:]): 41 (-[HIDEventGenerator longPressFinish:completionBlock:]): 42 (-[HIDEventGenerator longPress:completionBlock:]): 43 (-[HIDEventGenerator forcePress:completionBlock:]): 44 * WebKitTestRunner/ios/UIScriptControllerIOS.mm: 45 (WTR::UIScriptController::longPressAtPoint): 46 (WTR::UIScriptController::forcePressAtPoint): 47 (WTR::UIScriptController::dragFromPointToPoint): Deleted. 48 1 49 2016-09-22 Jonathan Bedard <jbedard@apple.com> 2 50 -
trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm
r205572 r206282 86 86 87 87 void UIScriptController::dragFromPointToPoint(long startX, long startY, long endX, long endY, double durationSeconds, JSValueRef callback) 88 { 89 } 90 91 void UIScriptController::longPressAtPoint(long x, long y, JSValueRef) 88 92 { 89 93 } -
trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl
r205572 r206282 38 38 void doubleTapAtPoint(long x, long y, object callback); 39 39 void dragFromPointToPoint(long startX, long startY, long endX, long endY, double durationSeconds, object callback); 40 41 void longPressAtPoint(long x, long y, object callback); 40 42 41 43 void stylusDownAtPoint(long x, long y, float azimuthAngle, float altitudeAngle, float pressure, object callback); -
trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp
r205572 r206282 160 160 { 161 161 } 162 163 void UIScriptController::longPressAtPoint(long x, long y, JSValueRef) 164 { 165 } 162 166 163 167 void UIScriptController::stylusDownAtPoint(long x, long y, float azimuthAngle, float altitudeAngle, float pressure, JSValueRef callback) -
trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h
r205572 r206282 63 63 void stylusTapAtPoint(long x, long y, float azimuthAngle, float altitudeAngle, float pressure, JSValueRef callback); 64 64 65 void longPressAtPoint(long x, long y, JSValueRef callback); 66 65 67 void typeCharacterUsingHardwareKeyboard(JSStringRef character, JSValueRef callback); 66 68 void keyDownUsingHardwareKeyboard(JSStringRef character, JSValueRef callback); -
trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.h
r205572 r206282 47 47 - (void)twoFingerTap:(CGPoint)location completionBlock:(void (^)(void))completionBlock; 48 48 49 // Long Press 50 - (void)longPress:(CGPoint)location completionBlock:(void (^)(void))completionBlock; 51 49 52 // Drags 50 53 - (void)dragWithStartPoint:(CGPoint)startLocation endPoint:(CGPoint)endLocation duration:(double)seconds completionBlock:(void (^)(void))completionBlock; -
trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm
r205766 r206282 32 32 #import <mach/mach_time.h> 33 33 #import <wtf/Assertions.h> 34 #import <wtf/BlockPtr.h> 34 35 #import <wtf/RetainPtr.h> 35 36 … … 37 38 SOFT_LINK(BackBoardServices, BKSHIDEventSetDigitizerInfo, void, (IOHIDEventRef digitizerEvent, uint32_t contextID, uint8_t systemGestureisPossible, uint8_t isSystemGestureStateChangeEvent, CFStringRef displayUUID, CFTimeInterval initialTouchTimestamp, float maxForce), (digitizerEvent, contextID, systemGestureisPossible, isSystemGestureStateChangeEvent, displayUUID, initialTouchTimestamp, maxForce)); 38 39 39 static const NSTimeInterval fingerLiftDelay = 5e7;40 static const NSTimeInterval multiTapInterval = 15e7;40 static const NSTimeInterval fingerLiftDelay = 0.05; 41 static const NSTimeInterval multiTapInterval = 0.15; 41 42 static const NSTimeInterval fingerMoveInterval = 0.016; 43 static const NSTimeInterval longPressHoldDelay = 2.0; 42 44 static const IOHIDFloat defaultMajorRadius = 5; 43 45 static const IOHIDFloat defaultPathPressure = 0; … … 54 56 HandEventLifted, 55 57 HandEventCanceled, 56 HandEventInRange,57 HandEventInRangeLift,58 58 StylusEventTouched, 59 59 StylusEventMoved, … … 159 159 eventMask |= kIOHIDDigitizerEventPosition; 160 160 eventMask |= kIOHIDDigitizerEventAttribute; 161 } else if (eventType == HandEventTouched || eventType == HandEventCanceled) { 162 eventMask |= kIOHIDDigitizerEventIdentity; 163 } else if (eventType == HandEventLifted) 161 } else if (eventType == HandEventTouched || eventType == HandEventCanceled || eventType == HandEventLifted) 164 162 eventMask |= kIOHIDDigitizerEventIdentity; 165 163 … … 495 493 - (void)stylusTapAtPoint:(CGPoint)location azimuthAngle:(CGFloat)azimuthAngle altitudeAngle:(CGFloat)altitudeAngle pressure:(CGFloat)pressure completionBlock:(void (^)(void))completionBlock 496 494 { 497 struct timespec pressDelay = { 0, static_cast<long>(fingerLiftDelay ) };495 struct timespec pressDelay = { 0, static_cast<long>(fingerLiftDelay * nanosecondsPerSecond) }; 498 496 499 497 [self stylusDownAtPoint:location azimuthAngle:azimuthAngle altitudeAngle:altitudeAngle pressure:pressure]; … … 506 504 - (void)sendTaps:(int)tapCount location:(CGPoint)location withNumberOfTouches:(int)touchCount completionBlock:(void (^)(void))completionBlock 507 505 { 508 struct timespec doubleDelay = { 0, static_cast<long>(multiTapInterval ) };509 struct timespec pressDelay = { 0, static_cast<long>(fingerLiftDelay ) };506 struct timespec doubleDelay = { 0, static_cast<long>(multiTapInterval * nanosecondsPerSecond) }; 507 struct timespec pressDelay = { 0, static_cast<long>(fingerLiftDelay * nanosecondsPerSecond) }; 510 508 511 509 for (int i = 0; i < tapCount; i++) { … … 533 531 { 534 532 [self sendTaps:1 location:location withNumberOfTouches:2 completionBlock:completionBlock]; 533 } 534 535 - (void)longPress:(CGPoint)location completionBlock:(void (^)(void))completionBlock 536 { 537 [self touchDown:location touchCount:1]; 538 auto completionBlockCopy = makeBlockPtr(completionBlock); 539 540 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, longPressHoldDelay * nanosecondsPerSecond), dispatch_get_main_queue(), ^ { 541 [self liftUp:location]; 542 [self _sendMarkerHIDEventWithCompletionBlock:completionBlockCopy.get()]; 543 }); 535 544 } 536 545 -
trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm
r205572 r206282 188 188 }]; 189 189 } 190 191 void UIScriptController::longPressAtPoint(long x, long y, JSValueRef callback) 192 { 193 unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent); 194 195 [[HIDEventGenerator sharedHIDEventGenerator] longPress:globalToContentCoordinates(TestController::singleton().mainWebView()->platformView(), x, y) completionBlock:^{ 196 if (!m_context) 197 return; 198 m_context->asyncTaskComplete(callbackID); 199 }]; 200 } 190 201 191 202 void UIScriptController::typeCharacterUsingHardwareKeyboard(JSStringRef character, JSValueRef callback)
Note: See TracChangeset
for help on using the changeset viewer.