1// Copyright 2020 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5module blink.mojom; 6 7// Enumerates the different buttons on a pointing device. 8enum Button { 9 kNoButton = -1, 10 kLeft, 11 kMiddle, 12 kRight, 13 kBarrel = kRight, // Barrel is aliased per pointer event spec 14 kBack, 15 kForward, 16 kEraser, 17}; 18 19// Indicates whether the browser needs to block on the ACK result for 20// this event, and if not, why (for metrics/diagnostics purposes). 21enum DispatchType { 22 // Event can be canceled. 23 kBlocking, 24 // Event can not be canceled. 25 kEventNonBlocking, 26 // All listeners are passive; not cancelable. 27 kListenersNonBlockingPassive, 28 // This value represents a state which would have normally blocking 29 // but was forced to be non-blocking during fling; not cancelable. 30 kListenersForcedNonBlockingDueToFling, 31}; 32 33// Enumerates the different types of Input Events. 34enum EventType { 35 kUndefined = -1, 36 kTypeFirst = kUndefined, 37 38 // WebMouseEvent 39 kMouseDown, 40 kMouseTypeFirst = kMouseDown, 41 kMouseUp, 42 kMouseMove, 43 kMouseEnter, 44 kMouseLeave, 45 kContextMenu, 46 kMouseTypeLast = kContextMenu, 47 48 // WebMouseWheelEvent 49 kMouseWheel, 50 51 // WebKeyboardEvent 52 kRawKeyDown, 53 kKeyboardTypeFirst = kRawKeyDown, 54 // KeyDown is a single event combining RawKeyDown and Char. If KeyDown is 55 // sent for a given keystroke, those two other events will not be sent. 56 // Platforms tend to prefer sending in one format (Android uses KeyDown, 57 // Windows uses RawKeyDown+Char, for example), but this is a weakly held 58 // property as tools like WebDriver/DevTools might still send the other 59 // format. 60 kKeyDown, 61 kKeyUp, 62 kChar, 63 kKeyboardTypeLast = kChar, 64 65 // WebGestureEvent - input interpreted semi-semantically, most commonly from 66 // touchscreen but also used for touchpad, mousewheel, and gamepad 67 // scrolling. 68 kGestureScrollBegin, 69 kGestureTypeFirst = kGestureScrollBegin, 70 kGestureScrollEnd, 71 kGestureScrollUpdate, 72 // Fling is a high-velocity and quickly released finger movement. 73 // FlingStart is sent once and kicks off a scroll animation. 74 kGestureFlingStart, 75 kGestureFlingCancel, 76 // Pinch is two fingers moving closer or farther apart. 77 kGesturePinchBegin, 78 kGesturePinchTypeFirst = kGesturePinchBegin, 79 kGesturePinchEnd, 80 kGesturePinchUpdate, 81 kGesturePinchTypeLast = kGesturePinchUpdate, 82 83 // The following types are variations and subevents of single-taps. 84 // 85 // Sent the moment the user's finger hits the screen. 86 kGestureTapDown, 87 // Sent a short interval later, after it seems the finger is staying in 88 // place. It's used to activate the link highlight ("show the press"). 89 kGestureShowPress, 90 // Sent on finger lift for a simple, static, quick finger tap. This is the 91 // "main" event which maps to a synthetic mouse click event. 92 kGestureTap, 93 // Sent when a GestureTapDown didn't turn into any variation of GestureTap 94 // (likely it turned into a scroll instead). 95 kGestureTapCancel, 96 // Sent as soon as the long-press timeout fires, while the finger is still 97 // down. 98 kGestureLongPress, 99 // Sent when the finger is lifted following a GestureLongPress. 100 kGestureLongTap, 101 // Sent on finger lift when two fingers tapped at the same time without 102 // moving. 103 kGestureTwoFingerTap, 104 // A rare event sent in place of GestureTap on desktop pages viewed on an 105 // Android phone. This tap could not yet be resolved into a GestureTap 106 // because it may still turn into a GestureDoubleTap. 107 kGestureTapUnconfirmed, 108 109 // On Android, double-tap is two single-taps spread apart in time, like a 110 // double-click. This event is only sent on desktop pages, and is always 111 // preceded by GestureTapUnconfirmed. It's an instruction to Blink to 112 // perform a PageScaleAnimation zoom onto the double-tapped content. (It's 113 // treated differently from GestureTap with tapCount=2, which can also 114 // happen.) 115 // On desktop, this event may be used for a double-tap with two fingers on 116 // a touchpad, as the desired effect is similar to Android's double-tap. 117 kGestureDoubleTap, 118 119 kGestureTypeLast = kGestureDoubleTap, 120 121 // WebTouchEvent - raw touch pointers not yet classified into gestures. 122 kTouchStart, 123 kTouchTypeFirst = kTouchStart, 124 kTouchMove, 125 kTouchEnd, 126 kTouchCancel, 127 // TODO(nzolghadr): This event should be replaced with 128 // kPointerCausedUaAction 129 kTouchScrollStarted, 130 kTouchTypeLast = kTouchScrollStarted, 131 132 // WebPointerEvent: work in progress 133 kPointerDown, 134 kPointerTypeFirst = kPointerDown, 135 kPointerUp, 136 kPointerMove, 137 kPointerRawUpdate, // To be only used within blink. 138 kPointerCancel, 139 kPointerCausedUaAction, 140 kPointerTypeLast = kPointerCausedUaAction, 141 142 kTypeLast = kPointerTypeLast 143}; 144