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

Side by Side Diff: content/common/input/synthetic_web_input_event_builders.cc

Issue 1645613007: Redefined the bit WebTouchEvent.causesScrollingIfUncanceled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed an aura unittest. Created 4 years, 10 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/input/synthetic_web_input_event_builders.h" 5 #include "content/common/input/synthetic_web_input_event_builders.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/common/input/web_touch_event_traits.h" 8 #include "content/common/input/web_touch_event_traits.h"
9 #include "ui/events/base_event_utils.h" 9 #include "ui/events/base_event_utils.h"
10 #include "ui/events/keycodes/keyboard_codes.h" 10 #include "ui/events/keycodes/keyboard_codes.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 for (unsigned int i = 0; i < touchesLength; ++i) { 164 for (unsigned int i = 0; i < touchesLength; ++i) {
165 if (touches[i].state == WebTouchPoint::StateReleased) 165 if (touches[i].state == WebTouchPoint::StateReleased)
166 continue; 166 continue;
167 167
168 touches[point] = touches[i]; 168 touches[point] = touches[i];
169 touches[point].state = WebTouchPoint::StateStationary; 169 touches[point].state = WebTouchPoint::StateStationary;
170 ++point; 170 ++point;
171 } 171 }
172 touchesLength = point; 172 touchesLength = point;
173 type = WebInputEvent::Undefined; 173 type = WebInputEvent::Undefined;
174 causesScrollingIfUncanceled = false; 174 movedBeyondSlopRegion = false;
175 uniqueTouchEventId = ui::GetNextTouchEventId(); 175 uniqueTouchEventId = ui::GetNextTouchEventId();
176 } 176 }
177 177
178 int SyntheticWebTouchEvent::PressPoint(float x, float y) { 178 int SyntheticWebTouchEvent::PressPoint(float x, float y) {
179 if (touchesLength == touchesLengthCap) 179 if (touchesLength == touchesLengthCap)
180 return -1; 180 return -1;
181 WebTouchPoint& point = touches[touchesLength]; 181 WebTouchPoint& point = touches[touchesLength];
182 point.id = touchesLength; 182 point.id = touchesLength;
183 point.position.x = point.screenPosition.x = x; 183 point.position.x = point.screenPosition.x = x;
184 point.position.y = point.screenPosition.y = y; 184 point.position.y = point.screenPosition.y = y;
185 point.state = WebTouchPoint::StatePressed; 185 point.state = WebTouchPoint::StatePressed;
186 point.radiusX = point.radiusY = 1.f; 186 point.radiusX = point.radiusY = 1.f;
187 point.rotationAngle = 1.f; 187 point.rotationAngle = 1.f;
188 point.force = 1.f; 188 point.force = 1.f;
189 point.tiltX = point.tiltY = 0; 189 point.tiltX = point.tiltY = 0;
190 ++touchesLength; 190 ++touchesLength;
191 WebTouchEventTraits::ResetType( 191 WebTouchEventTraits::ResetType(
192 WebInputEvent::TouchStart, timeStampSeconds, this); 192 WebInputEvent::TouchStart, timeStampSeconds, this);
193 return point.id; 193 return point.id;
194 } 194 }
195 195
196 void SyntheticWebTouchEvent::MovePoint(int index, float x, float y) { 196 void SyntheticWebTouchEvent::MovePoint(int index, float x, float y) {
197 CHECK_GE(index, 0); 197 CHECK_GE(index, 0);
198 CHECK_LT(index, touchesLengthCap); 198 CHECK_LT(index, touchesLengthCap);
199 // Always set this bit to avoid otherwise unexpected touchmove suppression. 199 // Always set this bit to avoid otherwise unexpected touchmove suppression.
200 // The caller can opt-out explicitly, if necessary. 200 // The caller can opt-out explicitly, if necessary.
201 causesScrollingIfUncanceled = true; 201 movedBeyondSlopRegion = true;
202 WebTouchPoint& point = touches[index]; 202 WebTouchPoint& point = touches[index];
203 point.position.x = point.screenPosition.x = x; 203 point.position.x = point.screenPosition.x = x;
204 point.position.y = point.screenPosition.y = y; 204 point.position.y = point.screenPosition.y = y;
205 touches[index].state = WebTouchPoint::StateMoved; 205 touches[index].state = WebTouchPoint::StateMoved;
206 WebTouchEventTraits::ResetType( 206 WebTouchEventTraits::ResetType(
207 WebInputEvent::TouchMove, timeStampSeconds, this); 207 WebInputEvent::TouchMove, timeStampSeconds, this);
208 } 208 }
209 209
210 void SyntheticWebTouchEvent::ReleasePoint(int index) { 210 void SyntheticWebTouchEvent::ReleasePoint(int index) {
211 CHECK_GE(index, 0); 211 CHECK_GE(index, 0);
212 CHECK_LT(index, touchesLengthCap); 212 CHECK_LT(index, touchesLengthCap);
213 touches[index].state = WebTouchPoint::StateReleased; 213 touches[index].state = WebTouchPoint::StateReleased;
214 WebTouchEventTraits::ResetType( 214 WebTouchEventTraits::ResetType(
215 WebInputEvent::TouchEnd, timeStampSeconds, this); 215 WebInputEvent::TouchEnd, timeStampSeconds, this);
216 } 216 }
217 217
218 void SyntheticWebTouchEvent::CancelPoint(int index) { 218 void SyntheticWebTouchEvent::CancelPoint(int index) {
219 CHECK_GE(index, 0); 219 CHECK_GE(index, 0);
220 CHECK_LT(index, touchesLengthCap); 220 CHECK_LT(index, touchesLengthCap);
221 touches[index].state = WebTouchPoint::StateCancelled; 221 touches[index].state = WebTouchPoint::StateCancelled;
222 WebTouchEventTraits::ResetType( 222 WebTouchEventTraits::ResetType(
223 WebInputEvent::TouchCancel, timeStampSeconds, this); 223 WebInputEvent::TouchCancel, timeStampSeconds, this);
224 } 224 }
225 225
226 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) { 226 void SyntheticWebTouchEvent::SetTimestamp(base::TimeDelta timestamp) {
227 timeStampSeconds = timestamp.InSecondsF(); 227 timeStampSeconds = timestamp.InSecondsF();
228 } 228 }
229 229
230 } // namespace content 230 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_android.cc ('k') | content/common/input/web_input_event_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698