Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1045)

Unified Diff: content/browser/renderer_host/input/touch_event_queue.cc

Issue 26923002: Consolidate WebInputEvent coalescing logic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..33717901cd1cc395dbeab6e67565624e96b98d6b 100644
--- a/content/browser/renderer_host/input/touch_event_queue.cc
+++ b/content/browser/renderer_host/input/touch_event_queue.cc
@@ -36,35 +36,17 @@ 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_) {
- TRACE_EVENT_INSTANT0(
- "input", "TouchEventQueue::MoveCoalesced", TRACE_EVENT_SCOPE_THREAD);
- 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;
- }
+ if (ignore_ack_)
+ return false;
- return false;
+ if (!coalesced_event_.CanCoalesceWith(event_with_latency))
+ return false;
+
+ TRACE_EVENT_INSTANT0(
+ "input", "TouchEventQueue::MoveCoalesced", TRACE_EVENT_SCOPE_THREAD);
+ coalesced_event_.CoalesceWith(event_with_latency);
+ events_.push_back(event_with_latency);
+ return true;
}
const TouchEventWithLatencyInfo& coalesced_event() const {
« no previous file with comments | « content/browser/renderer_host/input/immediate_input_router.cc ('k') | content/common/input/web_input_event_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698