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()); |
} |