| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/gestures/gesture_provider_aura.h" | 5 #include "ui/events/gestures/gesture_provider_aura.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
| 10 #include "ui/events/gesture_detection/gesture_config_helper.h" | 10 #include "ui/events/gesture_detection/gesture_config_helper.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 } | 37 } |
| 38 | 38 |
| 39 // If this is a touchmove event, and it isn't different from the last | 39 // If this is a touchmove event, and it isn't different from the last |
| 40 // event, ignore it. | 40 // event, ignore it. |
| 41 if (event.type() == ET_TOUCH_MOVED && | 41 if (event.type() == ET_TOUCH_MOVED && |
| 42 event.x() == pointer_state_.GetX(index) && | 42 event.x() == pointer_state_.GetX(index) && |
| 43 event.y() == pointer_state_.GetY(index)) { | 43 event.y() == pointer_state_.GetY(index)) { |
| 44 return false; | 44 return false; |
| 45 } | 45 } |
| 46 | 46 |
| 47 last_touch_event_flags_ = event.flags(); | |
| 48 last_touch_event_latency_info_ = *event.latency(); | 47 last_touch_event_latency_info_ = *event.latency(); |
| 49 pointer_state_.OnTouch(event); | 48 pointer_state_.OnTouch(event); |
| 50 | 49 |
| 51 bool result = filtered_gesture_provider_.OnTouchEvent(pointer_state_); | 50 bool result = filtered_gesture_provider_.OnTouchEvent(pointer_state_); |
| 52 pointer_state_.CleanupRemovedTouchPoints(event); | 51 pointer_state_.CleanupRemovedTouchPoints(event); |
| 53 return result; | 52 return result; |
| 54 } | 53 } |
| 55 | 54 |
| 56 void GestureProviderAura::OnTouchEventAck(bool event_consumed) { | 55 void GestureProviderAura::OnTouchEventAck(bool event_consumed) { |
| 57 DCHECK(pending_gestures_.empty()); | 56 DCHECK(pending_gestures_.empty()); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 76 else | 75 else |
| 77 *previous_tap_ = gesture; | 76 *previous_tap_ = gesture; |
| 78 previous_tap_->details = details; | 77 previous_tap_->details = details; |
| 79 } else if (gesture.type() == ET_GESTURE_TAP_CANCEL) { | 78 } else if (gesture.type() == ET_GESTURE_TAP_CANCEL) { |
| 80 previous_tap_.reset(); | 79 previous_tap_.reset(); |
| 81 } | 80 } |
| 82 | 81 |
| 83 scoped_ptr<ui::GestureEvent> event( | 82 scoped_ptr<ui::GestureEvent> event( |
| 84 new ui::GestureEvent(gesture.x, | 83 new ui::GestureEvent(gesture.x, |
| 85 gesture.y, | 84 gesture.y, |
| 86 last_touch_event_flags_, | 85 gesture.flags, |
| 87 gesture.time - base::TimeTicks(), | 86 gesture.time - base::TimeTicks(), |
| 88 details)); | 87 details)); |
| 89 | 88 |
| 90 ui::LatencyInfo* gesture_latency = event->latency(); | 89 ui::LatencyInfo* gesture_latency = event->latency(); |
| 91 | 90 |
| 92 gesture_latency->CopyLatencyFrom( | 91 gesture_latency->CopyLatencyFrom( |
| 93 last_touch_event_latency_info_, | 92 last_touch_event_latency_info_, |
| 94 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT); | 93 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT); |
| 95 gesture_latency->CopyLatencyFrom( | 94 gesture_latency->CopyLatencyFrom( |
| 96 last_touch_event_latency_info_, | 95 last_touch_event_latency_info_, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 129 |
| 131 double double_tap_slop_square = | 130 double double_tap_slop_square = |
| 132 GestureConfiguration::max_distance_between_taps_for_double_tap(); | 131 GestureConfiguration::max_distance_between_taps_for_double_tap(); |
| 133 double_tap_slop_square *= double_tap_slop_square; | 132 double_tap_slop_square *= double_tap_slop_square; |
| 134 const float delta_x = previous_tap.x - current_tap.x; | 133 const float delta_x = previous_tap.x - current_tap.x; |
| 135 const float delta_y = previous_tap.y - current_tap.y; | 134 const float delta_y = previous_tap.y - current_tap.y; |
| 136 return (delta_x * delta_x + delta_y * delta_y < double_tap_slop_square); | 135 return (delta_x * delta_x + delta_y * delta_y < double_tap_slop_square); |
| 137 } | 136 } |
| 138 | 137 |
| 139 } // namespace content | 138 } // namespace content |
| OLD | NEW |