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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 1120293003: Make sure send one WebTouchEvent ack per ui::TouchEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_aura_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_aura.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc
index fd85fcc8745cdf59c93e87322518bda129aff961..dfd8ae2f76072577a455b63eb6854d1b1d748c7e 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -277,6 +277,20 @@ bool IsFractionalScaleFactor(float scale_factor) {
return (scale_factor - static_cast<int>(scale_factor)) > 0;
}
+// Reset unchanged touch point to StateStationary for touchmove and
+// touchcancel.
+void MarkUnchangedTouchPointsAsStationary(
+ blink::WebTouchEvent* event,
+ int changed_touch_id) {
+ if (event->type == blink::WebInputEvent::TouchMove ||
+ event->type == blink::WebInputEvent::TouchCancel) {
+ for (size_t i = 0; i < event->touchesLength; ++i) {
+ if (event->touches[i].id != changed_touch_id)
+ event->touches[i].state = blink::WebTouchPoint::StateStationary;
+ }
+ }
+}
+
} // namespace
// We need to watch for mouse events outside a Web Popup or its parent
@@ -1282,10 +1296,14 @@ void RenderWidgetHostViewAura::ProcessAckedTouchEvent(
break;
}
- // Only send acks for changed touches.
+ // Only send acks for one changed touch point.
+ bool sent_ack = false;
for (size_t i = 0; i < touch.event.touchesLength; ++i) {
- if (touch.event.touches[i].state == required_state)
+ if (touch.event.touches[i].state == required_state) {
+ DCHECK(!sent_ack);
host->dispatcher()->ProcessedTouchEvent(window_, result);
+ sent_ack = true;
+ }
}
}
@@ -2184,6 +2202,10 @@ void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) {
// processed by the gesture recognizer before events currently awaiting
// dispatch in the touch queue.
event->DisableSynchronousHandling();
+
+ // Set unchanged touch point to StateStationary for touchmove and
+ // touchcancel to make sure only send one ack per WebTouchEvent.
+ MarkUnchangedTouchPointsAsStationary(&touch_event, event->touch_id());
host_->ForwardTouchEventWithLatencyInfo(touch_event, *event->latency());
}
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_aura_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698