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

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

Issue 916103002: Avoid sending touchmove events where all pointers are stationary (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert TouchMove acks to NO_CONSUMER_EXISTS. Created 5 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: 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 6adc661be18c5394f4571ac2d037c11b74133cda..6bc5cb9421fa0af4fc974672985c7a697d3a4d7e 100644
--- a/content/browser/renderer_host/input/touch_event_queue.cc
+++ b/content/browser/renderer_host/input/touch_event_queue.cc
@@ -46,14 +46,15 @@ bool ShouldTouchTriggerTimeout(const WebTouchEvent& event) {
}
// Compare all properties of touch points to determine the state.
-bool HasPointChanged(const WebTouchPoint& last_point,
- const WebTouchPoint& current_point) {
- if (last_point.screenPosition != current_point.screenPosition ||
- last_point.position != current_point.position ||
- last_point.radiusX != current_point.radiusX ||
- last_point.radiusY != current_point.radiusY ||
- last_point.rotationAngle != current_point.rotationAngle ||
- last_point.force != current_point.force) {
+bool HasPointChanged(const WebTouchPoint& point_1,
+ const WebTouchPoint& point_2) {
+ DCHECK_EQ(point_1.id, point_2.id);
+ if (point_1.screenPosition != point_2.screenPosition ||
+ point_1.position != point_2.position ||
+ point_1.radiusX != point_2.radiusX ||
+ point_1.radiusY != point_2.radiusY ||
+ point_1.rotationAngle != point_2.rotationAngle ||
+ point_1.force != point_2.force) {
return true;
}
return false;
@@ -729,9 +730,24 @@ TouchEventQueue::FilterBeforeForwarding(const WebTouchEvent& event) {
continue;
for (size_t j = 0; j < last_sent_touchevent_->touchesLength; ++j) {
- if (point.id == last_sent_touchevent_->touches[j].id)
+ if (point.id != last_sent_touchevent_->touches[j].id)
+ continue;
+
+ if (event.type != WebInputEvent::TouchMove)
+ return FORWARD_TO_RENDERER;
+
+ // All pointers in TouchMove events may have state as StateMoved,
+ // even though none of the pointers have not changed in real.
+ // Forward these events when at least one pointer has changed.
+ if (HasPointChanged(last_sent_touchevent_->touches[j], point))
return FORWARD_TO_RENDERER;
+
+ // This is a TouchMove event for which we have yet to find a
+ // non-stationary pointer. Continue checking the next pointers
+ // in the |event|.
+ break;
}
+
}
}

Powered by Google App Engine
This is Rietveld 408576698