| 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/input_router_impl.h" | 5 #include "content/browser/renderer_host/input/input_router_impl.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 void InputRouterImpl::SendMouseEventImmediately( | 204 void InputRouterImpl::SendMouseEventImmediately( |
| 205 const MouseEventWithLatencyInfo& mouse_event) { | 205 const MouseEventWithLatencyInfo& mouse_event) { |
| 206 if (mouse_event.event.type() == blink::WebInputEvent::MouseMove) | 206 if (mouse_event.event.type() == blink::WebInputEvent::MouseMove) |
| 207 mouse_move_queue_.push_back(mouse_event); | 207 mouse_move_queue_.push_back(mouse_event); |
| 208 | 208 |
| 209 FilterAndSendWebInputEvent(mouse_event.event, mouse_event.latency); | 209 FilterAndSendWebInputEvent(mouse_event.event, mouse_event.latency); |
| 210 } | 210 } |
| 211 | 211 |
| 212 void InputRouterImpl::SendTouchEventImmediately( | 212 void InputRouterImpl::SendTouchEventImmediately( |
| 213 const TouchEventWithLatencyInfo& touch_event) { | 213 const TouchEventWithLatencyInfo& touch_event) { |
| 214 if (WebTouchEventTraits::IsTouchSequenceStart(touch_event.event)) { | |
| 215 touch_action_filter_.ResetTouchAction(); | |
| 216 // Note that if the previous touch-action was TOUCH_ACTION_NONE, enabling | |
| 217 // the timeout here will not take effect until the *following* touch | |
| 218 // sequence. This is a desirable side-effect, giving the renderer a chance | |
| 219 // to send a touch-action response without racing against the ack timeout. | |
| 220 UpdateTouchAckTimeoutEnabled(); | |
| 221 } | |
| 222 | |
| 223 FilterAndSendWebInputEvent(touch_event.event, touch_event.latency); | 214 FilterAndSendWebInputEvent(touch_event.event, touch_event.latency); |
| 224 } | 215 } |
| 225 | 216 |
| 226 void InputRouterImpl::SendGestureEventImmediately( | 217 void InputRouterImpl::SendGestureEventImmediately( |
| 227 const GestureEventWithLatencyInfo& gesture_event) { | 218 const GestureEventWithLatencyInfo& gesture_event) { |
| 228 FilterAndSendWebInputEvent(gesture_event.event, gesture_event.latency); | 219 FilterAndSendWebInputEvent(gesture_event.event, gesture_event.latency); |
| 229 } | 220 } |
| 230 | 221 |
| 231 const NativeWebKeyboardEvent* InputRouterImpl::GetLastKeyboardEvent() const { | 222 const NativeWebKeyboardEvent* InputRouterImpl::GetLastKeyboardEvent() const { |
| 232 if (key_queue_.empty()) | 223 if (key_queue_.empty()) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 void InputRouterImpl::OnTouchEventAck(const TouchEventWithLatencyInfo& event, | 268 void InputRouterImpl::OnTouchEventAck(const TouchEventWithLatencyInfo& event, |
| 278 InputEventAckState ack_result) { | 269 InputEventAckState ack_result) { |
| 279 // Touchstart events sent to the renderer indicate a new touch sequence, but | 270 // Touchstart events sent to the renderer indicate a new touch sequence, but |
| 280 // in some cases we may filter out sending the touchstart - catch those here. | 271 // in some cases we may filter out sending the touchstart - catch those here. |
| 281 if (WebTouchEventTraits::IsTouchSequenceStart(event.event) && | 272 if (WebTouchEventTraits::IsTouchSequenceStart(event.event) && |
| 282 ack_result == INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS) { | 273 ack_result == INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS) { |
| 283 touch_action_filter_.ResetTouchAction(); | 274 touch_action_filter_.ResetTouchAction(); |
| 284 UpdateTouchAckTimeoutEnabled(); | 275 UpdateTouchAckTimeoutEnabled(); |
| 285 } | 276 } |
| 286 ack_handler_->OnTouchEventAck(event, ack_result); | 277 ack_handler_->OnTouchEventAck(event, ack_result); |
| 278 |
| 279 // Reset the touch action at the end of a touch-action sequence. |
| 280 if (WebTouchEventTraits::IsTouchSequenceEnd(event.event)) { |
| 281 touch_action_filter_.ResetTouchAction(); |
| 282 UpdateTouchAckTimeoutEnabled(); |
| 283 } |
| 287 } | 284 } |
| 288 | 285 |
| 289 void InputRouterImpl::OnFilteringTouchEvent( | 286 void InputRouterImpl::OnFilteringTouchEvent( |
| 290 const WebTouchEvent& touch_event) { | 287 const WebTouchEvent& touch_event) { |
| 291 // The event stream given to the renderer is not guaranteed to be | 288 // The event stream given to the renderer is not guaranteed to be |
| 292 // valid based on the current TouchEventStreamValidator rules. This event will | 289 // valid based on the current TouchEventStreamValidator rules. This event will |
| 293 // never be given to the renderer, but in order to ensure that the event | 290 // never be given to the renderer, but in order to ensure that the event |
| 294 // stream |output_stream_validator_| sees is valid, we give events which are | 291 // stream |output_stream_validator_| sees is valid, we give events which are |
| 295 // filtered out to the validator. crbug.com/589111 proposes adding an | 292 // filtered out to the validator. crbug.com/589111 proposes adding an |
| 296 // additional validator for the events which are actually sent to the | 293 // additional validator for the events which are actually sent to the |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 DCHECK(global_touch_position_.find(touch_point->id) == | 665 DCHECK(global_touch_position_.find(touch_point->id) == |
| 669 global_touch_position_.end()); | 666 global_touch_position_.end()); |
| 670 global_touch_position_[touch_point->id] = gfx::Point( | 667 global_touch_position_[touch_point->id] = gfx::Point( |
| 671 touch_point->screenPosition.x, touch_point->screenPosition.y); | 668 touch_point->screenPosition.x, touch_point->screenPosition.y); |
| 672 } | 669 } |
| 673 } | 670 } |
| 674 } | 671 } |
| 675 } | 672 } |
| 676 | 673 |
| 677 } // namespace content | 674 } // namespace content |
| OLD | NEW |