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

Side by Side Diff: content/browser/renderer_host/input/gesture_event_queue.cc

Issue 140253005: Add touch scrolling modes experimental flags (DEPRECATED) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update for eager GR Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/input/gesture_event_queue.h" 5 #include "content/browser/renderer_host/input/gesture_event_queue.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 66
67 void GestureEventQueue::OnTouchEventAck(InputEventAckState ack_state) { 67 void GestureEventQueue::OnTouchEventAck(InputEventAckState ack_state) {
68 if (Head().IsEmpty()) { 68 if (Head().IsEmpty()) {
69 CancelTapIfNecessary(); 69 CancelTapIfNecessary();
70 CancelFlingIfNecessary(); 70 CancelFlingIfNecessary();
71 sequences_.pop(); 71 sequences_.pop();
72 } 72 }
73 73
74 GestureSequence& sequence = Head(); 74 GestureSequence& sequence = Head();
75 sequence.UpdateState(ack_state);
76 75
77 // Dispatch the packet corresponding to the ack'ed touch, as well as any 76 // Dispatch the packet corresponding to the ack'ed touch, as well as any
78 // additional timeout-based packets queued before the ack was received. 77 // additional timeout-based packets queued before the ack was received.
79 bool touch_packet_for_current_ack_handled = false; 78 bool touch_packet_for_current_ack_handled = false;
80 while (!sequence.IsEmpty()) { 79 while (!sequence.IsEmpty()) {
81 const GestureEventPacket& packet = sequence.Front(); 80 const GestureEventPacket& packet = sequence.Front();
82 81
83 if (packet.gesture_source() == GestureEventPacket::TOUCH_BEGIN || 82 if (packet.gesture_source() == GestureEventPacket::TOUCH_BEGIN ||
84 packet.gesture_source() == GestureEventPacket::TOUCH) { 83 packet.gesture_source() == GestureEventPacket::TOUCH) {
85 // We should handle at most one touch-based packet corresponding to a 84 // We should handle at most one touch-based packet corresponding to a
86 // given ack. 85 // given ack.
87 if (touch_packet_for_current_ack_handled) 86 if (touch_packet_for_current_ack_handled)
88 break; 87 break;
88 if (!packet.is_independent())
89 sequence.UpdateState(ack_state);
89 touch_packet_for_current_ack_handled = true; 90 touch_packet_for_current_ack_handled = true;
90 } 91 }
91 92
92 if (!sequence.IsGesturePrevented()) 93 // In addition to the global filtering state, independent packets may be
94 // suppressed individually by their local touch ack state.
95 if (!sequence.IsGesturePrevented() &&
96 !(packet.is_independent() &&
97 ack_state == INPUT_EVENT_ACK_STATE_CONSUMED))
93 SendPacket(packet); 98 SendPacket(packet);
94 99
95 sequence.Pop(); 100 sequence.Pop();
96 } 101 }
97 DCHECK(touch_packet_for_current_ack_handled); 102 DCHECK(touch_packet_for_current_ack_handled);
98 103
99 // Immediately cancel a TapDown if TouchStart went unconsumed, but a 104 // Immediately cancel a TapDown if TouchStart went unconsumed, but a
100 // subsequent TouchMove is consumed. 105 // subsequent TouchMove is consumed.
101 if (sequence.IsGesturePrevented()) 106 if (sequence.IsGesturePrevented())
102 CancelTapIfNecessary(); 107 CancelTapIfNecessary();
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 212
208 bool GestureEventQueue::GestureSequence::IsGesturePrevented() const { 213 bool GestureEventQueue::GestureSequence::IsGesturePrevented() const {
209 return state_ == ALWAYS_PREVENTED; 214 return state_ == ALWAYS_PREVENTED;
210 } 215 }
211 216
212 bool GestureEventQueue::GestureSequence::IsEmpty() const { 217 bool GestureEventQueue::GestureSequence::IsEmpty() const {
213 return packets_.empty(); 218 return packets_.empty();
214 } 219 }
215 220
216 } // namespace content 221 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698