Chromium Code Reviews| 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 0cfdf26add55f9f86d5db2bb9900ea2fbcdfabef..52afd71777dcf5b52b8f40d37339fa2419f3c39f 100644 |
| --- a/content/browser/renderer_host/render_widget_host_view_aura.cc |
| +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc |
| @@ -2033,23 +2033,30 @@ void RenderWidgetHostViewAura::OnTouchEvent(ui::TouchEvent* event) { |
| return; |
| // Update the touch event first. |
| - blink::WebTouchPoint* point = UpdateWebTouchEventFromUIEvent(*event, |
| - &touch_event_); |
| - |
| - // Forward the touch event only if a touch point was updated, and there's a |
| - // touch-event handler in the page, and no other touch-event is in the queue. |
| - // It is important to always consume the event if there is a touch-event |
| - // handler in the page, or some touch-event is already in the queue, even if |
| - // no point has been updated, to make sure that this event does not get |
| - // processed by the gesture recognizer before the events in the queue. |
| - if (host_->ShouldForwardTouchEvent()) |
| - event->StopPropagation(); |
| + blink::WebTouchPoint* point = |
| + UpdateWebTouchEventFromUIEvent(*event, &touch_event_); |
| + |
| + if (!point) { |
| + event->DisableSynchronousHandling(); |
|
jdduke (slow)
2014/11/25 20:26:36
Does this behave differently than just marking the
tdresser
2014/11/26 15:17:18
We need to distinguish between the case where an e
tdresser
2014/11/28 18:33:37
Oh, you're right.
I do still need that flag, but I
|
| + // Mark the most recent touch event as handled, as it wasn't valid. |
| + ui::GestureRecognizer::Get()->AckSyncTouchEvent(*event, ui::ER_HANDLED, |
| + window_); |
| + return; |
| + } |
| - if (point) { |
| - if (host_->ShouldForwardTouchEvent()) |
| - host_->ForwardTouchEventWithLatencyInfo(touch_event_, *event->latency()); |
| - UpdateWebTouchEventAfterDispatch(&touch_event_, point); |
| + // Forward the touch event only if a touch point was updated, and |
| + // there's a touch-event handler in the page, and no other |
| + // touch-event is in the queue. It is important to always mark |
| + // events as being handled asynchronously if there is a touch-event |
| + // handler in the page, or some touch-event is already in the queue, |
| + // even if no point has been updated. This ensures that this event |
| + // does not get processed by the gesture recognizer before events |
| + // currently awaiting dispatch in the touch queue. |
| + if (host_->ShouldForwardTouchEvent()) { |
| + event->DisableSynchronousHandling(); |
| + host_->ForwardTouchEventWithLatencyInfo(touch_event_, *event->latency()); |
| } |
| + UpdateWebTouchEventAfterDispatch(&touch_event_, point); |
| } |
| void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { |