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