Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(593)

Side by Side Diff: content/browser/renderer_host/input/input_router_impl.cc

Issue 171283002: Always reset touch action at the beginning of a new gesture sequence (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test name. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "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/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "content/browser/renderer_host/input/gesture_event_queue.h" 11 #include "content/browser/renderer_host/input/gesture_event_queue.h"
12 #include "content/browser/renderer_host/input/input_ack_handler.h" 12 #include "content/browser/renderer_host/input/input_ack_handler.h"
13 #include "content/browser/renderer_host/input/input_router_client.h" 13 #include "content/browser/renderer_host/input/input_router_client.h"
14 #include "content/browser/renderer_host/input/touch_event_queue.h" 14 #include "content/browser/renderer_host/input/touch_event_queue.h"
15 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle r.h" 15 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle r.h"
16 #include "content/browser/renderer_host/input/web_touch_event_traits.h"
16 #include "content/browser/renderer_host/overscroll_controller.h" 17 #include "content/browser/renderer_host/overscroll_controller.h"
17 #include "content/common/content_constants_internal.h" 18 #include "content/common/content_constants_internal.h"
18 #include "content/common/edit_command.h" 19 #include "content/common/edit_command.h"
19 #include "content/common/input/touch_action.h" 20 #include "content/common/input/touch_action.h"
20 #include "content/common/input/web_input_event_traits.h"
21 #include "content/common/input_messages.h" 21 #include "content/common/input_messages.h"
22 #include "content/common/view_messages.h" 22 #include "content/common/view_messages.h"
23 #include "content/port/common/input_event_ack_state.h" 23 #include "content/port/common/input_event_ack_state.h"
24 #include "content/public/browser/notification_service.h" 24 #include "content/public/browser/notification_service.h"
25 #include "content/public/browser/notification_types.h" 25 #include "content/public/browser/notification_types.h"
26 #include "content/public/browser/user_metrics.h" 26 #include "content/public/browser/user_metrics.h"
27 #include "content/public/common/content_switches.h" 27 #include "content/public/common/content_switches.h"
28 #include "ipc/ipc_sender.h" 28 #include "ipc/ipc_sender.h"
29 #include "ui/events/event.h" 29 #include "ui/events/event.h"
30 #include "ui/events/keycodes/keyboard_codes.h" 30 #include "ui/events/keycodes/keyboard_codes.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 return; 279 return;
280 } 280 }
281 mouse_move_pending_ = true; 281 mouse_move_pending_ = true;
282 } 282 }
283 283
284 FilterAndSendWebInputEvent(mouse_event.event, mouse_event.latency, false); 284 FilterAndSendWebInputEvent(mouse_event.event, mouse_event.latency, false);
285 } 285 }
286 286
287 void InputRouterImpl::SendTouchEventImmediately( 287 void InputRouterImpl::SendTouchEventImmediately(
288 const TouchEventWithLatencyInfo& touch_event) { 288 const TouchEventWithLatencyInfo& touch_event) {
289 if (WebTouchEventTraits::IsTouchSequenceStart(touch_event.event))
290 touch_action_filter_.ResetTouchAction();
291
289 FilterAndSendWebInputEvent(touch_event.event, touch_event.latency, false); 292 FilterAndSendWebInputEvent(touch_event.event, touch_event.latency, false);
290 } 293 }
291 294
292 void InputRouterImpl::SendGestureEventImmediately( 295 void InputRouterImpl::SendGestureEventImmediately(
293 const GestureEventWithLatencyInfo& gesture_event) { 296 const GestureEventWithLatencyInfo& gesture_event) {
294 FilterAndSendWebInputEvent(gesture_event.event, gesture_event.latency, false); 297 FilterAndSendWebInputEvent(gesture_event.event, gesture_event.latency, false);
295 } 298 }
296 299
297 const NativeWebKeyboardEvent* InputRouterImpl::GetLastKeyboardEvent() const { 300 const NativeWebKeyboardEvent* InputRouterImpl::GetLastKeyboardEvent() const {
298 if (key_queue_.empty()) 301 if (key_queue_.empty())
(...skipping 29 matching lines...) Expand all
328 IPC_END_MESSAGE_MAP() 331 IPC_END_MESSAGE_MAP()
329 332
330 if (!message_is_ok) 333 if (!message_is_ok)
331 ack_handler_->OnUnexpectedEventAck(InputAckHandler::BAD_ACK_MESSAGE); 334 ack_handler_->OnUnexpectedEventAck(InputAckHandler::BAD_ACK_MESSAGE);
332 335
333 return handled; 336 return handled;
334 } 337 }
335 338
336 void InputRouterImpl::OnTouchEventAck(const TouchEventWithLatencyInfo& event, 339 void InputRouterImpl::OnTouchEventAck(const TouchEventWithLatencyInfo& event,
337 InputEventAckState ack_result) { 340 InputEventAckState ack_result) {
341 // Touchstart events sent to the renderer indicate a new touch sequence, but
342 // in some cases we may filter out sending the touchstart - catch those here.
343 if (WebTouchEventTraits::IsTouchSequenceStart(event.event) &&
344 ack_result == INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS) {
345 touch_action_filter_.ResetTouchAction();
346 }
338 ack_handler_->OnTouchEventAck(event, ack_result); 347 ack_handler_->OnTouchEventAck(event, ack_result);
339 } 348 }
340 349
341 void InputRouterImpl::OnGestureEventAck( 350 void InputRouterImpl::OnGestureEventAck(
342 const GestureEventWithLatencyInfo& event, 351 const GestureEventWithLatencyInfo& event,
343 InputEventAckState ack_result) { 352 InputEventAckState ack_result) {
344 touch_event_queue_->OnGestureEventAck(event, ack_result); 353 touch_event_queue_->OnGestureEventAck(event, ack_result);
345 ProcessAckForOverscroll(event.event, ack_result); 354 ProcessAckForOverscroll(event.event, ack_result);
346 ack_handler_->OnGestureEventAck(event, ack_result); 355 ack_handler_->OnGestureEventAck(event, ack_result);
347 } 356 }
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 break; 772 break;
764 } 773 }
765 } 774 }
766 775
767 bool InputRouterImpl::IsInOverscrollGesture() const { 776 bool InputRouterImpl::IsInOverscrollGesture() const {
768 OverscrollController* controller = client_->GetOverscrollController(); 777 OverscrollController* controller = client_->GetOverscrollController();
769 return controller && controller->overscroll_mode() != OVERSCROLL_NONE; 778 return controller && controller->overscroll_mode() != OVERSCROLL_NONE;
770 } 779 }
771 780
772 } // namespace content 781 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698