Changeset 248752 in webkit


Ignore:
Timestamp:
Aug 15, 2019 5:37:20 PM (5 years ago)
Author:
Wenson Hsieh
Message:

Tidy up some event stream helpers in basic-gestures.js
https://bugs.webkit.org/show_bug.cgi?id=200783

Reviewed by Tim Horton.

  • resources/basic-gestures.js:

Make a few small adjustments:
(1) Invoke uiScriptComplete within the completion callback of sendEventStream. This actually doesn't result in

any behavior differences, since UIScriptController will, by default, wait for non-persistent asynchronous
tasks to finish before allowing the UI-side script invocation to finish.

(2) Fix some minor indentation issues in longPressAndHoldAtPoint, touchAndDragFromPointToPoint, holdAtPoint,

and continueTouchAndDragFromPointToPoint.

Location:
trunk/LayoutTests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r248750 r248752  
     12019-08-15  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Tidy up some event stream helpers in basic-gestures.js
     4        https://bugs.webkit.org/show_bug.cgi?id=200783
     5
     6        Reviewed by Tim Horton.
     7
     8        * resources/basic-gestures.js:
     9
     10        Make a few small adjustments:
     11        (1) Invoke uiScriptComplete within the completion callback of sendEventStream. This actually doesn't result in
     12            any behavior differences, since UIScriptController will, by default, wait for non-persistent asynchronous
     13            tasks to finish before allowing the UI-side script invocation to finish.
     14        (2) Fix some minor indentation issues in longPressAndHoldAtPoint, touchAndDragFromPointToPoint, holdAtPoint,
     15            and continueTouchAndDragFromPointToPoint.
     16
    1172019-08-15  Zalan Bujtas  <zalan@apple.com>
    218
  • trunk/LayoutTests/resources/basic-gestures.js

    r237127 r248752  
    6969        testRunner.runUIScript(`
    7070            (function() {
    71             var eventStream = {
    72             events : [
    73                 {
    74                     interpolate : "linear",
    75                     timestep: 0.1,
    76                     coordinateSpace : "content",
    77                     startEvent : {
    78                         inputType : "hand",
    79                         timeOffset : 0,
    80                         touches : [
    81                             {
    82                                 inputType : "finger",
    83                                 phase : "began",
    84                                 id : 1,
    85                                 x : ${x},
    86                                 y : ${y},
    87                                 pressure : 0
    88                             }
    89                         ]
    90                     },
    91                     endEvent : {
    92                         inputType : "hand",
    93                         timeOffset : 2.0,
    94                         touches : [
    95                             {
    96                                 inputType : "finger",
    97                                 phase : "moved",
    98                                 id : 1,
    99                                 x : ${x},
    100                                 y : ${y},
    101                                 pressure : 0
    102                             }
    103                         ]
    104                     }
    105             }]};
    106 
    107             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
    108                 uiController.uiScriptComplete();
     71                const eventStream = {
     72                    events : [
     73                        {
     74                            interpolate : "linear",
     75                            timestep: 0.1,
     76                            coordinateSpace : "content",
     77                            startEvent : {
     78                                inputType : "hand",
     79                                timeOffset : 0,
     80                                touches : [
     81                                    {
     82                                        inputType : "finger",
     83                                        phase : "began",
     84                                        id : 1,
     85                                        x : ${x},
     86                                        y : ${y},
     87                                        pressure : 0
     88                                    }
     89                                ]
     90                            },
     91                            endEvent : {
     92                                inputType : "hand",
     93                                timeOffset : 2.0,
     94                                touches : [
     95                                    {
     96                                        inputType : "finger",
     97                                        phase : "moved",
     98                                        id : 1,
     99                                        x : ${x},
     100                                        y : ${y},
     101                                        pressure : 0
     102                                    }
     103                                ]
     104                            }
     105                        }
     106                    ]
     107                };
     108
     109                uiController.sendEventStream(JSON.stringify(eventStream), () => uiController.uiScriptComplete());
    109110            })();`, resolve);
    110111    });
     
    128129        testRunner.runUIScript(`
    129130            (function() {
    130             var eventStream = {
    131             events : [
    132                 {
    133                     interpolate : "linear",
    134                     timestep: 0.1,
    135                     coordinateSpace : "content",
    136                     startEvent : {
    137                         inputType : "hand",
    138                         timeOffset : 0,
    139                         touches : [
    140                             {
    141                                 inputType : "finger",
    142                                 phase : "began",
    143                                 id : 1,
    144                                 x : ${startX},
    145                                 y : ${startY},
    146                                 pressure : 0
    147                             }
    148                         ]
    149                     },
    150                     endEvent : {
    151                         inputType : "hand",
    152                         timeOffset : 0.5,
    153                         touches : [
    154                             {
    155                                 inputType : "finger",
    156                                 phase : "moved",
    157                                 id : 1,
    158                                 x : ${endX},
    159                                 y : ${endY},
    160                                 pressure : 0
    161                             }
    162                         ]
    163                     }
    164             }]};
    165 
    166             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
    167                 uiController.uiScriptComplete();
     131                const eventStream = {
     132                    events : [
     133                        {
     134                            interpolate : "linear",
     135                            timestep: 0.1,
     136                            coordinateSpace : "content",
     137                            startEvent : {
     138                                inputType : "hand",
     139                                timeOffset : 0,
     140                                touches : [
     141                                    {
     142                                        inputType : "finger",
     143                                        phase : "began",
     144                                        id : 1,
     145                                        x : ${startX},
     146                                        y : ${startY},
     147                                        pressure : 0
     148                                    }
     149                                ]
     150                            },
     151                            endEvent : {
     152                                inputType : "hand",
     153                                timeOffset : 0.5,
     154                                touches : [
     155                                    {
     156                                        inputType : "finger",
     157                                        phase : "moved",
     158                                        id : 1,
     159                                        x : ${endX},
     160                                        y : ${endY},
     161                                        pressure : 0
     162                                    }
     163                                ]
     164                            }
     165                        }
     166                    ]
     167                };
     168
     169                uiController.sendEventStream(JSON.stringify(eventStream), () => uiController.uiScriptComplete());
    168170            })();`, resolve);
    169171    });
     
    175177        testRunner.runUIScript(`
    176178            (function() {
    177             var eventStream = {
    178             events : [
    179                 {
    180                     interpolate : "linear",
    181                     timestep: 0.1,
    182                     coordinateSpace : "content",
    183                     startEvent : {
    184                         inputType : "hand",
    185                         timeOffset : 0,
    186                         touches : [
    187                             {
    188                                 inputType : "finger",
    189                                 phase : "moved",
    190                                 id : 1,
    191                                 x : ${x},
    192                                 y : ${y},
    193                                 pressure : 0
    194                             }
    195                         ]
    196                     },
    197                     endEvent : {
    198                         inputType : "hand",
    199                         timeOffset : 5.0,
    200                         touches : [
    201                             {
    202                                 inputType : "finger",
    203                                 phase : "moved",
    204                                 id : 1,
    205                                 x : ${x},
    206                                 y : ${y},
    207                                 pressure : 0
    208                             }
    209                         ]
    210                     }
    211             }]};
    212 
    213             uiController.sendEventStream(JSON.stringify(eventStream), function() {});
    214                 uiController.uiScriptComplete();
     179                const eventStream = {
     180                    events : [
     181                        {
     182                            interpolate : "linear",
     183                            timestep: 0.1,
     184                            coordinateSpace : "content",
     185                            startEvent : {
     186                                inputType : "hand",
     187                                timeOffset : 0,
     188                                touches : [
     189                                    {
     190                                        inputType : "finger",
     191                                        phase : "moved",
     192                                        id : 1,
     193                                        x : ${x},
     194                                        y : ${y},
     195                                        pressure : 0
     196                                    }
     197                                ]
     198                            },
     199                            endEvent : {
     200                                inputType : "hand",
     201                                timeOffset : 5.0,
     202                                touches : [
     203                                    {
     204                                        inputType : "finger",
     205                                        phase : "moved",
     206                                        id : 1,
     207                                        x : ${x},
     208                                        y : ${y},
     209                                        pressure : 0
     210                                    }
     211                                ]
     212                            }
     213                        }
     214                    ]
     215                };
     216
     217                uiController.sendEventStream(JSON.stringify(eventStream), () => uiController.uiScriptComplete());
    215218            })();`, resolve);
    216219    });
     
    222225        testRunner.runUIScript(`
    223226            (function() {
    224              var eventStream = {
    225              events : [
    226                        {
    227                        interpolate : "linear",
    228                        timestep: 0.1,
    229                        coordinateSpace : "content",
    230                        startEvent : {
    231                            inputType : "hand",
    232                            timeOffset : 0,
    233                            touches : [
    234                                {
    235                                    inputType : "finger",
    236                                    phase : "moved",
    237                                    id : 1,
    238                                    x : ${startX},
    239                                    y : ${startY},
    240                                    pressure : 0
    241                                }
    242                            ]
    243                        },
    244                        endEvent : {
    245                            inputType : "hand",
    246                            timeOffset : 0.5,
    247                            touches : [
    248                                {
    249                                    inputType : "finger",
    250                                    phase : "moved",
    251                                    id : 1,
    252                                    x : ${endX},
    253                                    y : ${endY},
    254                                    pressure : 0
    255                                }
    256                            ]
    257                        }
    258              }]};
    259 
    260              uiController.sendEventStream(JSON.stringify(eventStream), function() {});
    261                  uiController.uiScriptComplete();
    262              })();`, resolve);
    263     });
    264 }
     227                const eventStream = {
     228                    events : [
     229                        {
     230                            interpolate : "linear",
     231                            timestep: 0.1,
     232                            coordinateSpace : "content",
     233                            startEvent : {
     234                                inputType : "hand",
     235                                timeOffset : 0,
     236                                touches : [
     237                                    {
     238                                        inputType : "finger",
     239                                        phase : "moved",
     240                                        id : 1,
     241                                        x : ${startX},
     242                                        y : ${startY},
     243                                        pressure : 0
     244                                    }
     245                                ]
     246                            },
     247                            endEvent : {
     248                                inputType : "hand",
     249                                timeOffset : 0.5,
     250                                touches : [
     251                                    {
     252                                        inputType : "finger",
     253                                        phase : "moved",
     254                                        id : 1,
     255                                        x : ${endX},
     256                                        y : ${endY},
     257                                        pressure : 0
     258                                    }
     259                                ]
     260                            }
     261                        }
     262                    ]
     263                };
     264
     265                uiController.sendEventStream(JSON.stringify(eventStream), () => uiController.uiScriptComplete());
     266            })();`, resolve);
     267    });
     268}
Note: See TracChangeset for help on using the changeset viewer.