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

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

Issue 2700623003: Make sure that the pressure is always 0 for pointerup events (Closed)
Patch Set: pressure Created 3 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/event.h" 10 #include "ui/events/event.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 point.position.y = point.screenPosition.y = y; 223 point.position.y = point.screenPosition.y = y;
224 touches[index].state = WebTouchPoint::StateMoved; 224 touches[index].state = WebTouchPoint::StateMoved;
225 WebTouchEventTraits::ResetType(WebInputEvent::TouchMove, timeStampSeconds(), 225 WebTouchEventTraits::ResetType(WebInputEvent::TouchMove, timeStampSeconds(),
226 this); 226 this);
227 } 227 }
228 228
229 void SyntheticWebTouchEvent::ReleasePoint(int index) { 229 void SyntheticWebTouchEvent::ReleasePoint(int index) {
230 CHECK_GE(index, 0); 230 CHECK_GE(index, 0);
231 CHECK_LT(index, kTouchesLengthCap); 231 CHECK_LT(index, kTouchesLengthCap);
232 touches[index].state = WebTouchPoint::StateReleased; 232 touches[index].state = WebTouchPoint::StateReleased;
233 touches[index].force = 0.f;
233 WebTouchEventTraits::ResetType(WebInputEvent::TouchEnd, timeStampSeconds(), 234 WebTouchEventTraits::ResetType(WebInputEvent::TouchEnd, timeStampSeconds(),
234 this); 235 this);
235 } 236 }
236 237
237 void SyntheticWebTouchEvent::CancelPoint(int index) { 238 void SyntheticWebTouchEvent::CancelPoint(int index) {
238 CHECK_GE(index, 0); 239 CHECK_GE(index, 0);
239 CHECK_LT(index, kTouchesLengthCap); 240 CHECK_LT(index, kTouchesLengthCap);
240 touches[index].state = WebTouchPoint::StateCancelled; 241 touches[index].state = WebTouchPoint::StateCancelled;
241 WebTouchEventTraits::ResetType(WebInputEvent::TouchCancel, timeStampSeconds(), 242 WebTouchEventTraits::ResetType(WebInputEvent::TouchCancel, timeStampSeconds(),
242 this); 243 this);
243 } 244 }
244 245
245 void SyntheticWebTouchEvent::SetTimestamp(base::TimeTicks timestamp) { 246 void SyntheticWebTouchEvent::SetTimestamp(base::TimeTicks timestamp) {
246 setTimeStampSeconds(ui::EventTimeStampToSeconds(timestamp)); 247 setTimeStampSeconds(ui::EventTimeStampToSeconds(timestamp));
247 } 248 }
248 249
249 int SyntheticWebTouchEvent::FirstFreeIndex() { 250 int SyntheticWebTouchEvent::FirstFreeIndex() {
250 for (size_t i = 0; i < kTouchesLengthCap; ++i) { 251 for (size_t i = 0; i < kTouchesLengthCap; ++i) {
251 if (touches[i].state == WebTouchPoint::StateUndefined) 252 if (touches[i].state == WebTouchPoint::StateUndefined)
252 return i; 253 return i;
253 } 254 }
254 return -1; 255 return -1;
255 } 256 }
256 257
257 } // namespace content 258 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698