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 c22cbc51f38e296809ac32f8f160864d6c63392b..6a9bbe2667e13668287e5f9147e99dc8e347148d 100644 |
--- a/content/browser/renderer_host/input/touch_event_queue.cc |
+++ b/content/browser/renderer_host/input/touch_event_queue.cc |
@@ -107,7 +107,7 @@ class TouchEventQueue::TouchTimeoutHandler { |
SetPendingAckState(PENDING_ACK_CANCEL_EVENT); |
TouchEventWithLatencyInfo cancel_event = |
ObtainCancelEventForTouchEvent(timeout_event_); |
- touch_queue_->SendTouchEventImmediately(cancel_event); |
+ touch_queue_->SendTouchEventImmediately(&cancel_event); |
} else { |
SetPendingAckState(PENDING_ACK_NONE); |
touch_queue_->UpdateTouchConsumerStates(timeout_event_.event, |
@@ -515,7 +515,7 @@ void TouchEventQueue::ForwardNextEventToRenderer() { |
pending_async_touchmove_.Pass(); |
async_move->event.cancelable = false; |
touch_queue_.push_front(new CoalescedWebTouchEvent(*async_move, true)); |
- SendTouchEventImmediately(*async_move); |
+ SendTouchEventImmediately(async_move.get()); |
return; |
} |
} |
@@ -529,7 +529,7 @@ void TouchEventQueue::ForwardNextEventToRenderer() { |
// A synchronous ack will reset |dispatching_touch_|, in which case |
// the touch timeout should not be started. |
base::AutoReset<bool> dispatching_touch(&dispatching_touch_, true); |
- SendTouchEventImmediately(touch); |
+ SendTouchEventImmediately(&touch); |
if (dispatching_touch_ && timeout_handler_) |
timeout_handler_->StartIfNecessary(touch); |
} |
@@ -693,18 +693,44 @@ scoped_ptr<CoalescedWebTouchEvent> TouchEventQueue::PopTouchEvent() { |
} |
void TouchEventQueue::SendTouchEventImmediately( |
- const TouchEventWithLatencyInfo& touch) { |
+ TouchEventWithLatencyInfo* touch) { |
if (needs_async_touchmove_for_outer_slop_region_) { |
// Any event other than a touchmove (e.g., touchcancel or secondary |
// touchstart) after a scroll has started will interrupt the need to send a |
// an outer slop-region exceeding touchmove. |
- if (touch.event.type != WebInputEvent::TouchMove || |
- OutsideApplicationSlopRegion(touch.event, |
+ if (touch->event.type != WebInputEvent::TouchMove || |
+ OutsideApplicationSlopRegion(touch->event, |
touch_sequence_start_position_)) |
needs_async_touchmove_for_outer_slop_region_ = false; |
} |
- client_->SendTouchEventImmediately(touch); |
+ // For touchmove events, compare touch points position from current event |
+ // to last sent event and update touch points state. |
+ if (touch->event.type == WebInputEvent::TouchMove) { |
+ CHECK(last_sent_touchevent_); |
+ for (unsigned int i = 0; i < last_sent_touchevent_->touchesLength; ++i) { |
+ const WebTouchPoint& last_touch_point = |
+ last_sent_touchevent_->touches[i]; |
+ // Touches with same id may not have same index in Touches array. |
+ for (unsigned int j = 0; j < touch->event.touchesLength; ++j) { |
+ const WebTouchPoint& current_touchmove_point = touch->event.touches[j]; |
+ if (current_touchmove_point.id != last_touch_point.id) |
+ continue; |
+ |
+ if (current_touchmove_point.position == last_touch_point.position) |
jdduke (slow)
2015/01/26 16:18:13
So, now I'm wondering if we should also check the
|
+ touch->event.touches[j].state = WebTouchPoint::StateStationary; |
+ |
+ break; |
+ } |
+ } |
+ } |
+ |
+ if (last_sent_touchevent_) |
+ *last_sent_touchevent_ = touch->event; |
+ else |
+ last_sent_touchevent_.reset(new WebTouchEvent(touch->event)); |
+ |
+ client_->SendTouchEventImmediately(*touch); |
} |
TouchEventQueue::PreFilterResult |
@@ -719,6 +745,8 @@ TouchEventQueue::FilterBeforeForwarding(const WebTouchEvent& event) { |
touch_consumer_states_.clear(); |
send_touch_events_async_ = false; |
pending_async_touchmove_.reset(); |
+ last_sent_touchevent_.reset(); |
+ |
touch_sequence_start_position_ = gfx::PointF(event.touches[0].position); |
drop_remaining_touches_in_sequence_ = false; |
if (!has_handlers_) { |