Changeset 205572 in webkit


Ignore:
Timestamp:
Sep 7, 2016 4:32:08 PM (8 years ago)
Author:
dino@apple.com
Message:

Expose Apple Pencil input to testing system
https://bugs.webkit.org/show_bug.cgi?id=161670
<rdar://problem/28183327>

Reviewed by Simon Fraser.

Tools:

Add API to UIScriptController that allows a test to emulate
stylus input, such as from the Apple Pencil.

The code is only implemented for WebKitTestRunner.

There are also four new tests that ensure an Apple Pencil
operates similarly to a regular touch. The main difference
is that you can't have multiple touches when using an Apple Pencil.

  • DumpRenderTree/ios/UIScriptControllerIOS.mm: New methods. Empty implementations.

(WTR::UIScriptController::stylusDownAtPoint):
(WTR::UIScriptController::stylusMoveToPoint):
(WTR::UIScriptController::stylusUpAtPoint):
(WTR::UIScriptController::stylusTapAtPoint):

  • TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: New methods.
  • TestRunnerShared/UIScriptContext/UIScriptController.cpp: Empty implementations.

(WTR::UIScriptController::stylusDownAtPoint):
(WTR::UIScriptController::stylusMoveToPoint):
(WTR::UIScriptController::stylusUpAtPoint):
(WTR::UIScriptController::stylusTapAtPoint):

  • TestRunnerShared/UIScriptContext/UIScriptController.h:
  • WebKitTestRunner/ios/HIDEventGenerator.h:
  • WebKitTestRunner/ios/HIDEventGenerator.mm: New StylusEvent types. Add some properties

to SyntheticEventDigitizerInfo.
(-[HIDEventGenerator _createIOHIDEventType:]): Add support for StylusEvent types.
(-[HIDEventGenerator touchDownAtPoints:touchCount:]): Clear any old stylus info.
(-[HIDEventGenerator stylusDownAtPoint:azimuthAngle:altitudeAngle:pressure:]):
(-[HIDEventGenerator stylusMoveToPoint:azimuthAngle:altitudeAngle:pressure:]):
(-[HIDEventGenerator stylusUpAtPoint:]):
(-[HIDEventGenerator stylusDownAtPoint:azimuthAngle:altitudeAngle:pressure:completionBlock:]):
(-[HIDEventGenerator stylusMoveToPoint:azimuthAngle:altitudeAngle:pressure:completionBlock:]):
(-[HIDEventGenerator stylusUpAtPoint:completionBlock:]):
(-[HIDEventGenerator stylusTapAtPoint:azimuthAngle:altitudeAngle:pressure:completionBlock:]):

  • WebKitTestRunner/ios/IOKitSPI.h: Add new include, and new SPI.
  • WebKitTestRunner/ios/UIScriptControllerIOS.mm: Calls into the HIDEventGenerator for the new API.

(WTR::UIScriptController::stylusDownAtPoint):
(WTR::UIScriptController::stylusMoveToPoint):
(WTR::UIScriptController::stylusUpAtPoint):
(WTR::UIScriptController::stylusTapAtPoint):

LayoutTests:

Four new tests that make sure Apple Pencil's register the correct
touch* style events.

  • fast/events/touch/ios/pencil-down-gives-touchstart-expected.txt: Added.
  • fast/events/touch/ios/pencil-down-gives-touchstart.html: Added.
  • fast/events/touch/ios/pencil-move-gives-touchmove-expected.txt: Added.
  • fast/events/touch/ios/pencil-move-gives-touchmove.html: Added.
  • fast/events/touch/ios/pencil-tap-gives-touchstart-and-touchend-expected.txt: Added.
  • fast/events/touch/ios/pencil-tap-gives-touchstart-and-touchend.html: Added.
  • fast/events/touch/ios/pencil-up-gives-touchend-expected.txt: Added.
  • fast/events/touch/ios/pencil-up-gives-touchend.html: Added.
Location:
trunk
Files:
8 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r205568 r205572  
     12016-09-06  Dean Jackson  <dino@apple.com>
     2
     3        Expose Apple Pencil input to testing system
     4        https://bugs.webkit.org/show_bug.cgi?id=161670
     5        <rdar://problem/28183327>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Four new tests that make sure Apple Pencil's register the correct
     10        touch* style events.
     11
     12        * fast/events/touch/ios/pencil-down-gives-touchstart-expected.txt: Added.
     13        * fast/events/touch/ios/pencil-down-gives-touchstart.html: Added.
     14        * fast/events/touch/ios/pencil-move-gives-touchmove-expected.txt: Added.
     15        * fast/events/touch/ios/pencil-move-gives-touchmove.html: Added.
     16        * fast/events/touch/ios/pencil-tap-gives-touchstart-and-touchend-expected.txt: Added.
     17        * fast/events/touch/ios/pencil-tap-gives-touchstart-and-touchend.html: Added.
     18        * fast/events/touch/ios/pencil-up-gives-touchend-expected.txt: Added.
     19        * fast/events/touch/ios/pencil-up-gives-touchend.html: Added.
     20
    1212016-09-07  Andy VanWagoner  <thetalecrafter@gmail.com>
    222
  • trunk/Tools/ChangeLog

    r205560 r205572  
     12016-09-06  Dean Jackson  <dino@apple.com>
     2
     3        Expose Apple Pencil input to testing system
     4        https://bugs.webkit.org/show_bug.cgi?id=161670
     5        <rdar://problem/28183327>
     6
     7        Reviewed by Simon Fraser.
     8
     9        Add API to UIScriptController that allows a test to emulate
     10        stylus input, such as from the Apple Pencil.
     11
     12        The code is only implemented for WebKitTestRunner.
     13
     14        There are also four new tests that ensure an Apple Pencil
     15        operates similarly to a regular touch. The main difference
     16        is that you can't have multiple touches when using an Apple Pencil.
     17
     18        * DumpRenderTree/ios/UIScriptControllerIOS.mm: New methods. Empty implementations.
     19        (WTR::UIScriptController::stylusDownAtPoint):
     20        (WTR::UIScriptController::stylusMoveToPoint):
     21        (WTR::UIScriptController::stylusUpAtPoint):
     22        (WTR::UIScriptController::stylusTapAtPoint):
     23        * TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl: New methods.
     24        * TestRunnerShared/UIScriptContext/UIScriptController.cpp: Empty implementations.
     25        (WTR::UIScriptController::stylusDownAtPoint):
     26        (WTR::UIScriptController::stylusMoveToPoint):
     27        (WTR::UIScriptController::stylusUpAtPoint):
     28        (WTR::UIScriptController::stylusTapAtPoint):
     29        * TestRunnerShared/UIScriptContext/UIScriptController.h:
     30
     31        * WebKitTestRunner/ios/HIDEventGenerator.h:
     32        * WebKitTestRunner/ios/HIDEventGenerator.mm: New StylusEvent types. Add some properties
     33        to SyntheticEventDigitizerInfo.
     34        (-[HIDEventGenerator _createIOHIDEventType:]): Add support for StylusEvent types.
     35        (-[HIDEventGenerator touchDownAtPoints:touchCount:]): Clear any old stylus info.
     36        (-[HIDEventGenerator stylusDownAtPoint:azimuthAngle:altitudeAngle:pressure:]):
     37        (-[HIDEventGenerator stylusMoveToPoint:azimuthAngle:altitudeAngle:pressure:]):
     38        (-[HIDEventGenerator stylusUpAtPoint:]):
     39        (-[HIDEventGenerator stylusDownAtPoint:azimuthAngle:altitudeAngle:pressure:completionBlock:]):
     40        (-[HIDEventGenerator stylusMoveToPoint:azimuthAngle:altitudeAngle:pressure:completionBlock:]):
     41        (-[HIDEventGenerator stylusUpAtPoint:completionBlock:]):
     42        (-[HIDEventGenerator stylusTapAtPoint:azimuthAngle:altitudeAngle:pressure:completionBlock:]):
     43        * WebKitTestRunner/ios/IOKitSPI.h: Add new include, and new SPI.
     44        * WebKitTestRunner/ios/UIScriptControllerIOS.mm: Calls into the HIDEventGenerator for the new API.
     45        (WTR::UIScriptController::stylusDownAtPoint):
     46        (WTR::UIScriptController::stylusMoveToPoint):
     47        (WTR::UIScriptController::stylusUpAtPoint):
     48        (WTR::UIScriptController::stylusTapAtPoint):
     49
    1502016-09-07  Daniel Bates  <dabates@apple.com>
    251
  • trunk/Tools/DumpRenderTree/ios/UIScriptControllerIOS.mm

    r204955 r205572  
    8989}
    9090
     91void UIScriptController::stylusDownAtPoint(long x, long y, float azimuthAngle, float altitudeAngle, float pressure, JSValueRef callback)
     92{
     93}
     94
     95void UIScriptController::stylusMoveToPoint(long x, long y, float azimuthAngle, float altitudeAngle, float pressure, JSValueRef callback)
     96{
     97}
     98
     99void UIScriptController::stylusUpAtPoint(long x, long y, JSValueRef callback)
     100{
     101}
     102
     103void UIScriptController::stylusTapAtPoint(long x, long y, float azimuthAngle, float altitudeAngle, float pressure, JSValueRef callback)
     104{
     105}
     106
    91107void UIScriptController::typeCharacterUsingHardwareKeyboard(JSStringRef character, JSValueRef callback)
    92108{
  • trunk/Tools/TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl

    r204877 r205572  
    3939    void dragFromPointToPoint(long startX, long startY, long endX, long endY, double durationSeconds, object callback);
    4040
     41    void stylusDownAtPoint(long x, long y, float azimuthAngle, float altitudeAngle, float pressure, object callback);
     42    void stylusMoveToPoint(long x, long y, float azimuthAngle, float altitudeAngle, float pressure, object callback);
     43    void stylusUpAtPoint(long x, long y, object callback);
     44    void stylusTapAtPoint(long x, long y, float azimuthAngle, float altitudeAngle, float pressure, object callback);
     45
    4146    void typeCharacterUsingHardwareKeyboard(DOMString character, object callback);
    4247    void keyDownUsingHardwareKeyboard(DOMString character, object callback);
  • trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.cpp

    r204877 r205572  
    161161}
    162162
     163void UIScriptController::stylusDownAtPoint(long x, long y, float azimuthAngle, float altitudeAngle, float pressure, JSValueRef callback)
     164{
     165}
     166
     167void UIScriptController::stylusMoveToPoint(long x, long y, float azimuthAngle, float altitudeAngle, float pressure, JSValueRef callback)
     168{
     169}
     170
     171void UIScriptController::stylusUpAtPoint(long x, long y, JSValueRef callback)
     172{
     173}
     174
     175void UIScriptController::stylusTapAtPoint(long x, long y, float azimuthAngle, float altitudeAngle, float pressure, JSValueRef callback)
     176{
     177}
     178
    163179void UIScriptController::typeCharacterUsingHardwareKeyboard(JSStringRef, JSValueRef)
    164180{
  • trunk/Tools/TestRunnerShared/UIScriptContext/UIScriptController.h

    r204945 r205572  
    5757    void doubleTapAtPoint(long x, long y, JSValueRef callback);
    5858    void dragFromPointToPoint(long startX, long startY, long endX, long endY, double durationSeconds, JSValueRef callback);
    59    
     59
     60    void stylusDownAtPoint(long x, long y, float azimuthAngle, float altitudeAngle, float pressure, JSValueRef callback);
     61    void stylusMoveToPoint(long x, long y, float azimuthAngle, float altitudeAngle, float pressure, JSValueRef callback);
     62    void stylusUpAtPoint(long x, long y, JSValueRef callback);
     63    void stylusTapAtPoint(long x, long y, float azimuthAngle, float altitudeAngle, float pressure, JSValueRef callback);
     64
    6065    void typeCharacterUsingHardwareKeyboard(JSStringRef character, JSValueRef callback);
    6166    void keyDownUsingHardwareKeyboard(JSStringRef character, JSValueRef callback);
  • trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.h

    r200602 r205572  
    3636- (void)liftUp:(CGPoint)location touchCount:(NSUInteger)count completionBlock:(void (^)(void))completionBlock;
    3737
     38// Stylus
     39- (void)stylusDownAtPoint:(CGPoint)location azimuthAngle:(CGFloat)azimuthAngle altitudeAngle:(CGFloat)altitudeAngle pressure:(CGFloat)pressure completionBlock:(void (^)(void))completionBlock;
     40- (void)stylusMoveToPoint:(CGPoint)location azimuthAngle:(CGFloat)azimuthAngle altitudeAngle:(CGFloat)altitudeAngle pressure:(CGFloat)pressure completionBlock:(void (^)(void))completionBlock;
     41- (void)stylusUpAtPoint:(CGPoint)location completionBlock:(void (^)(void))completionBlock;
     42- (void)stylusTapAtPoint:(CGPoint)location azimuthAngle:(CGFloat)azimuthAngle altitudeAngle:(CGFloat)altitudeAngle pressure:(CGFloat)pressure completionBlock:(void (^)(void))completionBlock;
     43
    3844// Taps
    3945- (void)tap:(CGPoint)location completionBlock:(void (^)(void))completionBlock;
  • trunk/Tools/WebKitTestRunner/ios/HIDEventGenerator.mm

    r200602 r205572  
    5656    HandEventInRange,
    5757    HandEventInRangeLift,
     58    StylusEventTouched,
     59    StylusEventMoved,
     60    StylusEventLifted,
    5861} HandEventType;
    5962
     
    6467    IOHIDFloat pathPressure;
    6568    UInt8 pathProximity;
     69    BOOL isStylus;
     70    IOHIDFloat azimuthAngle;
     71    IOHIDFloat altitudeAngle;
    6672} SyntheticEventDigitizerInfo;
    6773
     
    143149- (IOHIDEventRef)_createIOHIDEventType:(HandEventType)eventType
    144150{
    145     BOOL isTouching = (eventType == HandEventTouched || eventType == HandEventMoved || eventType == HandEventChordChanged);
     151    BOOL isTouching = (eventType == HandEventTouched || eventType == HandEventMoved || eventType == HandEventChordChanged || eventType == StylusEventTouched || eventType == StylusEventMoved);
    146152
    147153    IOHIDDigitizerEventMask eventMask = kIOHIDDigitizerEventTouch;
     
    183189            if (!pointInfo->pathProximity)
    184190                pointInfo->pathProximity = kGSEventPathInfoInTouch | kGSEventPathInfoInRange;
    185         } else if (eventType == HandEventLifted || eventType == HandEventCanceled) {
     191        } else if (eventType == HandEventLifted || eventType == HandEventCanceled || eventType == StylusEventLifted) {
    186192            pointInfo->pathMajorRadius = 0;
    187193            pointInfo->pathPressure = 0;
     
    191197        CGPoint point = pointInfo->point;
    192198        point = CGPointMake(roundf(point.x), roundf(point.y));
    193         RetainPtr<IOHIDEventRef> subEvent = adoptCF(IOHIDEventCreateDigitizerFingerEvent(kCFAllocatorDefault, machTime,
    194             pointInfo->identifier,
    195             pointInfo->identifier,
    196             eventMask,
    197             point.x, point.y, 0,
    198             pointInfo->pathPressure,
    199             0,
    200             pointInfo->pathProximity & kGSEventPathInfoInRange,
    201             pointInfo->pathProximity & kGSEventPathInfoInTouch,
    202             kIOHIDEventOptionNone));
     199        RetainPtr<IOHIDEventRef> subEvent;
     200        if (pointInfo->isStylus) {
     201            if (eventType == StylusEventTouched) {
     202                eventMask |= kIOHIDDigitizerEventEstimatedAltitude;
     203                eventMask |= kIOHIDDigitizerEventEstimatedAzimuth;
     204                eventMask |= kIOHIDDigitizerEventEstimatedPressure;
     205            } else if (eventType == StylusEventMoved)
     206                eventMask = kIOHIDDigitizerEventPosition;
     207
     208            subEvent = adoptCF(IOHIDEventCreateDigitizerStylusEventWithPolarOrientation(kCFAllocatorDefault, machTime,
     209                pointInfo->identifier,
     210                pointInfo->identifier,
     211                eventMask,
     212                0,
     213                point.x, point.y, 0,
     214                pointInfo->pathPressure,
     215                pointInfo->pathPressure,
     216                0,
     217                pointInfo->altitudeAngle,
     218                pointInfo->azimuthAngle,
     219                1,
     220                0,
     221                isTouching ? kIOHIDTransducerTouch : 0));
     222
     223            if (eventType == StylusEventTouched)
     224                IOHIDEventSetIntegerValue(subEvent.get(), kIOHIDEventFieldDigitizerWillUpdateMask, 0x0400);
     225            else if (eventType == StylusEventMoved)
     226                IOHIDEventSetIntegerValue(subEvent.get(), kIOHIDEventFieldDigitizerDidUpdateMask, 0x0400);
     227
     228        } else {
     229            subEvent = adoptCF(IOHIDEventCreateDigitizerFingerEvent(kCFAllocatorDefault, machTime,
     230                pointInfo->identifier,
     231                pointInfo->identifier,
     232                eventMask,
     233                point.x, point.y, 0,
     234                pointInfo->pathPressure,
     235                0,
     236                pointInfo->pathProximity & kGSEventPathInfoInRange,
     237                pointInfo->pathProximity & kGSEventPathInfoInTouch,
     238                kIOHIDEventOptionNone));
     239        }
     240
    203241        IOHIDEventSetFloatValue(subEvent.get(), kIOHIDEventFieldDigitizerMajorRadius, pointInfo->pathMajorRadius);
    204242        IOHIDEventSetFloatValue(subEvent.get(), kIOHIDEventFieldDigitizerMinorRadius, pointInfo->pathMajorRadius);
     243
    205244        IOHIDEventAppendEvent(eventRef.get(), subEvent.get(), 0);
    206245    }
     
    285324    _activePointCount = touchCount;
    286325
    287     for (NSUInteger index = 0; index < touchCount; ++index)
     326    for (NSUInteger index = 0; index < touchCount; ++index) {
    288327        _activePoints[index].point = locations[index];
     328        _activePoints[index].isStylus = NO;
     329    }
    289330
    290331    RetainPtr<IOHIDEventRef> eventRef = adoptCF([self _createIOHIDEventType:HandEventTouched]);
     
    380421{
    381422    [self liftUp:location touchCount:count];
     423    [self _sendMarkerHIDEventWithCompletionBlock:completionBlock];
     424}
     425
     426- (void)stylusDownAtPoint:(CGPoint)location azimuthAngle:(CGFloat)azimuthAngle altitudeAngle:(CGFloat)altitudeAngle pressure:(CGFloat)pressure
     427{
     428    _activePointCount = 1;
     429    _activePoints[0].point = location;
     430    _activePoints[0].isStylus = YES;
     431    _activePoints[0].pathPressure = pressure;
     432    _activePoints[0].azimuthAngle = azimuthAngle;
     433    _activePoints[0].altitudeAngle = altitudeAngle;
     434
     435    RetainPtr<IOHIDEventRef> eventRef = adoptCF([self _createIOHIDEventType:StylusEventTouched]);
     436    [self _sendHIDEvent:eventRef.get()];
     437}
     438
     439- (void)stylusMoveToPoint:(CGPoint)location azimuthAngle:(CGFloat)azimuthAngle altitudeAngle:(CGFloat)altitudeAngle pressure:(CGFloat)pressure
     440{
     441    _activePointCount = 1;
     442    _activePoints[0].point = location;
     443    _activePoints[0].isStylus = YES;
     444    _activePoints[0].pathPressure = pressure;
     445    _activePoints[0].azimuthAngle = azimuthAngle;
     446    _activePoints[0].altitudeAngle = altitudeAngle;
     447
     448    RetainPtr<IOHIDEventRef> eventRef = adoptCF([self _createIOHIDEventType:StylusEventMoved]);
     449    [self _sendHIDEvent:eventRef.get()];
     450}
     451
     452- (void)stylusUpAtPoint:(CGPoint)location
     453{
     454    _activePointCount = 1;
     455    _activePoints[0].point = location;
     456    _activePoints[0].isStylus = YES;
     457    _activePoints[0].pathPressure = 0;
     458    _activePoints[0].azimuthAngle = 0;
     459    _activePoints[0].altitudeAngle = 0;
     460
     461    RetainPtr<IOHIDEventRef> eventRef = adoptCF([self _createIOHIDEventType:StylusEventLifted]);
     462    [self _sendHIDEvent:eventRef.get()];
     463}
     464
     465- (void)stylusDownAtPoint:(CGPoint)location azimuthAngle:(CGFloat)azimuthAngle altitudeAngle:(CGFloat)altitudeAngle pressure:(CGFloat)pressure completionBlock:(void (^)(void))completionBlock
     466{
     467    [self stylusDownAtPoint:location azimuthAngle:azimuthAngle altitudeAngle:altitudeAngle pressure:pressure];
     468    [self _sendMarkerHIDEventWithCompletionBlock:completionBlock];
     469}
     470
     471- (void)stylusMoveToPoint:(CGPoint)location azimuthAngle:(CGFloat)azimuthAngle altitudeAngle:(CGFloat)altitudeAngle pressure:(CGFloat)pressure completionBlock:(void (^)(void))completionBlock
     472{
     473    [self stylusMoveToPoint:location azimuthAngle:azimuthAngle altitudeAngle:altitudeAngle pressure:pressure];
     474    [self _sendMarkerHIDEventWithCompletionBlock:completionBlock];
     475}
     476
     477- (void)stylusUpAtPoint:(CGPoint)location completionBlock:(void (^)(void))completionBlock
     478{
     479    [self stylusUpAtPoint:location];
     480    [self _sendMarkerHIDEventWithCompletionBlock:completionBlock];
     481}
     482
     483- (void)stylusTapAtPoint:(CGPoint)location azimuthAngle:(CGFloat)azimuthAngle altitudeAngle:(CGFloat)altitudeAngle pressure:(CGFloat)pressure completionBlock:(void (^)(void))completionBlock
     484{
     485    struct timespec pressDelay = { 0, static_cast<long>(fingerLiftDelay) };
     486
     487    [self stylusDownAtPoint:location azimuthAngle:azimuthAngle altitudeAngle:altitudeAngle pressure:pressure];
     488    nanosleep(&pressDelay, 0);
     489    [self stylusUpAtPoint:location];
     490
    382491    [self _sendMarkerHIDEventWithCompletionBlock:completionBlock];
    383492}
  • trunk/Tools/WebKitTestRunner/ios/IOKitSPI.h

    r190408 r205572  
    3434
    3535#import <IOKit/hid/IOHIDEvent.h>
     36#import <IOKit/hid/IOHIDEventData.h>
    3637#import <IOKit/hid/IOHIDEventSystemClient.h>
    3738#import <IOKit/hid/IOHIDUsageTables.h>
     
    7374    kIOHIDDigitizerEventCancel      = 1<<7,
    7475    kIOHIDDigitizerEventStart       = 1<<8,
     76    kIOHIDDigitizerEventEstimatedAltitude = 1<<28,
     77    kIOHIDDigitizerEventEstimatedAzimuth = 1<<29,
     78    kIOHIDDigitizerEventEstimatedPressure = 1<<30,
    7579};
    7680typedef uint32_t IOHIDDigitizerEventMask;
     
    101105
    102106enum {
     107    kIOHIDTransducerRange               = 0x00010000,
     108    kIOHIDTransducerTouch               = 0x00020000,
     109    kIOHIDTransducerInvert              = 0x00040000,
     110    kIOHIDTransducerDisplayIntegrated   = 0x00080000
     111};
     112
     113enum {
    103114    kIOHIDDigitizerTransducerTypeHand = 3
    104115};
    105116typedef uint32_t IOHIDDigitizerTransducerType;
     117
     118enum {
     119    kIOHIDEventFieldDigitizerWillUpdateMask = 720924,
     120    kIOHIDEventFieldDigitizerDidUpdateMask = 720925
     121};
    106122
    107123IOHIDEventRef IOHIDEventCreateDigitizerEvent(CFAllocatorRef, uint64_t, IOHIDDigitizerTransducerType, uint32_t, uint32_t, IOHIDDigitizerEventMask, uint32_t, IOHIDFloat, IOHIDFloat, IOHIDFloat, IOHIDFloat, IOHIDFloat, boolean_t, boolean_t, IOOptionBits);
     
    114130
    115131IOHIDEventRef IOHIDEventCreateVendorDefinedEvent(CFAllocatorRef, uint64_t, uint32_t, uint32_t, uint32_t, uint8_t*, CFIndex, IOHIDEventOptionBits);
     132
     133IOHIDEventRef IOHIDEventCreateDigitizerStylusEventWithPolarOrientation(CFAllocatorRef, uint64_t, uint32_t, uint32_t, IOHIDDigitizerEventMask, uint32_t, IOHIDFloat, IOHIDFloat, IOHIDFloat, IOHIDFloat, IOHIDFloat, IOHIDFloat, IOHIDFloat, IOHIDFloat, boolean_t, boolean_t, IOHIDEventOptionBits);
    116134
    117135IOHIDEventType IOHIDEventGetType(IOHIDEventRef);
  • trunk/Tools/WebKitTestRunner/ios/UIScriptControllerIOS.mm

    r204877 r205572  
    127127}
    128128
     129void UIScriptController::stylusDownAtPoint(long x, long y, float azimuthAngle, float altitudeAngle, float pressure, JSValueRef callback)
     130{
     131    unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
     132
     133    auto location = globalToContentCoordinates(TestController::singleton().mainWebView()->platformView(), x, y);
     134    [[HIDEventGenerator sharedHIDEventGenerator] stylusDownAtPoint:location azimuthAngle:azimuthAngle altitudeAngle:altitudeAngle pressure:pressure completionBlock:^{
     135        if (!m_context)
     136            return;
     137        m_context->asyncTaskComplete(callbackID);
     138    }];
     139}
     140
     141void UIScriptController::stylusMoveToPoint(long x, long y, float azimuthAngle, float altitudeAngle, float pressure, JSValueRef callback)
     142{
     143    unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
     144
     145    auto location = globalToContentCoordinates(TestController::singleton().mainWebView()->platformView(), x, y);
     146    [[HIDEventGenerator sharedHIDEventGenerator] stylusMoveToPoint:location azimuthAngle:azimuthAngle altitudeAngle:altitudeAngle pressure:pressure completionBlock:^{
     147        if (!m_context)
     148            return;
     149        m_context->asyncTaskComplete(callbackID);
     150    }];
     151}
     152
     153void UIScriptController::stylusUpAtPoint(long x, long y, JSValueRef callback)
     154{
     155    unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
     156
     157    auto location = globalToContentCoordinates(TestController::singleton().mainWebView()->platformView(), x, y);
     158    [[HIDEventGenerator sharedHIDEventGenerator] stylusUpAtPoint:location completionBlock:^{
     159        if (!m_context)
     160            return;
     161        m_context->asyncTaskComplete(callbackID);
     162    }];
     163}
     164
     165void UIScriptController::stylusTapAtPoint(long x, long y, float azimuthAngle, float altitudeAngle, float pressure, JSValueRef callback)
     166{
     167    unsigned callbackID = m_context->prepareForAsyncTask(callback, CallbackTypeNonPersistent);
     168
     169    auto location = globalToContentCoordinates(TestController::singleton().mainWebView()->platformView(), x, y);
     170    [[HIDEventGenerator sharedHIDEventGenerator] stylusTapAtPoint:location azimuthAngle:azimuthAngle altitudeAngle:altitudeAngle pressure:pressure completionBlock:^{
     171        if (!m_context)
     172            return;
     173        m_context->asyncTaskComplete(callbackID);
     174    }];
     175}
     176
    129177void UIScriptController::dragFromPointToPoint(long startX, long startY, long endX, long endY, double durationSeconds, JSValueRef callback)
    130178{
Note: See TracChangeset for help on using the changeset viewer.