From 7c12f1b10009ad8da1051ae875d6b9841ee1dd7a Mon Sep 17 00:00:00 2001 From: Timotius Margo Date: Tue, 5 Feb 2019 21:58:18 -0800 Subject: [PATCH 1/2] actions: add additional pointer properties W3C Pointer Events defined additional pointer properties (pressure, contact geometry, tilt, etc.) to the PointerEvent interface that reflects new interactions with pointer devices like touch and pen. Update the WebDriver actions to support these additional properties. --- index.html | 154 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 149 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 6c05d5c05..87cbfed72 100644 --- a/index.html +++ b/index.html @@ -188,6 +188,10 @@

Terminology

An integer is a Number that is unchanged under the ToInteger operation. +

+A floating-point number is a Number that is +produced by the parseFloat operation. +

The initial value of an ECMAScript property is the value defined by the platform for that property, @@ -6888,8 +6892,7 @@

State

and alt, shift, ctrl, and meta all set to false. -

-A pointer input source’s input source state +

A pointer input source’s input source state is a pointer input state object. This consists of a subtype property, which has the possible values @@ -6899,12 +6902,20 @@

State

a pressed property which is a set of unsigned integers, an x property which is an unsigned integer, and a y property which is an unsigned integer. +Additionally, it also contains optional properties +width, height, pressure, and +tangentialPressure which are floating-point numbers, and +tiltX, tiltY, and twist which +are integers in accordance with the requirements of [[!POINTER-EVENTS]].

When required to create a new pointer input state object with arguments subtype an implementation must return a pointer input state object with subtype set - to subtype, pressed set to an empty set and - both x and y set to 0. + to subtype, pressed set to an empty set, + both x and y set to 0, and + width, height, pressure, + tangentialPressure, tiltX, tiltY, + and twist are set to null.

Each session has an associated input state table. This is a map between input id @@ -7026,7 +7037,7 @@

Ticks

will have the isTrusted attribute set to true.

-The most robust way to despatch these events +The most robust way to dispatch these events is by creating them in the browser implementation itself. Sending operating system specific input messages to the browser’s window has the disadvantage that the browser being automated @@ -7386,6 +7397,12 @@

Processing actions

action item and action. If doing so results in an error, return that error. +
  • +If subtype is "pointerUp" or "pointerDown" +or "pointerMove", process optional pointer properties with +arguments action item and action. +If doing so results in an error, return that error. +

  • If subtype is "pointerCancel" process a pointer cancel action. @@ -7488,6 +7505,132 @@

    Processing actions

  • Return success with data null. + +

    When required to process optional pointer properties + with arguments action item, and action, a + remote end must run the following steps in accordance with + the requirements of [[!POINTER-EVENTS]]:

    + +
      +
    1. Let width be the result + of getting the property width + from action item. + +

    2. If width is not undefined: + +

        +
      1. + If width is not a Floating-Point Number greater than or equal to 1, + return error with error code invalid argument. + +

      2. + Set the width property of action + to width. +

      + +
    3. Let height be the result + of getting the property height + from action item. + +

    4. If height is not undefined: + +

        +
      1. + If height is not a Floating-Point Number greater than or equal to 1, + return error with error code invalid argument. + +

      2. + Set the height property of action + to height. +

      + +
    5. If width is not undefined while + height is undefined or vice versa + return error with error code invalid argument. + +

    6. Let pressure be the result + of getting the property pressure + from action item. + +

    7. If pressure is not undefined: + +

        +
      1. + If pressure is not a Floating-Point Number in the range of [0, 1] + return error with error code invalid argument. + +

      2. + Set the pressure property of action + to pressure. +

      + +
    8. Let tangentialPressure be the result + of getting the property tangentialPressure + from action item. + +

    9. If tangentialPressure is not undefined: + +

        +
      1. + If tangentialPressure is not a Floating-Point Number + in the range of [-1, 1] + return error with error code invalid argument. + +

      2. + Set the tangentialPressure property of action + to tangentialPressure. +

      + +
    10. Let tiltX be the result + of getting the property tiltX + from action item. + +

    11. If tiltX is not undefined: + +

        +
      1. + If tiltX is not an Integer in the range of [-90, 90] + return error with error code invalid argument. + +

      2. + Set the tiltX property of action + to tiltX. +

      + +
    12. Let tiltY be the result + of getting the property tiltY + from action item. + +

    13. If tiltY is not undefined: + +

        +
      1. + If tiltY is not an Integer in the range of [-90, 90] + return error with error code invalid argument. + +

      2. + Set the tiltY property of action + to tiltY. +

      + +
    14. Let twist be the result + of getting the property twist + from action item. + +

    15. If twist is not undefined: + +

        +
      1. + If twist is not an Integer in the range of [0, 359] + return error with error code invalid argument. + +

      2. + Set the twist property of action + to twist. +

      + +
    16. Return success with data null. +

    @@ -9168,6 +9311,7 @@

    Acknowledgements

    Sam Sneddon, Seva Lotoshnikov, Simon Stewart, + Timotius Arya Margo, Titus Fortner, and Vangelis Katsikaros. From f7101d453280cf8fb78de304e109264492fe560b Mon Sep 17 00:00:00 2001 From: Timotius Margo Date: Tue, 5 Feb 2019 22:00:15 -0800 Subject: [PATCH 2/2] actions: update additional properties section Create optional properties table Update pointer actions dispatch sections to take the additional properties into account --- index.html | 119 ++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 109 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index 87cbfed72..cd9e34a52 100644 --- a/index.html +++ b/index.html @@ -6902,20 +6902,56 @@

    State

    a pressed property which is a set of unsigned integers, an x property which is an unsigned integer, and a y property which is an unsigned integer. -Additionally, it also contains optional properties -width, height, pressure, and -tangentialPressure which are floating-point numbers, and -tiltX, tiltY, and twist which -are integers in accordance with the requirements of [[!POINTER-EVENTS]]. + +

    Additionally, a pointer input state object also contains +optional pointer properties as shown in the table below +in accordance with the requirements of [[POINTER-EVENTS]]. + + + + + + + + + + + + + + + + + + + + +
    Property + Type +
    width + floating-point number +
    height + floating-point number +
    pressure + floating-point number +
    tangentialPressure + floating-point number +
    tiltX + integer +
    tiltY + integer +
    twist + integer +

    When required to create a new pointer input state object with arguments subtype an implementation must return a pointer input state object with subtype set to subtype, pressed set to an empty set, - both x and y set to 0, and + both x and y set to 0, width, height, pressure, tangentialPressure, tiltX, tiltY, - and twist are set to null. + and twist set to null.

    Each session has an associated input state table. This is a map between input id @@ -7509,7 +7545,7 @@

    Processing actions

    When required to process optional pointer properties with arguments action item, and action, a remote end must run the following steps in accordance with - the requirements of [[!POINTER-EVENTS]]:

    + the requirements of [[POINTER-EVENTS]]:

    1. Let width be the result @@ -8243,6 +8279,9 @@

      Pointer actions

      input state’s pressed property, and let buttons be the resulting value of that property. +
    2. Set input state optional pointer properties with + arguments action object, input state. +

    3. Append a copy of action object with the subtype property changed to pointerUp to the current session’s input cancel list. @@ -8252,7 +8291,9 @@

      Pointer actions

      numbered button on the pointer with ID source id, having type pointerType at viewport x coordinate x, viewport y - coordinate y, with buttons buttons depressed + coordinate y, with buttons buttons depressed, + and type specific properties set to the input state’s + optional pointer properties that are not null, in accordance with the requirements of [[UI-EVENTS]] and [[POINTER-EVENTS]]. The generated events must set ctrlKey, shiftKey, altKey, @@ -8290,6 +8331,9 @@

      Pointer actions

    4. Let y be equal to input state’s y property. +

    5. Set input state optional pointer properties with + arguments action object, input state. +

    6. Remove button from the set corresponding to input state’s pressed property, and let buttons be the resulting value of that @@ -8301,6 +8345,8 @@

      Pointer actions

      source id having type pointerType at viewport x coordinate x, viewport y coordinate y, with buttons buttons depressed, + and type specific properties set to the input state’s + optional pointer properties that are not null, in accordance with the requirements of [[UI-EVENTS]] and [[POINTER-EVENTS]]. The generated events must set ctrlKey, shiftKey, altKey, @@ -8378,6 +8424,9 @@

      Pointer actions

      return error with error code move target out of bounds. +
    7. Set input state optional pointer properties with + arguments action object, input state. +

    8. Let duration be equal to action object’s duration property if it is not undefined, or tick duration @@ -8449,7 +8498,9 @@

      Pointer actions

      viewport x coordinate current x, viewport y coordinate y to viewport x coordinate x and viewport y coordinate y, with - buttons buttons depressed, in accordance with the + buttons buttons depressed, and type specific properties + set to the input state’s optional pointer properties + that are not null, in accordance with the requirements of [[UI-EVENTS]] and [[POINTER-EVENTS]]. The generated events must set ctrlKey, shiftKey, altKey, and metaKey from the @@ -8502,6 +8553,54 @@

      Pointer actions

    +

    When required to set input state optional pointer properties + with arguments action object, input state, + an implementation must run the following steps: + +

      +
    1. Let width be equal to + action object’s width property. + +

    2. If width is not undefined, let input state’s + width property equal width. + +

    3. Let height be equal to + action object’s height property. + +

    4. If height is not undefined, let input state’s + height property equal height. + +

    5. Let pressure be equal to + action object’s pressure property. + +

    6. If pressure is not undefined, let input state’s + pressure property equal pressure. + +

    7. Let tangentialPressure be equal to + action object’s tangentialPressure property. + +

    8. If tangentialPressure is not undefined, let input state’s + tangentialPressure property equal tangentialPressure. + +

    9. Let tiltX be equal to + action object’s tiltX property. + +

    10. If tiltX is not undefined, let input state’s + tiltX property equal tiltX. + +

    11. Let tiltY be equal to + action object’s tiltY property. + +

    12. If tiltY is not undefined, let input state’s + tiltY property equal tiltY. + +

    13. Let twist be equal to + action object’s twist property. + +

    14. If twist is not undefined, let input state’s + twist property equal twist. +

    +

    When required to dispatch a pointerCancel action with arguments source id, action object, input state and tick duration a