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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 | 785 |
786 touch_queue_.pop_front(); | 786 touch_queue_.pop_front(); |
787 } | 787 } |
788 | 788 |
789 void TouchEventQueue::SendTouchEventImmediately( | 789 void TouchEventQueue::SendTouchEventImmediately( |
790 TouchEventWithLatencyInfo* touch) { | 790 TouchEventWithLatencyInfo* touch) { |
791 // TODO(crbug.com/600773): Hack to avoid cyclic reentry to this method. | 791 // TODO(crbug.com/600773): Hack to avoid cyclic reentry to this method. |
792 if (dispatching_touch_) | 792 if (dispatching_touch_) |
793 return; | 793 return; |
794 | 794 |
| 795 if (touch->event.type == WebInputEvent::TouchStart) |
| 796 touch->event.touchStartOrFirstTouchMove = true; |
| 797 |
795 // For touchmove events, compare touch points position from current event | 798 // For touchmove events, compare touch points position from current event |
796 // to last sent event and update touch points state. | 799 // to last sent event and update touch points state. |
797 if (touch->event.type == WebInputEvent::TouchMove) { | 800 if (touch->event.type == WebInputEvent::TouchMove) { |
798 CHECK(last_sent_touchevent_); | 801 CHECK(last_sent_touchevent_); |
| 802 if (last_sent_touchevent_->type == WebInputEvent::TouchStart) |
| 803 touch->event.touchStartOrFirstTouchMove = true; |
799 for (unsigned int i = 0; i < last_sent_touchevent_->touchesLength; ++i) { | 804 for (unsigned int i = 0; i < last_sent_touchevent_->touchesLength; ++i) { |
800 const WebTouchPoint& last_touch_point = | 805 const WebTouchPoint& last_touch_point = |
801 last_sent_touchevent_->touches[i]; | 806 last_sent_touchevent_->touches[i]; |
802 // Touches with same id may not have same index in Touches array. | 807 // Touches with same id may not have same index in Touches array. |
803 for (unsigned int j = 0; j < touch->event.touchesLength; ++j) { | 808 for (unsigned int j = 0; j < touch->event.touchesLength; ++j) { |
804 const WebTouchPoint& current_touchmove_point = touch->event.touches[j]; | 809 const WebTouchPoint& current_touchmove_point = touch->event.touches[j]; |
805 if (current_touchmove_point.id != last_touch_point.id) | 810 if (current_touchmove_point.id != last_touch_point.id) |
806 continue; | 811 continue; |
807 | 812 |
808 if (!HasPointChanged(last_touch_point, current_touchmove_point)) | 813 if (!HasPointChanged(last_touch_point, current_touchmove_point)) |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
926 if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) | 931 if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) |
927 send_touch_events_async_ = false; | 932 send_touch_events_async_ = false; |
928 has_handler_for_current_sequence_ |= | 933 has_handler_for_current_sequence_ |= |
929 ack_result != INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; | 934 ack_result != INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; |
930 } else if (WebTouchEventTraits::IsTouchSequenceEnd(event)) { | 935 } else if (WebTouchEventTraits::IsTouchSequenceEnd(event)) { |
931 has_handler_for_current_sequence_ = false; | 936 has_handler_for_current_sequence_ = false; |
932 } | 937 } |
933 } | 938 } |
934 | 939 |
935 } // namespace content | 940 } // namespace content |
OLD | NEW |