| OLD | NEW |
| 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 | 220 |
| 221 void MouseWheelEventQueue::TryForwardNextEventToRenderer() { | 221 void MouseWheelEventQueue::TryForwardNextEventToRenderer() { |
| 222 TRACE_EVENT0("input", "MouseWheelEventQueue::TryForwardNextEventToRenderer"); | 222 TRACE_EVENT0("input", "MouseWheelEventQueue::TryForwardNextEventToRenderer"); |
| 223 | 223 |
| 224 if (wheel_queue_.empty() || event_sent_for_gesture_ack_) | 224 if (wheel_queue_.empty() || event_sent_for_gesture_ack_) |
| 225 return; | 225 return; |
| 226 | 226 |
| 227 event_sent_for_gesture_ack_.reset(wheel_queue_.front()); | 227 event_sent_for_gesture_ack_.reset(wheel_queue_.front()); |
| 228 wheel_queue_.pop_front(); | 228 wheel_queue_.pop_front(); |
| 229 | 229 |
| 230 MouseWheelEventWithLatencyInfo send_event(*event_sent_for_gesture_ack_); | 230 client_->SendMouseWheelEventImmediately(*event_sent_for_gesture_ack_); |
| 231 if (send_gestures_) | |
| 232 send_event.event.canScroll = false; | |
| 233 | |
| 234 client_->SendMouseWheelEventImmediately(send_event); | |
| 235 } | 231 } |
| 236 | 232 |
| 237 void MouseWheelEventQueue::SendScrollEnd(blink::WebGestureEvent update_event, | 233 void MouseWheelEventQueue::SendScrollEnd(blink::WebGestureEvent update_event, |
| 238 bool synthetic) { | 234 bool synthetic) { |
| 239 DCHECK((synthetic && !needs_scroll_end_) || needs_scroll_end_); | 235 DCHECK((synthetic && !needs_scroll_end_) || needs_scroll_end_); |
| 240 | 236 |
| 241 GestureEventWithLatencyInfo scroll_end(update_event); | 237 GestureEventWithLatencyInfo scroll_end(update_event); |
| 242 scroll_end.event.timeStampSeconds = | 238 scroll_end.event.timeStampSeconds = |
| 243 (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(); | 239 (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(); |
| 244 scroll_end.event.type = WebInputEvent::GestureScrollEnd; | 240 scroll_end.event.type = WebInputEvent::GestureScrollEnd; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 scroll_begin.event.data.scrollBegin.targetViewport = false; | 272 scroll_begin.event.data.scrollBegin.targetViewport = false; |
| 277 scroll_begin.event.data.scrollBegin.deltaHintUnits = | 273 scroll_begin.event.data.scrollBegin.deltaHintUnits = |
| 278 gesture_update.event.data.scrollUpdate.deltaUnits; | 274 gesture_update.event.data.scrollUpdate.deltaUnits; |
| 279 | 275 |
| 280 needs_scroll_begin_ = false; | 276 needs_scroll_begin_ = false; |
| 281 needs_scroll_end_ = true; | 277 needs_scroll_end_ = true; |
| 282 client_->SendGestureEvent(scroll_begin); | 278 client_->SendGestureEvent(scroll_begin); |
| 283 } | 279 } |
| 284 | 280 |
| 285 } // namespace content | 281 } // namespace content |
| OLD | NEW |