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

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: ScrollEnd gets called when the fling ends before hitting a scroll extent. 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 260 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()) {
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;
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_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698