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

Unified Diff: ui/events/android/motion_event_android.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 side-by-side diff with in-line comments
Download patch
Index: ui/events/android/motion_event_android.cc
diff --git a/ui/events/android/motion_event_android.cc b/ui/events/android/motion_event_android.cc
index ee645bfc80e25d19e1596ce70994b404e7a33867..8e99aa3866b8d2e05e6d01c584f65f49eb460b4c 100644
--- a/ui/events/android/motion_event_android.cc
+++ b/ui/events/android/motion_event_android.cc
@@ -229,8 +229,8 @@ MotionEventAndroid::Action MotionEventAndroid::GetAction() const {
}
int MotionEventAndroid::GetActionIndex() const {
- DCHECK(cached_action_ == ACTION_POINTER_UP ||
- cached_action_ == ACTION_POINTER_DOWN)
+ DCHECK(cached_action_ == MotionEvent::ACTION_POINTER_UP ||
+ cached_action_ == MotionEvent::ACTION_POINTER_DOWN)
<< "Invalid action for GetActionIndex(): " << cached_action_;
DCHECK_GE(cached_action_index_, 0);
DCHECK_LT(cached_action_index_, static_cast<int>(cached_pointer_count_));
@@ -304,6 +304,8 @@ float MotionEventAndroid::GetPressure(size_t pointer_index) const {
// accessed at most once per event instance).
if (!event_.obj())
return 0.f;
+ if (cached_action_ == MotionEvent::ACTION_UP)
+ return 0.f;
return Java_MotionEvent_getPressureF_I(AttachCurrentThread(), event_,
pointer_index);
}

Powered by Google App Engine
This is Rietveld 408576698