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 "content/browser/renderer_host/input/touch_event_queue.h" | 5 #include "content/browser/renderer_host/input/touch_event_queue.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
630 DCHECK(!touchmove_slop_suppressor_->suppressing_touchmoves()) | 630 DCHECK(!touchmove_slop_suppressor_->suppressing_touchmoves()) |
631 << "A touch handler should be offered a touchmove before scrolling."; | 631 << "A touch handler should be offered a touchmove before scrolling."; |
632 } | 632 } |
633 | 633 |
634 pending_async_touchmove_.reset(); | 634 pending_async_touchmove_.reset(); |
635 | 635 |
636 return; | 636 return; |
637 } | 637 } |
638 | 638 |
639 if (gesture_event.event.type == blink::WebInputEvent::GestureScrollUpdate) | 639 if (gesture_event.event.type == blink::WebInputEvent::GestureScrollUpdate) |
640 send_touch_events_async_ = true; | 640 send_touch_events_async_ = (gesture_event.event.resendingPluginId == -1); |
jdduke (slow)
2015/09/30 20:26:46
Can't the resending and non-resending events be in
| |
641 } | 641 } |
642 | 642 |
643 void TouchEventQueue::OnGestureEventAck( | 643 void TouchEventQueue::OnGestureEventAck( |
644 const GestureEventWithLatencyInfo& event, | 644 const GestureEventWithLatencyInfo& event, |
645 InputEventAckState ack_result) { | 645 InputEventAckState ack_result) { |
646 // Throttle sending touchmove events as long as the scroll events are handled. | 646 // Throttle sending touchmove events as long as the scroll events are handled. |
647 // Note that there's no guarantee that this ACK is for the most recent | 647 // Note that there's no guarantee that this ACK is for the most recent |
648 // gesture event (or even part of the current sequence). Worst case, the | 648 // gesture event (or even part of the current sequence). Worst case, the |
649 // delay in updating the absorption state will result in minor UI glitches. | 649 // delay in updating the absorption state will result in minor UI glitches. |
650 // A valid |pending_async_touchmove_| will be flushed when the next event is | 650 // A valid |pending_async_touchmove_| will be flushed when the next event is |
651 // forwarded. | 651 // forwarded. |
652 if (event.event.type == blink::WebInputEvent::GestureScrollUpdate) | 652 if (event.event.type == blink::WebInputEvent::GestureScrollUpdate) |
653 send_touch_events_async_ = (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED); | 653 send_touch_events_async_ = (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) && |
654 (event.event.resendingPluginId == -1); | |
654 } | 655 } |
655 | 656 |
656 void TouchEventQueue::OnHasTouchEventHandlers(bool has_handlers) { | 657 void TouchEventQueue::OnHasTouchEventHandlers(bool has_handlers) { |
657 DCHECK(!dispatching_touch_ack_); | 658 DCHECK(!dispatching_touch_ack_); |
658 DCHECK(!dispatching_touch_); | 659 DCHECK(!dispatching_touch_); |
659 has_handlers_ = has_handlers; | 660 has_handlers_ = has_handlers; |
660 } | 661 } |
661 | 662 |
662 bool TouchEventQueue::IsPendingAckTouchStart() const { | 663 bool TouchEventQueue::IsPendingAckTouchStart() const { |
663 DCHECK(!dispatching_touch_ack_); | 664 DCHECK(!dispatching_touch_ack_); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
867 if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) | 868 if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) |
868 send_touch_events_async_ = false; | 869 send_touch_events_async_ = false; |
869 has_handler_for_current_sequence_ |= | 870 has_handler_for_current_sequence_ |= |
870 ack_result != INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; | 871 ack_result != INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; |
871 } else if (WebTouchEventTraits::IsTouchSequenceEnd(event)) { | 872 } else if (WebTouchEventTraits::IsTouchSequenceEnd(event)) { |
872 has_handler_for_current_sequence_ = false; | 873 has_handler_for_current_sequence_ = false; |
873 } | 874 } |
874 } | 875 } |
875 | 876 |
876 } // namespace content | 877 } // namespace content |
OLD | NEW |