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

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

Issue 2625453002: Touchpad and wheel scroll latching for ChromeOS behind flag. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/mouse_wheel_event_queue.h" 5 #include "content/browser/renderer_host/input/mouse_wheel_event_queue.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "ui/events/base_event_utils.h" 10 #include "ui/events/base_event_utils.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 0, 0); 200 0, 0);
201 client_->ForwardGestureEventWithLatencyInfo(scroll_update, latency); 201 client_->ForwardGestureEventWithLatencyInfo(scroll_update, latency);
202 } 202 }
203 203
204 if (momentum_phase_ended) { 204 if (momentum_phase_ended) {
205 // Send GSE with if scroll latching is enabled and no fling is going 205 // Send GSE with if scroll latching is enabled and no fling is going
206 // to happen next. 206 // to happen next.
207 SendScrollEnd(scroll_update, false); 207 SendScrollEnd(scroll_update, false);
208 } else if (scroll_phase_ended || !has_phase_info) { 208 } else if (scroll_phase_ended || !has_phase_info) {
209 // If scroll latching is enabled and a fling might happen next, or 209 // If scroll latching is enabled and a fling might happen next, or
210 // no phase info exists, start the scroll_end_timer_. 210 // no phase info exists, start the scroll_end_timer_.
tdresser 2017/01/09 18:25:19 The scroll end timer should only be running if lat
sahel 2017/01/09 20:02:01 Right, it should be running, but we need to reset
bokan 2017/01/10 18:53:58 For my own understanding: there's a comment above
sahel 2017/01/10 21:10:06 correct.
211 scroll_end_timer_.Start( 211 scroll_end_timer_.Start(
212 FROM_HERE, 212 FROM_HERE,
213 base::TimeDelta::FromMilliseconds(scroll_transaction_ms_), 213 base::TimeDelta::FromMilliseconds(scroll_transaction_ms_),
214 base::Bind(&MouseWheelEventQueue::SendScrollEnd, 214 base::Bind(&MouseWheelEventQueue::SendScrollEnd,
215 base::Unretained(this), scroll_update, false)); 215 base::Unretained(this), scroll_update, false));
216 } 216 }
217 } 217 }
218 218
219 } else { // !enable_scroll_latching_ 219 } else { // !enable_scroll_latching_
220 if (needs_update || !empty_sequence) { 220 if (needs_update || !empty_sequence) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 scroll_end_timer_.Reset(); 271 scroll_end_timer_.Reset();
272 task.Run(); 272 task.Run();
273 } 273 }
274 scrolling_device_ = gesture_event.event.sourceDevice; 274 scrolling_device_ = gesture_event.event.sourceDevice;
275 } else if (scrolling_device_ == gesture_event.event.sourceDevice && 275 } else if (scrolling_device_ == gesture_event.event.sourceDevice &&
276 (gesture_event.event.type == 276 (gesture_event.event.type ==
277 blink::WebInputEvent::GestureScrollEnd || 277 blink::WebInputEvent::GestureScrollEnd ||
278 gesture_event.event.type == 278 gesture_event.event.type ==
279 blink::WebInputEvent::GestureFlingStart)) { 279 blink::WebInputEvent::GestureFlingStart)) {
280 scrolling_device_ = blink::WebGestureDeviceUninitialized; 280 scrolling_device_ = blink::WebGestureDeviceUninitialized;
281 if (scroll_end_timer_.IsRunning()) 281 if (scroll_end_timer_.IsRunning()) {
tdresser 2017/01/09 18:25:19 This should only happen if latching is enabled, ri
sahel 2017/01/09 20:02:01 If the latching is not enabled then the timeout fo
tdresser 2017/01/10 16:19:02 I missed that we do start the timer when latching
bokan 2017/01/10 18:53:58 I don't actually know how we implement task queues
sahel 2017/01/10 21:10:06 I don't know if timer tasks have priority or not,
282 scroll_end_timer_.Reset(); 282 if (enable_scroll_latching_) {
283 // Don't send the pending ScrollEnd if a fling is happening.
284 // The next wheel event will still need a ScrollBegin.
285 scroll_end_timer_.Stop();
286 needs_scroll_begin_ = true;
bokan 2017/01/10 18:53:58 If the event is a GFS, do we still need a GSB?
sahel 2017/01/10 21:10:06 Yes, this is for making the gesture event sequence
bokan 2017/01/10 21:25:06 Ah, ok. Thanks for the explanation.
287 needs_scroll_end_ = false;
288 } else {
289 scroll_end_timer_.Reset();
290 }
291 }
283 } 292 }
284 } 293 }
285 294
286 void MouseWheelEventQueue::TryForwardNextEventToRenderer() { 295 void MouseWheelEventQueue::TryForwardNextEventToRenderer() {
287 TRACE_EVENT0("input", "MouseWheelEventQueue::TryForwardNextEventToRenderer"); 296 TRACE_EVENT0("input", "MouseWheelEventQueue::TryForwardNextEventToRenderer");
288 297
289 if (wheel_queue_.empty() || event_sent_for_gesture_ack_) 298 if (wheel_queue_.empty() || event_sent_for_gesture_ack_)
290 return; 299 return;
291 300
292 event_sent_for_gesture_ack_ = std::move(wheel_queue_.front()); 301 event_sent_for_gesture_ack_ = std::move(wheel_queue_.front());
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 scroll_begin.data.scrollBegin.deltaHintUnits = 348 scroll_begin.data.scrollBegin.deltaHintUnits =
340 gesture_update.data.scrollUpdate.deltaUnits; 349 gesture_update.data.scrollUpdate.deltaUnits;
341 350
342 needs_scroll_begin_ = false; 351 needs_scroll_begin_ = false;
343 needs_scroll_end_ = true; 352 needs_scroll_end_ = true;
344 client_->ForwardGestureEventWithLatencyInfo( 353 client_->ForwardGestureEventWithLatencyInfo(
345 scroll_begin, ui::LatencyInfo(ui::SourceEventType::WHEEL)); 354 scroll_begin, ui::LatencyInfo(ui::SourceEventType::WHEEL));
346 } 355 }
347 356
348 } // namespace content 357 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/input/input_handler_wrapper.cc » ('j') | ui/events/blink/input_handler_proxy.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698