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