Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: third_party/WebKit/public/platform/WebGestureEvent.h

Issue 2497033002: Break apart WebGestureEvent from WebInputEvent. (Closed)
Patch Set: Rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/public/BUILD.gn ('k') | third_party/WebKit/public/platform/WebInputEvent.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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
5 #ifndef WebGestureEvent_h
6 #define WebGestureEvent_h
7
8 #include "WebGestureDevice.h"
9 #include "WebInputEvent.h"
10
11 namespace blink {
12
13 // See WebInputEvent.h for details why this pack is here.
14 #pragma pack(push, 4)
15
16 // WebGestureEvent ---------------------------------------------------------
17
18 class WebGestureEvent : public WebInputEvent {
19 public:
20 enum ScrollUnits {
21 PrecisePixels = 0, // generated by high precision devices.
22 Pixels, // large pixel jump duration; should animate to delta.
23 Page // page (visible viewport) based scrolling.
24 };
25
26 enum InertialPhaseState {
27 UnknownMomentumPhase = 0, // No phase information.
28 NonMomentumPhase, // Regular scrolling phase.
29 MomentumPhase, // Momentum phase.
30 };
31
32 int x;
33 int y;
34 int globalX;
35 int globalY;
36 WebGestureDevice sourceDevice;
37
38 // If the WebGestureEvent has sourceDevice=WebGestureDeviceTouchscreen, this
39 // field contains the unique identifier for the touch event that released
40 // this event at TouchDispositionGestureFilter. If the WebGestureEvents was
41 // not released through a touch event (e.g. timer-released gesture events or
42 // gesture events with sourceDevice!=WebGestureDeviceTouchscreen), the field
43 // contains 0. See crbug.com/618738.
44 uint32_t uniqueTouchEventId;
45
46 // This field exists to allow BrowserPlugin to mark GestureScroll events as
47 // 'resent' to handle the case where an event is not consumed when first
48 // encountered; it should be handled differently by the plugin when it is
49 // sent for thesecond time. No code within Blink touches this, other than to
50 // plumb it through event conversions.
51 int resendingPluginId;
52
53 union {
54 // Tap information must be set for GestureTap, GestureTapUnconfirmed,
55 // and GestureDoubleTap events.
56 struct {
57 int tapCount;
58 float width;
59 float height;
60 } tap;
61
62 struct {
63 float width;
64 float height;
65 } tapDown;
66
67 struct {
68 float width;
69 float height;
70 } showPress;
71
72 struct {
73 float width;
74 float height;
75 } longPress;
76
77 struct {
78 float firstFingerWidth;
79 float firstFingerHeight;
80 } twoFingerTap;
81
82 struct {
83 // Initial motion that triggered the scroll.
84 // May be redundant with deltaX/deltaY in the first scrollUpdate.
85 float deltaXHint;
86 float deltaYHint;
87 // Default initialized to ScrollUnits::PrecisePixels.
88 ScrollUnits deltaHintUnits;
89 // If true, this event will skip hit testing to find a scroll
90 // target and instead just scroll the viewport.
91 bool targetViewport;
92 // The state of inertial phase scrolling. OSX has unique phases for normal
93 // and momentum scroll events. Should always be UnknownMomentumPhase for
94 // touch based input as it generates GestureFlingStart instead.
95 InertialPhaseState inertialPhase;
96 // True if this event was synthesized in order to force a hit test;
97 // avoiding scroll latching behavior until crbug.com/526463 is fully
98 // implemented.
99 bool synthetic;
100
101 // number of pointers down.
102 int pointerCount;
103 } scrollBegin;
104
105 struct {
106 float deltaX;
107 float deltaY;
108 float velocityX;
109 float velocityY;
110 // Whether any previous GestureScrollUpdate in the current scroll
111 // sequence was suppressed (e.g., the causal touchmove was
112 // preventDefault'ed). This bit is particularly useful for
113 // determining whether the observed scroll update sequence captures
114 // the entirety of the generative motion.
115 bool previousUpdateInSequencePrevented;
116 bool preventPropagation;
117 InertialPhaseState inertialPhase;
118 // Default initialized to ScrollUnits::PrecisePixels.
119 ScrollUnits deltaUnits;
120 } scrollUpdate;
121
122 struct {
123 // The original delta units the scrollBegin and scrollUpdates
124 // were sent as.
125 ScrollUnits deltaUnits;
126 // The state of inertial phase scrolling. OSX has unique phases for normal
127 // and momentum scroll events. Should always be UnknownMomentumPhase for
128 // touch based input as it generates GestureFlingStart instead.
129 InertialPhaseState inertialPhase;
130 // True if this event was synthesized in order to generate the proper
131 // GSB/GSU/GSE matching sequences. This is a temporary so that a future
132 // GSB will generate a hit test so latching behavior is avoided
133 // until crbug.com/526463 is fully implemented.
134 bool synthetic;
135 } scrollEnd;
136
137 struct {
138 float velocityX;
139 float velocityY;
140 // If true, this event will skip hit testing to find a scroll
141 // target and instead just scroll the viewport.
142 bool targetViewport;
143 } flingStart;
144
145 struct {
146 // If set to true, don't treat flingCancel
147 // as a part of fling boost events sequence.
148 bool preventBoosting;
149 } flingCancel;
150
151 struct {
152 bool zoomDisabled;
153 float scale;
154 } pinchUpdate;
155 } data;
156
157 WebGestureEvent()
158 : WebInputEvent(sizeof(WebGestureEvent)),
159 x(0),
160 y(0),
161 globalX(0),
162 globalY(0),
163 sourceDevice(WebGestureDeviceUninitialized),
164 resendingPluginId(-1) {}
165 };
166
167 #pragma pack(pop)
168
169 } // namespace blink
170
171 #endif // WebGestureEvent_h
OLDNEW
« no previous file with comments | « third_party/WebKit/public/BUILD.gn ('k') | third_party/WebKit/public/platform/WebInputEvent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698