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

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

Issue 140253005: Add touch scrolling modes experimental flags (DEPRECATED) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address my own nits. Created 6 years, 11 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
« no previous file with comments | « content/browser/renderer_host/input/touch_event_queue.h ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ee1c7c242ef3faae6f696a758241c2a3557443f8..81c3e4777755237929f7364ea5565eedb4e3ce4a 100644
--- a/content/browser/renderer_host/input/touch_event_queue.cc
+++ b/content/browser/renderer_host/input/touch_event_queue.cc
@@ -235,12 +235,15 @@ class CoalescedWebTouchEvent {
DISALLOW_COPY_AND_ASSIGN(CoalescedWebTouchEvent);
};
-TouchEventQueue::TouchEventQueue(TouchEventQueueClient* client)
+TouchEventQueue::TouchEventQueue(TouchEventQueueClient* client,
+ TouchScrollingMode mode)
: client_(client),
dispatching_touch_ack_(NULL),
dispatching_touch_(false),
touch_filtering_state_(TOUCH_FILTERING_STATE_DEFAULT),
- ack_timeout_enabled_(false) {
+ ack_timeout_enabled_(false),
+ touch_scrolling_mode_(mode),
+ absorbing_touch_moves_(false) {
DCHECK(client);
}
@@ -326,6 +329,7 @@ void TouchEventQueue::ForwardToRenderer(
ack_timeout_enabled_ ? FORWARD_TOUCHES_UNTIL_TIMEOUT
: FORWARD_ALL_TOUCHES;
touch_ack_states_.clear();
+ absorbing_touch_moves_ = false;
}
// A synchronous ack will reset |dispatching_touch_|, in which case
@@ -345,6 +349,9 @@ void TouchEventQueue::OnGestureScrollEvent(
if (gesture_event.event.type != blink::WebInputEvent::GestureScrollBegin)
return;
+ if (touch_scrolling_mode_ != TOUCH_SCROLLING_MODE_TOUCHCANCEL)
+ return;
+
// We assume that scroll events are generated synchronously from
// dispatching a touch event ack. This allows us to generate a synthetic
// cancel event that has the same touch ids as the touch event that
@@ -368,6 +375,25 @@ void TouchEventQueue::OnGestureScrollEvent(
dispatching_touch_ack_->coalesced_event()), true));
}
+void TouchEventQueue::OnGestureEventAck(
+ const GestureEventWithLatencyInfo& event,
+ InputEventAckState ack_result) {
+ if (touch_scrolling_mode_ != TOUCH_SCROLLING_MODE_ABSORB_TOUCHMOVE)
+ return;
+
+ if (event.event.type != blink::WebInputEvent::GestureScrollUpdate)
+ return;
+
+ // Suspend sending touchmove events as long as the scroll events are handled.
+ // Note that there's no guarantee that this ACK is for the most recent
+ // gesture event (or even part of the current sequence). Worse case, the
+ // delay in updating the absorption state should onl result in minor UI
+ // glitches.
+ // TODO(rbyers): Define precise timing requirements and potentially implement
+ // mitigations for races.
+ absorbing_touch_moves_ = (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED);
+}
+
void TouchEventQueue::OnHasTouchEventHandlers(bool has_handlers) {
DCHECK(!dispatching_touch_ack_);
DCHECK(!dispatching_touch_);
@@ -478,6 +504,9 @@ bool TouchEventQueue::ShouldForwardToRenderer(
return false;
}
+ if (absorbing_touch_moves_ && event.type == WebInputEvent::TouchMove)
+ return false;
+
// Touch press events should always be forwarded to the renderer.
if (event.type == WebInputEvent::TouchStart)
return true;
« no previous file with comments | « content/browser/renderer_host/input/touch_event_queue.h ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698