| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/events/blink/input_handler_proxy.h" | 5 #include "ui/events/blink/input_handler_proxy.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 // Note: Other input can race ahead of gesture input as they don't have to go | 316 // Note: Other input can race ahead of gesture input as they don't have to go |
| 317 // through the queue, but we believe it's OK to do so. | 317 // through the queue, but we believe it's OK to do so. |
| 318 if (!compositor_event_queue_ || | 318 if (!compositor_event_queue_ || |
| 319 !IsGestureScrollOrFlingOrPinch(event_with_callback->event().GetType())) { | 319 !IsGestureScrollOrFlingOrPinch(event_with_callback->event().GetType())) { |
| 320 DispatchSingleInputEvent(std::move(event_with_callback), | 320 DispatchSingleInputEvent(std::move(event_with_callback), |
| 321 tick_clock_->NowTicks()); | 321 tick_clock_->NowTicks()); |
| 322 return; | 322 return; |
| 323 } | 323 } |
| 324 | 324 |
| 325 if (has_ongoing_compositor_scroll_fling_pinch_) { | 325 if (has_ongoing_compositor_scroll_fling_pinch_) { |
| 326 const auto& gesture_event = ToWebGestureEvent(event_with_callback->event()); |
| 327 if (gesture_event.source_device == blink::kWebGestureDeviceTouchscreen && |
| 328 gesture_event.is_source_touch_event_set_non_blocking) { |
| 329 // Dispatch immediately to avoid regression in |
| 330 // |smoothness.tough_scrolling_cases:first_gesture_scroll_update_latency|. |
| 331 compositor_event_queue_->Queue(std::move(event_with_callback), |
| 332 tick_clock_->NowTicks()); |
| 333 DispatchQueuedInputEvents(); |
| 334 return; |
| 335 } |
| 336 |
| 326 bool needs_animate_input = compositor_event_queue_->empty(); | 337 bool needs_animate_input = compositor_event_queue_->empty(); |
| 327 compositor_event_queue_->Queue(std::move(event_with_callback), | 338 compositor_event_queue_->Queue(std::move(event_with_callback), |
| 328 tick_clock_->NowTicks()); | 339 tick_clock_->NowTicks()); |
| 329 if (needs_animate_input) | 340 if (needs_animate_input) |
| 330 input_handler_->SetNeedsAnimateInput(); | 341 input_handler_->SetNeedsAnimateInput(); |
| 331 return; | 342 return; |
| 332 } | 343 } |
| 333 | 344 |
| 334 // We have to dispatch the event to know whether the gesture sequence will be | 345 // We have to dispatch the event to know whether the gesture sequence will be |
| 335 // handled by the compositor or not. | 346 // handled by the compositor or not. |
| (...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1645 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, | 1656 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, |
| 1646 scroll_result)); | 1657 scroll_result)); |
| 1647 } | 1658 } |
| 1648 | 1659 |
| 1649 void InputHandlerProxy::SetTickClockForTesting( | 1660 void InputHandlerProxy::SetTickClockForTesting( |
| 1650 std::unique_ptr<base::TickClock> tick_clock) { | 1661 std::unique_ptr<base::TickClock> tick_clock) { |
| 1651 tick_clock_ = std::move(tick_clock); | 1662 tick_clock_ = std::move(tick_clock); |
| 1652 } | 1663 } |
| 1653 | 1664 |
| 1654 } // namespace ui | 1665 } // namespace ui |
| OLD | NEW |