| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 const GestureEventWithLatencyInfo& original_gesture_event) { | 153 const GestureEventWithLatencyInfo& original_gesture_event) { |
| 154 input_stream_validator_.Validate(original_gesture_event.event); | 154 input_stream_validator_.Validate(original_gesture_event.event); |
| 155 | 155 |
| 156 GestureEventWithLatencyInfo gesture_event(original_gesture_event); | 156 GestureEventWithLatencyInfo gesture_event(original_gesture_event); |
| 157 | 157 |
| 158 if (touch_action_filter_.FilterGestureEvent(&gesture_event.event)) | 158 if (touch_action_filter_.FilterGestureEvent(&gesture_event.event)) |
| 159 return; | 159 return; |
| 160 | 160 |
| 161 wheel_event_queue_.OnGestureScrollEvent(gesture_event); | 161 wheel_event_queue_.OnGestureScrollEvent(gesture_event); |
| 162 | 162 |
| 163 if (gesture_event.event.sourceDevice == blink::WebGestureDeviceTouchscreen) | 163 if (gesture_event.event.sourceDevice == blink::WebGestureDeviceTouchscreen) { |
| 164 if (gesture_event.event.type == blink::WebInputEvent::GestureScrollBegin) |
| 165 touch_event_queue_.PrependTouchScrollNotification(); |
| 164 touch_event_queue_.OnGestureScrollEvent(gesture_event); | 166 touch_event_queue_.OnGestureScrollEvent(gesture_event); |
| 167 } |
| 165 | 168 |
| 166 gesture_event_queue_.QueueEvent(gesture_event); | 169 gesture_event_queue_.QueueEvent(gesture_event); |
| 167 } | 170 } |
| 168 | 171 |
| 169 void InputRouterImpl::SendTouchEvent( | 172 void InputRouterImpl::SendTouchEvent( |
| 170 const TouchEventWithLatencyInfo& touch_event) { | 173 const TouchEventWithLatencyInfo& touch_event) { |
| 171 input_stream_validator_.Validate(touch_event.event); | 174 input_stream_validator_.Validate(touch_event.event); |
| 172 touch_event_queue_.QueueEvent(touch_event); | 175 touch_event_queue_.QueueEvent(touch_event); |
| 173 } | 176 } |
| 174 | 177 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 } | 366 } |
| 364 | 367 |
| 365 void InputRouterImpl::OfferToHandlers(const WebInputEvent& input_event, | 368 void InputRouterImpl::OfferToHandlers(const WebInputEvent& input_event, |
| 366 const ui::LatencyInfo& latency_info) { | 369 const ui::LatencyInfo& latency_info) { |
| 367 output_stream_validator_.Validate(input_event); | 370 output_stream_validator_.Validate(input_event); |
| 368 | 371 |
| 369 if (OfferToClient(input_event, latency_info)) | 372 if (OfferToClient(input_event, latency_info)) |
| 370 return; | 373 return; |
| 371 | 374 |
| 372 // Touch events should always indicate in the event whether they are | 375 // Touch events should always indicate in the event whether they are |
| 373 // cancelable (respect ACK disposition) or not except touchmove. | 376 // cancelable (respect ACK disposition) or not, except touchmove and |
| 377 // touchscollstarted. |
| 374 bool should_block = WebInputEventTraits::ShouldBlockEventStream(input_event); | 378 bool should_block = WebInputEventTraits::ShouldBlockEventStream(input_event); |
| 379 if (WebInputEvent::isTouchEventType(input_event.type) && |
| 380 input_event.type != WebInputEvent::TouchMove && |
| 381 input_event.type != WebInputEvent::TouchScrollStarted) { |
| 382 const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(input_event); |
| 383 DCHECK_EQ(should_block, touch.cancelable); |
| 384 } |
| 375 | 385 |
| 376 OfferToRenderer(input_event, latency_info, | 386 OfferToRenderer(input_event, latency_info, |
| 377 should_block | 387 should_block |
| 378 ? InputEventDispatchType::DISPATCH_TYPE_BLOCKING | 388 ? InputEventDispatchType::DISPATCH_TYPE_BLOCKING |
| 379 : InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING); | 389 : InputEventDispatchType::DISPATCH_TYPE_NON_BLOCKING); |
| 380 | 390 |
| 381 if (WebInputEvent::isTouchEventType(input_event.type) && | |
| 382 input_event.type != WebInputEvent::TouchMove) { | |
| 383 const WebTouchEvent& touch = static_cast<const WebTouchEvent&>(input_event); | |
| 384 DCHECK_EQ(should_block, touch.cancelable); | |
| 385 } | |
| 386 | |
| 387 // Generate a synthetic ack if the event was sent so it doesn't block. | 391 // Generate a synthetic ack if the event was sent so it doesn't block. |
| 388 if (!should_block) { | 392 if (!should_block) { |
| 389 ProcessInputEventAck( | 393 ProcessInputEventAck( |
| 390 input_event.type, INPUT_EVENT_ACK_STATE_IGNORED, latency_info, | 394 input_event.type, INPUT_EVENT_ACK_STATE_IGNORED, latency_info, |
| 391 WebInputEventTraits::GetUniqueTouchEventId(input_event), | 395 WebInputEventTraits::GetUniqueTouchEventId(input_event), |
| 392 IGNORING_DISPOSITION); | 396 IGNORING_DISPOSITION); |
| 393 } | 397 } |
| 394 } | 398 } |
| 395 | 399 |
| 396 bool InputRouterImpl::OfferToClient(const WebInputEvent& input_event, | 400 bool InputRouterImpl::OfferToClient(const WebInputEvent& input_event, |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 | 647 |
| 644 flush_requested_ = false; | 648 flush_requested_ = false; |
| 645 client_->DidFlush(); | 649 client_->DidFlush(); |
| 646 } | 650 } |
| 647 | 651 |
| 648 void InputRouterImpl::SetFrameTreeNodeId(int frameTreeNodeId) { | 652 void InputRouterImpl::SetFrameTreeNodeId(int frameTreeNodeId) { |
| 649 frame_tree_node_id_ = frameTreeNodeId; | 653 frame_tree_node_id_ = frameTreeNodeId; |
| 650 } | 654 } |
| 651 | 655 |
| 652 } // namespace content | 656 } // namespace content |
| OLD | NEW |