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

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

Issue 2050033002: Revert of Remove enable/disable wheel gestures setting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@can_scroll_remove
Patch Set: Created 4 years, 6 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/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 10
(...skipping 15 matching lines...) Expand all
26 26
27 ~QueuedWebMouseWheelEvent() { 27 ~QueuedWebMouseWheelEvent() {
28 TRACE_EVENT_ASYNC_END0("input", "MouseWheelEventQueue::QueueEvent", this); 28 TRACE_EVENT_ASYNC_END0("input", "MouseWheelEventQueue::QueueEvent", this);
29 } 29 }
30 30
31 private: 31 private:
32 DISALLOW_COPY_AND_ASSIGN(QueuedWebMouseWheelEvent); 32 DISALLOW_COPY_AND_ASSIGN(QueuedWebMouseWheelEvent);
33 }; 33 };
34 34
35 MouseWheelEventQueue::MouseWheelEventQueue(MouseWheelEventQueueClient* client, 35 MouseWheelEventQueue::MouseWheelEventQueue(MouseWheelEventQueueClient* client,
36 bool send_gestures,
36 int64_t scroll_transaction_ms) 37 int64_t scroll_transaction_ms)
37 : client_(client), 38 : client_(client),
38 needs_scroll_begin_(true), 39 needs_scroll_begin_(true),
39 needs_scroll_end_(false), 40 needs_scroll_end_(false),
41 send_gestures_(send_gestures),
40 scroll_transaction_ms_(scroll_transaction_ms), 42 scroll_transaction_ms_(scroll_transaction_ms),
41 scrolling_device_(blink::WebGestureDeviceUninitialized) { 43 scrolling_device_(blink::WebGestureDeviceUninitialized) {
42 DCHECK(client); 44 DCHECK(client);
43 } 45 }
44 46
45 MouseWheelEventQueue::~MouseWheelEventQueue() { 47 MouseWheelEventQueue::~MouseWheelEventQueue() {
46 if (!wheel_queue_.empty()) 48 if (!wheel_queue_.empty())
47 STLDeleteElements(&wheel_queue_); 49 STLDeleteElements(&wheel_queue_);
48 } 50 }
49 51
(...skipping 22 matching lines...) Expand all
72 InputEventAckState ack_result, 74 InputEventAckState ack_result,
73 const LatencyInfo& latency_info) { 75 const LatencyInfo& latency_info) {
74 TRACE_EVENT0("input", "MouseWheelEventQueue::ProcessMouseWheelAck"); 76 TRACE_EVENT0("input", "MouseWheelEventQueue::ProcessMouseWheelAck");
75 if (!event_sent_for_gesture_ack_) 77 if (!event_sent_for_gesture_ack_)
76 return; 78 return;
77 79
78 event_sent_for_gesture_ack_->latency.AddNewLatencyFrom(latency_info); 80 event_sent_for_gesture_ack_->latency.AddNewLatencyFrom(latency_info);
79 client_->OnMouseWheelEventAck(*event_sent_for_gesture_ack_, ack_result); 81 client_->OnMouseWheelEventAck(*event_sent_for_gesture_ack_, ack_result);
80 82
81 // If event wasn't consumed then generate a gesture scroll for it. 83 // If event wasn't consumed then generate a gesture scroll for it.
82 if (ack_result != INPUT_EVENT_ACK_STATE_CONSUMED && 84 if (send_gestures_ && ack_result != INPUT_EVENT_ACK_STATE_CONSUMED &&
83 event_sent_for_gesture_ack_->event.canScroll && 85 event_sent_for_gesture_ack_->event.canScroll &&
84 event_sent_for_gesture_ack_->event.resendingPluginId == -1 && 86 event_sent_for_gesture_ack_->event.resendingPluginId == -1 &&
85 (scrolling_device_ == blink::WebGestureDeviceUninitialized || 87 (scrolling_device_ == blink::WebGestureDeviceUninitialized ||
86 scrolling_device_ == blink::WebGestureDeviceTouchpad)) { 88 scrolling_device_ == blink::WebGestureDeviceTouchpad)) {
87 WebGestureEvent scroll_update; 89 WebGestureEvent scroll_update;
88 scroll_update.timeStampSeconds = 90 scroll_update.timeStampSeconds =
89 event_sent_for_gesture_ack_->event.timeStampSeconds; 91 event_sent_for_gesture_ack_->event.timeStampSeconds;
90 92
91 scroll_update.x = event_sent_for_gesture_ack_->event.x; 93 scroll_update.x = event_sent_for_gesture_ack_->event.x;
92 scroll_update.y = event_sent_for_gesture_ack_->event.y; 94 scroll_update.y = event_sent_for_gesture_ack_->event.y;
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 scroll_begin.data.scrollBegin.targetViewport = false; 285 scroll_begin.data.scrollBegin.targetViewport = false;
284 scroll_begin.data.scrollBegin.deltaHintUnits = 286 scroll_begin.data.scrollBegin.deltaHintUnits =
285 gesture_update.data.scrollUpdate.deltaUnits; 287 gesture_update.data.scrollUpdate.deltaUnits;
286 288
287 needs_scroll_begin_ = false; 289 needs_scroll_begin_ = false;
288 needs_scroll_end_ = true; 290 needs_scroll_end_ = true;
289 client_->ForwardGestureEventWithLatencyInfo(scroll_begin, ui::LatencyInfo()); 291 client_->ForwardGestureEventWithLatencyInfo(scroll_begin, ui::LatencyInfo());
290 } 292 }
291 293
292 } // namespace content 294 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698