| 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/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 dispatching_touch_ = false; | 339 dispatching_touch_ = false; |
| 340 | 340 |
| 341 if (timeout_handler_ && timeout_handler_->ConfirmTouchEvent(ack_result)) | 341 if (timeout_handler_ && timeout_handler_->ConfirmTouchEvent(ack_result)) |
| 342 return; | 342 return; |
| 343 | 343 |
| 344 touchmove_slop_suppressor_->ConfirmTouchEvent(ack_result); | 344 touchmove_slop_suppressor_->ConfirmTouchEvent(ack_result); |
| 345 | 345 |
| 346 if (touch_queue_.empty()) | 346 if (touch_queue_.empty()) |
| 347 return; | 347 return; |
| 348 | 348 |
| 349 if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED && | |
| 350 touch_filtering_state_ == FORWARD_TOUCHES_UNTIL_TIMEOUT) | |
| 351 touch_filtering_state_ = FORWARD_ALL_TOUCHES; | |
| 352 | |
| 353 const WebTouchEvent& acked_event = | 349 const WebTouchEvent& acked_event = |
| 354 touch_queue_.front()->coalesced_event().event; | 350 touch_queue_.front()->coalesced_event().event; |
| 351 |
| 352 if (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED && |
| 353 touch_filtering_state_ == FORWARD_TOUCHES_UNTIL_TIMEOUT) { |
| 354 touch_filtering_state_ = FORWARD_ALL_TOUCHES; |
| 355 } |
| 356 |
| 357 if (ack_result == INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS && |
| 358 touch_filtering_state_ != DROP_ALL_TOUCHES && |
| 359 WebTouchEventTraits::IsTouchSequenceStart(acked_event)) { |
| 360 touch_filtering_state_ = DROP_TOUCHES_IN_SEQUENCE; |
| 361 } |
| 362 |
| 355 UpdateTouchAckStates(acked_event, ack_result); | 363 UpdateTouchAckStates(acked_event, ack_result); |
| 356 PopTouchEventToClient(ack_result, latency_info); | 364 PopTouchEventToClient(ack_result, latency_info); |
| 357 TryForwardNextEventToRenderer(); | 365 TryForwardNextEventToRenderer(); |
| 358 } | 366 } |
| 359 | 367 |
| 360 void TouchEventQueue::TryForwardNextEventToRenderer() { | 368 void TouchEventQueue::TryForwardNextEventToRenderer() { |
| 361 DCHECK(!dispatching_touch_ack_); | 369 DCHECK(!dispatching_touch_ack_); |
| 362 // If there are queued touch events, then try to forward them to the renderer | 370 // If there are queued touch events, then try to forward them to the renderer |
| 363 // immediately, or ACK the events back to the client if appropriate. | 371 // immediately, or ACK the events back to the client if appropriate. |
| 364 while (!touch_queue_.empty()) { | 372 while (!touch_queue_.empty()) { |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 } else if (event.type == WebInputEvent::TouchStart) { | 617 } else if (event.type == WebInputEvent::TouchStart) { |
| 610 for (unsigned i = 0; i < event.touchesLength; ++i) { | 618 for (unsigned i = 0; i < event.touchesLength; ++i) { |
| 611 const WebTouchPoint& point = event.touches[i]; | 619 const WebTouchPoint& point = event.touches[i]; |
| 612 if (point.state == WebTouchPoint::StatePressed) | 620 if (point.state == WebTouchPoint::StatePressed) |
| 613 touch_ack_states_[point.id] = ack_result; | 621 touch_ack_states_[point.id] = ack_result; |
| 614 } | 622 } |
| 615 } | 623 } |
| 616 } | 624 } |
| 617 | 625 |
| 618 } // namespace content | 626 } // namespace content |
| OLD | NEW |