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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 // Note: Other input can race ahead of gesture input as they don't have to go | 317 // Note: Other input can race ahead of gesture input as they don't have to go |
318 // through the queue, but we believe it's OK to do so. | 318 // through the queue, but we believe it's OK to do so. |
319 if (!compositor_event_queue_ || | 319 if (!compositor_event_queue_ || |
320 !IsGestureScrollOrFlingOrPinch(event_with_callback->event().GetType())) { | 320 !IsGestureScrollOrFlingOrPinch(event_with_callback->event().GetType())) { |
321 DispatchSingleInputEvent(std::move(event_with_callback), | 321 DispatchSingleInputEvent(std::move(event_with_callback), |
322 tick_clock_->NowTicks()); | 322 tick_clock_->NowTicks()); |
323 return; | 323 return; |
324 } | 324 } |
325 | 325 |
326 if (has_ongoing_compositor_scroll_fling_pinch_) { | 326 if (has_ongoing_compositor_scroll_fling_pinch_) { |
327 const auto& gesture_event = ToWebGestureEvent(event_with_callback->event()); | |
328 if (gesture_event.source_device == blink::kWebGestureDeviceTouchscreen && | |
329 gesture_event.is_source_touch_event_set_non_blocking) { | |
330 // Dispatch immediately to avoid regression in | |
331 // |smoothness.tough_scrolling_cases:first_gesture_scroll_update_latency|. | |
332 compositor_event_queue_->Queue(std::move(event_with_callback), | |
333 tick_clock_->NowTicks()); | |
334 DispatchQueuedInputEvents(); | |
335 return; | |
336 } | |
337 | |
338 bool needs_animate_input = compositor_event_queue_->empty(); | 327 bool needs_animate_input = compositor_event_queue_->empty(); |
339 compositor_event_queue_->Queue(std::move(event_with_callback), | 328 compositor_event_queue_->Queue(std::move(event_with_callback), |
340 tick_clock_->NowTicks()); | 329 tick_clock_->NowTicks()); |
341 if (needs_animate_input) | 330 if (needs_animate_input) |
342 input_handler_->SetNeedsAnimateInput(); | 331 input_handler_->SetNeedsAnimateInput(); |
343 return; | 332 return; |
344 } | 333 } |
345 | 334 |
346 // We have to dispatch the event to know whether the gesture sequence will be | 335 // We have to dispatch the event to know whether the gesture sequence will be |
347 // handled by the compositor or not. | 336 // handled by the compositor or not. |
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1686 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, | 1675 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, |
1687 scroll_result)); | 1676 scroll_result)); |
1688 } | 1677 } |
1689 | 1678 |
1690 void InputHandlerProxy::SetTickClockForTesting( | 1679 void InputHandlerProxy::SetTickClockForTesting( |
1691 std::unique_ptr<base::TickClock> tick_clock) { | 1680 std::unique_ptr<base::TickClock> tick_clock) { |
1692 tick_clock_ = std::move(tick_clock); | 1681 tick_clock_ = std::move(tick_clock); |
1693 } | 1682 } |
1694 | 1683 |
1695 } // namespace ui | 1684 } // namespace ui |
OLD | NEW |