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

Unified Diff: content/browser/renderer_host/input/touch_event_queue.cc

Issue 788923002: Touch Events - changedTouches list includes non-changed touch points on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stores touchevent without latency info and other review comment fixes Created 6 years 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
« no previous file with comments | « content/browser/renderer_host/input/touch_event_queue.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/input/touch_event_queue.cc
diff --git a/content/browser/renderer_host/input/touch_event_queue.cc b/content/browser/renderer_host/input/touch_event_queue.cc
index fa109dedddf9bd87868d6edbe6a7a7fc1cbe9351..9920d074a15006e642b5aa59fa4135ad15c98aec 100644
--- a/content/browser/renderer_host/input/touch_event_queue.cc
+++ b/content/browser/renderer_host/input/touch_event_queue.cc
@@ -703,7 +703,7 @@ scoped_ptr<CoalescedWebTouchEvent> TouchEventQueue::PopTouchEvent() {
}
void TouchEventQueue::SendTouchEventImmediately(
- const TouchEventWithLatencyInfo& touch) {
+ TouchEventWithLatencyInfo& touch) {
jdduke (slow) 2014/12/15 16:51:08 Nit: Either pass by const ref, or by pointer (the
USE s.singapati at gmail.com 2014/12/17 11:28:43 Done.
if (needs_async_touchmove_for_outer_slop_region_) {
// Any event other than a touchmove (e.g., touchcancel or secondary
// touchstart) after a scroll has started will interrupt the need to send a
@@ -714,6 +714,37 @@ void TouchEventQueue::SendTouchEventImmediately(
needs_async_touchmove_for_outer_slop_region_ = false;
}
+ // For touchmove events, compare touch points position from current event
+ // to last sent event and update touch points state.
+ if (touch.event.type == WebInputEvent::TouchMove) {
+ if (last_sent_touchmove_) {
+ for (unsigned int i = 0; i < last_sent_touchmove_->touchesLength; ++i) {
+ const WebTouchPoint& last_touchmove_point =
+ last_sent_touchmove_->touches[i];
+
+ // touches with same id may not have same index in touches array
+ for (unsigned int j = 0; j < touch.event.touchesLength; ++j) {
+ WebTouchPoint& current_touchmove_point = touch.event.touches[j];
+ if (last_touchmove_point.id == current_touchmove_point.id) {
+ if (fabs(current_touchmove_point.position.x -
jdduke (slow) 2014/12/15 16:51:08 Can we avoid using the epsilon? If the touch reall
USE s.singapati at gmail.com 2014/12/17 11:28:43 Done. Did more testing and no problems found.
+ last_touchmove_point.position.x) < 0.000001
+ && fabs(current_touchmove_point.position.y -
+ last_touchmove_point.position.y) < 0.000001)
+ current_touchmove_point.state = WebTouchPoint::StateStationary;
+
+ break;
+ }
+ }
+ }
+ *last_sent_touchmove_ = touch.event;
+ } else {
+ last_sent_touchmove_.reset(new WebTouchEvent(touch.event));
+ }
+ } else {
+ if (last_sent_touchmove_)
jdduke (slow) 2014/12/15 16:51:08 Nit: No need for the if, you can just unconditiona
USE s.singapati at gmail.com 2014/12/17 11:28:42 Done.
+ last_sent_touchmove_.reset();
+ }
+
client_->SendTouchEventImmediately(touch);
}
@@ -729,6 +760,8 @@ TouchEventQueue::FilterBeforeForwarding(const WebTouchEvent& event) {
touch_consumer_states_.clear();
send_touch_events_async_ = false;
pending_async_touchmove_.reset();
+ last_sent_touchmove_.reset();
+
touch_sequence_start_position_ = gfx::PointF(event.touches[0].position);
drop_remaining_touches_in_sequence_ = false;
if (!has_handlers_) {
« no previous file with comments | « content/browser/renderer_host/input/touch_event_queue.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698