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 49ee8e48f09e47f0b9305899e12443c993a9e26f..095d30d222c1e9380608dc6f18792c57c0af7fd9 100644 |
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc |
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc |
@@ -27,6 +27,7 @@ |
#include "content/browser/renderer_host/compositor_resize_lock_aura.h" |
#include "content/browser/renderer_host/dip_util.h" |
#include "content/browser/renderer_host/input/synthetic_gesture_target_aura.h" |
+#include "content/browser/renderer_host/input/web_input_event_util.h" |
#include "content/browser/renderer_host/overscroll_controller.h" |
#include "content/browser/renderer_host/render_view_host_delegate.h" |
#include "content/browser/renderer_host/render_view_host_impl.h" |
@@ -229,22 +230,6 @@ BOOL CALLBACK DismissOwnedPopups(HWND window, LPARAM arg) { |
} |
#endif |
-void UpdateWebTouchEventAfterDispatch(blink::WebTouchEvent* event, |
- blink::WebTouchPoint* point) { |
- if (point->state != blink::WebTouchPoint::StateReleased && |
- point->state != blink::WebTouchPoint::StateCancelled) |
- return; |
- |
- const unsigned new_length = event->touchesLength - 1; |
- // Work around a gcc 4.9 bug. crbug.com/392872 |
- if (new_length >= event->touchesLengthCap) |
- return; |
- |
- for (unsigned i = point - event->touches; i < new_length; ++i) |
- event->touches[i] = event->touches[i + 1]; |
- event->touchesLength = new_length; |
-} |
- |
bool CanRendererHandleEvent(const ui::MouseEvent* event) { |
if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED) |
return false; |
@@ -1922,22 +1907,19 @@ 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()) |
+ pointer_state_.OnTouch(*event); |
+ touch_event_ = CreateWebTouchEventFromMotionEvent(pointer_state_); |
+ pointer_state_.CleanupRemovedTouchPoints(*event); |
+ |
+ // Forward the touch event only if 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(); |
- |
- if (point) { |
- if (host_->ShouldForwardTouchEvent()) |
- host_->ForwardTouchEventWithLatencyInfo(touch_event_, *event->latency()); |
- UpdateWebTouchEventAfterDispatch(&touch_event_, point); |
+ host_->ForwardTouchEventWithLatencyInfo(touch_event_, *event->latency()); |
} |
} |