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 9620b50ab2fa09e5d0d6a30ed9f9830c6accafb3..d1b8c8bf6bb1755186cb09250800e3ff4a3e479e 100644 |
--- a/content/browser/renderer_host/input/touch_event_queue.cc |
+++ b/content/browser/renderer_host/input/touch_event_queue.cc |
@@ -20,8 +20,7 @@ typedef std::vector<TouchEventWithLatencyInfo> WebTouchEventWithLatencyList; |
class CoalescedWebTouchEvent { |
public: |
explicit CoalescedWebTouchEvent(const TouchEventWithLatencyInfo& event) |
- : coalesced_event_(event), |
- ignore_ack_(false) { |
+ : coalesced_event_(event) { |
events_.push_back(event); |
TRACE_EVENT_ASYNC_BEGIN0( |
"input", "TouchEventQueue::QueueEvent", this); |
@@ -36,31 +35,12 @@ class CoalescedWebTouchEvent { |
// the event was coalesced. |
bool CoalesceEventIfPossible( |
const TouchEventWithLatencyInfo& event_with_latency) { |
- if (coalesced_event_.event.type == WebKit::WebInputEvent::TouchMove && |
- event_with_latency.event.type == WebKit::WebInputEvent::TouchMove && |
- coalesced_event_.event.modifiers == |
- event_with_latency.event.modifiers && |
- coalesced_event_.event.touchesLength == |
- event_with_latency.event.touchesLength && |
- !ignore_ack_) { |
+ if (!ignore_ack_ && |
+ coalesced_event_.CanCoalesceWith(event_with_latency)) { |
TRACE_EVENT_INSTANT0( |
"input", "TouchEventQueue::MoveCoalesced", TRACE_EVENT_SCOPE_THREAD); |
+ coalesced_event_.CoalesceWith(event_with_latency); |
events_.push_back(event_with_latency); |
- // The WebTouchPoints include absolute position information. So it is |
- // sufficient to simply replace the previous event with the new event. |
- // However, it is necessary to make sure that all the points have the |
- // correct state, i.e. the touch-points that moved in the last event, but |
- // didn't change in the current event, will have Stationary state. It is |
- // necessary to change them back to Moved state. |
- const WebKit::WebTouchEvent last_event = coalesced_event_.event; |
- const ui::LatencyInfo last_latency = coalesced_event_.latency; |
- coalesced_event_ = event_with_latency; |
- coalesced_event_.latency.MergeWith(last_latency); |
- for (unsigned i = 0; i < last_event.touchesLength; ++i) { |
- if (last_event.touches[i].state == WebKit::WebTouchPoint::StateMoved) |
- coalesced_event_.event.touches[i].state = |
- WebKit::WebTouchPoint::StateMoved; |
- } |
return true; |
} |