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

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

Powered by Google App Engine
This is Rietveld 408576698