OLD | NEW |
---|---|
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/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "content/browser/renderer_host/input/input_router.h" | 10 #include "content/browser/renderer_host/input/input_router.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 base::TimeDelta::FromMilliseconds(debounce_interval_time_ms_), | 77 base::TimeDelta::FromMilliseconds(debounce_interval_time_ms_), |
78 this, | 78 this, |
79 &GestureEventQueue::SendScrollEndingEventsNow); | 79 &GestureEventQueue::SendScrollEndingEventsNow); |
80 } else { | 80 } else { |
81 // Extend the bounce interval. | 81 // Extend the bounce interval. |
82 debounce_deferring_timer_.Reset(); | 82 debounce_deferring_timer_.Reset(); |
83 } | 83 } |
84 scrolling_in_progress_ = true; | 84 scrolling_in_progress_ = true; |
85 debouncing_deferral_queue_.clear(); | 85 debouncing_deferral_queue_.clear(); |
86 return true; | 86 return true; |
87 | |
jam
2014/03/19 16:44:36
ditto
Peter Kasting
2014/03/19 21:10:57
Done.
| |
87 case WebInputEvent::GesturePinchBegin: | 88 case WebInputEvent::GesturePinchBegin: |
88 case WebInputEvent::GesturePinchEnd: | 89 case WebInputEvent::GesturePinchEnd: |
89 case WebInputEvent::GesturePinchUpdate: | 90 case WebInputEvent::GesturePinchUpdate: |
90 // TODO(rjkroege): Debounce pinch (http://crbug.com/147647) | 91 // TODO(rjkroege): Debounce pinch (http://crbug.com/147647) |
91 return true; | 92 return true; |
93 | |
92 default: | 94 default: |
93 if (scrolling_in_progress_) { | 95 if (scrolling_in_progress_) |
94 debouncing_deferral_queue_.push_back(gesture_event); | 96 debouncing_deferral_queue_.push_back(gesture_event); |
95 return false; | 97 return !scrolling_in_progress_; |
jam
2014/03/19 16:44:36
leave the code as before; I think it's more readab
Peter Kasting
2014/03/19 21:10:57
Done. Sorry, I didn't view this as a "style chang
| |
96 } | |
97 return true; | |
98 } | 98 } |
99 | |
100 NOTREACHED(); | |
101 return false; | |
102 } | 99 } |
103 | 100 |
104 // NOTE: The filters are applied successively. This simplifies the change. | 101 // NOTE: The filters are applied successively. This simplifies the change. |
105 bool GestureEventQueue::ShouldForward( | 102 bool GestureEventQueue::ShouldForward( |
106 const GestureEventWithLatencyInfo& gesture_event) { | 103 const GestureEventWithLatencyInfo& gesture_event) { |
107 TRACE_EVENT0("input", "GestureEventQueue::ShouldForward"); | 104 TRACE_EVENT0("input", "GestureEventQueue::ShouldForward"); |
108 return ShouldForwardForZeroVelocityFlingStart(gesture_event) && | 105 return ShouldForwardForZeroVelocityFlingStart(gesture_event) && |
109 ShouldForwardForBounceReduction(gesture_event) && | 106 ShouldForwardForBounceReduction(gesture_event) && |
110 ShouldForwardForGFCFiltering(gesture_event) && | 107 ShouldForwardForGFCFiltering(gesture_event) && |
111 ShouldForwardForTapSuppression(gesture_event) && | 108 ShouldForwardForTapSuppression(gesture_event) && |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 ShouldDeferGestureShowPress(gesture_event); | 140 ShouldDeferGestureShowPress(gesture_event); |
144 case WebInputEvent::GestureTapCancel: | 141 case WebInputEvent::GestureTapCancel: |
145 case WebInputEvent::GestureTap: | 142 case WebInputEvent::GestureTap: |
146 case WebInputEvent::GestureTapUnconfirmed: | 143 case WebInputEvent::GestureTapUnconfirmed: |
147 case WebInputEvent::GestureDoubleTap: | 144 case WebInputEvent::GestureDoubleTap: |
148 return !touchscreen_tap_suppression_controller_-> | 145 return !touchscreen_tap_suppression_controller_-> |
149 ShouldSuppressGestureTapEnd(); | 146 ShouldSuppressGestureTapEnd(); |
150 default: | 147 default: |
151 return true; | 148 return true; |
152 } | 149 } |
153 NOTREACHED(); | |
154 return false; | |
155 } | 150 } |
156 | 151 |
157 bool GestureEventQueue::ShouldForwardForCoalescing( | 152 bool GestureEventQueue::ShouldForwardForCoalescing( |
158 const GestureEventWithLatencyInfo& gesture_event) { | 153 const GestureEventWithLatencyInfo& gesture_event) { |
159 switch (gesture_event.event.type) { | 154 switch (gesture_event.event.type) { |
160 case WebInputEvent::GestureFlingCancel: | 155 case WebInputEvent::GestureFlingCancel: |
161 fling_in_progress_ = false; | 156 fling_in_progress_ = false; |
162 break; | 157 break; |
163 case WebInputEvent::GestureFlingStart: | 158 case WebInputEvent::GestureFlingStart: |
164 fling_in_progress_ = true; | 159 fling_in_progress_ = true; |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
370 | 365 |
371 void GestureEventQueue::EnqueueEvent( | 366 void GestureEventQueue::EnqueueEvent( |
372 const GestureEventWithLatencyInfo& gesture_event) { | 367 const GestureEventWithLatencyInfo& gesture_event) { |
373 coalesced_gesture_events_.push_back(gesture_event); | 368 coalesced_gesture_events_.push_back(gesture_event); |
374 // Scroll and pinch events contributing to |combined_scroll_pinch_| will be | 369 // Scroll and pinch events contributing to |combined_scroll_pinch_| will be |
375 // manually added to the queue in |MergeOrInsertScrollAndPinchEvent()|. | 370 // manually added to the queue in |MergeOrInsertScrollAndPinchEvent()|. |
376 combined_scroll_pinch_ = gfx::Transform(); | 371 combined_scroll_pinch_ = gfx::Transform(); |
377 } | 372 } |
378 | 373 |
379 } // namespace content | 374 } // namespace content |
OLD | NEW |