Gesture Recognizer OverviewThis document describes the process by which Touch Events received by a root window are transformed into Gesture Events.Touch Events
Gesture Events
Terminology
Finding a TargetPossible ways of establishing a target
In the following images, a filled in circle represents a touch down, and the outline of a circle represents a position the touch has moved to. The dotted green line indicates the window that a touch is targeted at. The rounded rectangle represents a window, and the outer rectangle represents the root window.
ComplicationspreventDefault’ed ReleaseWhen Javascript calls preventDefault on a touch release, we need to make sure that no gesture events are created, but we also need to ensure that the GestureRecognizer knows that the associated finger isn’t down any more. To accomplish this, we turn the touch release into a touch cancel event.Touch CaptureWhen a touch capture occurs, all touches on windows other than the window gaining capture need to be ignored until they are released. To do this, we fire a touch cancel for each of these touches, and retarget them to a dummy window, which ignores all further events.Generating Gesture EventsGesture SequencesEach touch-id has an associated window, and each window has an associated GestureSequence.Inside a GestureSequence, touches are renumbered with point-ids, which are local to the GestureSequence, and contiguous from 0 to the number of touches. Gesture Sequence State MachineThe GestureSequence state machine starts in state GS_NO_GESTURE. In the diagram below, a transition labelled XN indicates that the N'th finger took action X. Where To StartGestureRecognizerImplGestureSequence::ProcessTouchEventForGesture ui/base/gestures/gesture_sequence_unit_test.cc GestureRecognizer unit tests |

