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

Side by Side Diff: third_party/WebKit/Source/platform/PlatformGestureEvent.h

Issue 1829743003: Fix missing fields in GestureScrollBegin/Update/End event conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tdresser's comments in patch set 1 Created 4 years, 9 months 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 const IntPoint& position() const { return m_position; } // PlatformWindow co ordinates. 93 const IntPoint& position() const { return m_position; } // PlatformWindow co ordinates.
94 const IntPoint& globalPosition() const { return m_globalPosition; } // Scree n coordinates. 94 const IntPoint& globalPosition() const { return m_globalPosition; } // Scree n coordinates.
95 95
96 const IntSize& area() const { return m_area; } 96 const IntSize& area() const { return m_area; }
97 97
98 PlatformGestureSource source() const { return m_source; } 98 PlatformGestureSource source() const { return m_source; }
99 99
100 float deltaX() const 100 float deltaX() const
101 { 101 {
102 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); 102 ASSERT(m_type == PlatformEvent::GestureScrollBegin || m_type == Platform Event::GestureScrollUpdate);
103 return m_data.m_scroll.m_deltaX; 103 return m_data.m_scroll.m_deltaX;
104 } 104 }
105 105
106 float deltaY() const 106 float deltaY() const
107 { 107 {
108 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); 108 ASSERT(m_type == PlatformEvent::GestureScrollBegin || m_type == Platform Event::GestureScrollUpdate);
109 return m_data.m_scroll.m_deltaY; 109 return m_data.m_scroll.m_deltaY;
110 } 110 }
111 111
112 ScrollGranularity deltaUnits() const 112 ScrollGranularity deltaUnits() const
113 { 113 {
114 ASSERT(m_type == PlatformEvent::GestureScrollUpdate); 114 ASSERT(m_type == PlatformEvent::GestureScrollBegin || m_type == Platform Event::GestureScrollUpdate || m_type == PlatformEvent::GestureScrollEnd);
115 return m_data.m_scroll.m_deltaUnits; 115 return m_data.m_scroll.m_deltaUnits;
116 } 116 }
117 117
118 int tapCount() const 118 int tapCount() const
119 { 119 {
120 ASSERT(m_type == PlatformEvent::GestureTap); 120 ASSERT(m_type == PlatformEvent::GestureTap);
121 return m_data.m_tap.m_tapCount; 121 return m_data.m_tap.m_tapCount;
122 } 122 }
123 123
124 float velocityX() const 124 float velocityX() const
125 { 125 {
126 ASSERT(m_type == PlatformEvent::GestureScrollUpdate || m_type == Platfor mEvent::GestureFlingStart); 126 ASSERT(m_type == PlatformEvent::GestureScrollUpdate || m_type == Platfor mEvent::GestureFlingStart);
127 return m_data.m_scroll.m_velocityX; 127 return m_data.m_scroll.m_velocityX;
128 } 128 }
129 129
130 float velocityY() const 130 float velocityY() const
131 { 131 {
132 ASSERT(m_type == PlatformEvent::GestureScrollUpdate || m_type == Platfor mEvent::GestureFlingStart); 132 ASSERT(m_type == PlatformEvent::GestureScrollUpdate || m_type == Platfor mEvent::GestureFlingStart);
133 return m_data.m_scroll.m_velocityY; 133 return m_data.m_scroll.m_velocityY;
134 } 134 }
135 135
136 bool inertial() const 136 bool inertial() const
137 { 137 {
138 ASSERT(m_type == PlatformEvent::GestureScrollUpdate || m_type == Platfor mEvent::GestureScrollEnd); 138 ASSERT(m_type == PlatformEvent::GestureScrollBegin || m_type == Platform Event::GestureScrollUpdate || m_type == PlatformEvent::GestureScrollEnd);
139 return m_data.m_scroll.m_inertial; 139 return m_data.m_scroll.m_inertial;
140 } 140 }
141 141
142 bool synthetic() const
143 {
144 ASSERT(m_type == PlatformEvent::GestureScrollBegin || m_type == Platform Event::GestureScrollEnd);
145 return m_data.m_scroll.m_synthetic;
146 }
147
142 int resendingPluginId() const 148 int resendingPluginId() const
143 { 149 {
144 if (m_type == PlatformEvent::GestureScrollUpdate 150 if (m_type == PlatformEvent::GestureScrollUpdate
145 || m_type == PlatformEvent::GestureScrollBegin 151 || m_type == PlatformEvent::GestureScrollBegin
146 || m_type == PlatformEvent::GestureScrollEnd) 152 || m_type == PlatformEvent::GestureScrollEnd)
147 return m_data.m_scroll.m_resendingPluginId; 153 return m_data.m_scroll.m_resendingPluginId;
148 154
149 // This function is called by *all* gesture event types in 155 // This function is called by *all* gesture event types in
150 // GestureEvent::Create(), so we return -1 for all other types. 156 // GestureEvent::Create(), so we return -1 for all other types.
151 return -1; 157 return -1;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 IntPoint m_globalPosition; 213 IntPoint m_globalPosition;
208 IntSize m_area; 214 IntSize m_area;
209 PlatformGestureSource m_source; 215 PlatformGestureSource m_source;
210 216
211 union { 217 union {
212 struct { 218 struct {
213 int m_tapCount; 219 int m_tapCount;
214 } m_tap; 220 } m_tap;
215 221
216 struct { 222 struct {
223 // |m_deltaX| and |m_deltaY| represent deltas in GSU but
224 // are only hints in GSB.
217 float m_deltaX; 225 float m_deltaX;
218 float m_deltaY; 226 float m_deltaY;
219 float m_velocityX; 227 float m_velocityX;
220 float m_velocityY; 228 float m_velocityY;
221 int m_preventPropagation; 229 int m_preventPropagation;
222 bool m_inertial; 230 bool m_inertial;
223 ScrollGranularity m_deltaUnits; 231 ScrollGranularity m_deltaUnits;
224 int m_resendingPluginId; 232 int m_resendingPluginId;
233 bool m_synthetic;
225 } m_scroll; 234 } m_scroll;
226 235
227 struct { 236 struct {
228 float m_scale; 237 float m_scale;
229 } m_pinchUpdate; 238 } m_pinchUpdate;
230 } m_data; 239 } m_data;
231 }; 240 };
232 241
233 } // namespace blink 242 } // namespace blink
234 243
235 #endif // PlatformGestureEvent_h 244 #endif // PlatformGestureEvent_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/events/GestureEvent.cpp ('k') | third_party/WebKit/Source/web/WebInputEventConversion.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698