1 of 8

Fling On Browser

Sahel@

23 April 2018

Updated 25 Feb 2019

2 of 8

Background

  • Touchpad
    • Receive ui::ET_SCROLL_FLING_START when user lifts their fingers.
    • Receive ui::ET_SCROLL_FLING_CANCEL when user touches the touchpad.
    • Velocity received from the device.
  • Touchscreen
    • GestureDetector has a velocity tracker
    • GestureProvider sends GFS on finger lift and GFC on tap down.
  • Autoscroll
    • On AutoscrollStart on middle click
    • Fixed velocity GFS events on mouse moves
    • GFC on second middle click

3 of 8

Motivation

Simplifies renderer scroll code.

  • Touchpad Fling (Chromebook, and VR)
    • Blocking wheel listener forced fling to happen on main.
    • Synthetic wheels sent to the main thread if any wheel listeners existed.
    • Fling curve transfer from Impl to Main.
    • Out of order gesture scroll sequence.
    • Benefit from async wheel events.
  • Touchscreen and Autoscroll
    • Freeze if switch from Impl to Main needed.
    • Unable to scroll on drop down lists.
    • Scrolling stops when dom element deleted.

4 of 8

Fling controller

  • A member of GSU, filters and processes GFS and GFC events instead of sending them to the renderer.
  • Maintains a fling curve and on every begin frame calls progressFling:
    • GSU with inertial phase events for Touchscreen and autoscroll
    • WebMouseWheelEvent for touchpad fling. (to be consistent with Inertial scrolling on Mac)
  • Fling termination:
    • GFC from user interruption
    • Keypress
    • Early termination when GSU acked as not-consumed.
    • GSE for touchscreen and autoscroll
    • Wheelevent with momentum phase ended for touchpad

5 of 8

Fling controller Clients

  • Event sender client (input router impl)
    • Sends generated events
  • Fling scheduler
    • Ui animation observer
    • OnAnimation step->progressFling
    • On webview needsBeginFrame from browser.

6 of 8

Fling boosting

  • Touchscreen and touchpad flings only
  • Do not stop the fling immediately
  • Suppress the GFC and any gesture scroll events from user scroll till we decide to boost or replace:
  • If a new fling arrives within 50ms try to boost the current fling:
    • Velocity of the two flings determine if we are boosting the fling
    • Source type
    • ….
  • Guarantee correct scroll event sequence when we replace

7 of 8

Fling and oopif scroll bubbling

  • GFS and GFC events not bubbled.
  • The fling controller of the oopif generates GSU events which get bubbled
  • The RWH_input_event_router stores fling target
  • For early fling termination the RWH_input_event_router asks the oopif fling controller to stop flinging.

8 of 8

ScheduleFlingProgress adds the fling_controller to ui::Compositor if it exists and otherwise calls SetNeedsBeginFrameForFlingProgress

ProgressFling