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

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

Issue 1800143002: Notify Blink about start of gesture scroll through a queued event. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
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 <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"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/debug/stack_trace.h"
13 #include "base/logging.h"
12 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
13 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
14 #include "content/browser/renderer_host/input/gesture_event_queue.h" 16 #include "content/browser/renderer_host/input/gesture_event_queue.h"
15 #include "content/browser/renderer_host/input/input_ack_handler.h" 17 #include "content/browser/renderer_host/input/input_ack_handler.h"
16 #include "content/browser/renderer_host/input/input_router_client.h" 18 #include "content/browser/renderer_host/input/input_router_client.h"
17 #include "content/browser/renderer_host/input/touch_event_queue.h" 19 #include "content/browser/renderer_host/input/touch_event_queue.h"
18 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle r.h" 20 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle r.h"
19 #include "content/common/content_constants_internal.h" 21 #include "content/common/content_constants_internal.h"
20 #include "content/common/edit_command.h" 22 #include "content/common/edit_command.h"
21 #include "content/common/input/input_event_ack_state.h" 23 #include "content/common/input/input_event_ack_state.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 147
146 // Only forward the non-native portions of our event. 148 // Only forward the non-native portions of our event.
147 FilterAndSendWebInputEvent(key_event.event, key_event.latency); 149 FilterAndSendWebInputEvent(key_event.event, key_event.latency);
148 } 150 }
149 151
150 void InputRouterImpl::SendGestureEvent( 152 void InputRouterImpl::SendGestureEvent(
151 const GestureEventWithLatencyInfo& original_gesture_event) { 153 const GestureEventWithLatencyInfo& original_gesture_event) {
152 input_stream_validator_.Validate(original_gesture_event.event); 154 input_stream_validator_.Validate(original_gesture_event.event);
153 155
154 GestureEventWithLatencyInfo gesture_event(original_gesture_event); 156 GestureEventWithLatencyInfo gesture_event(original_gesture_event);
157 LOG(ERROR) << "======= mDebug " << __FUNCTION__ << " t="
158 << WebInputEventTraits::GetName(gesture_event.event.type);
155 159
156 if (touch_action_filter_.FilterGestureEvent(&gesture_event.event)) 160 if (touch_action_filter_.FilterGestureEvent(&gesture_event.event))
157 return; 161 return;
158 162
163 //LOG(ERROR) << "======= mDebug " << __FUNCTION__ << " not filtered";
164
159 wheel_event_queue_.OnGestureScrollEvent(gesture_event); 165 wheel_event_queue_.OnGestureScrollEvent(gesture_event);
160 166
161 if (gesture_event.event.sourceDevice == blink::WebGestureDeviceTouchscreen) 167 if (gesture_event.event.sourceDevice == blink::WebGestureDeviceTouchscreen) {
168 if (gesture_event.event.type == blink::WebInputEvent::GestureScrollBegin) {
169 touch_event_queue_.PrependTouchScrollNotification();
170 //GestureEventWithLatencyInfo dummy_gesture_event;
171 //gesture_event_queue_.QueueEvent(dummy_gesture_event);
172 }
162 touch_event_queue_.OnGestureScrollEvent(gesture_event); 173 touch_event_queue_.OnGestureScrollEvent(gesture_event);
174 }
163 175
164 gesture_event_queue_.QueueEvent(gesture_event); 176 gesture_event_queue_.QueueEvent(gesture_event);
165 } 177 }
166 178
167 void InputRouterImpl::SendTouchEvent( 179 void InputRouterImpl::SendTouchEvent(
168 const TouchEventWithLatencyInfo& touch_event) { 180 const TouchEventWithLatencyInfo& touch_event) {
181 LOG(ERROR) << "======= mDebug " << __FUNCTION__
182 << " t=" << WebInputEventTraits::GetName(touch_event.event.type);
169 input_stream_validator_.Validate(touch_event.event); 183 input_stream_validator_.Validate(touch_event.event);
170 touch_event_queue_.QueueEvent(touch_event); 184 touch_event_queue_.QueueEvent(touch_event);
171 } 185 }
172 186
173 // Forwards MouseEvent without passing it through 187 // Forwards MouseEvent without passing it through
174 // TouchpadTapSuppressionController. 188 // TouchpadTapSuppressionController.
175 void InputRouterImpl::SendMouseEventImmediately( 189 void InputRouterImpl::SendMouseEventImmediately(
176 const MouseEventWithLatencyInfo& mouse_event) { 190 const MouseEventWithLatencyInfo& mouse_event) {
177 // Avoid spamming the renderer with mouse move events. It is important 191 // Avoid spamming the renderer with mouse move events. It is important
178 // to note that WM_MOUSEMOVE events are anyways synthetic, but since our 192 // to note that WM_MOUSEMOVE events are anyways synthetic, but since our
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // stream |output_stream_validator_| sees is valid, we give events which are 292 // stream |output_stream_validator_| sees is valid, we give events which are
279 // filtered out to the validator. crbug.com/589111 proposes adding an 293 // filtered out to the validator. crbug.com/589111 proposes adding an
280 // additional validator for the events which are actually sent to the 294 // additional validator for the events which are actually sent to the
281 // renderer. 295 // renderer.
282 output_stream_validator_.Validate(touch_event); 296 output_stream_validator_.Validate(touch_event);
283 } 297 }
284 298
285 void InputRouterImpl::OnGestureEventAck( 299 void InputRouterImpl::OnGestureEventAck(
286 const GestureEventWithLatencyInfo& event, 300 const GestureEventWithLatencyInfo& event,
287 InputEventAckState ack_result) { 301 InputEventAckState ack_result) {
302 // Does these lines define touchmove vs gsb queuing order?
288 touch_event_queue_.OnGestureEventAck(event, ack_result); 303 touch_event_queue_.OnGestureEventAck(event, ack_result);
289 ack_handler_->OnGestureEventAck(event, ack_result); 304 ack_handler_->OnGestureEventAck(event, ack_result);
290 } 305 }
291 306
292 void InputRouterImpl::SendMouseWheelEventImmediately( 307 void InputRouterImpl::SendMouseWheelEventImmediately(
293 const MouseWheelEventWithLatencyInfo& wheel_event) { 308 const MouseWheelEventWithLatencyInfo& wheel_event) {
294 FilterAndSendWebInputEvent(wheel_event.event, wheel_event.latency); 309 FilterAndSendWebInputEvent(wheel_event.event, wheel_event.latency);
295 } 310 }
296 311
297 void InputRouterImpl::OnMouseWheelEventAck( 312 void InputRouterImpl::OnMouseWheelEventAck(
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 "frameTreeNodeId", frame_tree_node_id_); 367 "frameTreeNodeId", frame_tree_node_id_);
353 368
354 // Any input event cancels a pending mouse move event. 369 // Any input event cancels a pending mouse move event.
355 next_mouse_move_.reset(); 370 next_mouse_move_.reset();
356 371
357 OfferToHandlers(input_event, latency_info); 372 OfferToHandlers(input_event, latency_info);
358 } 373 }
359 374
360 void InputRouterImpl::OfferToHandlers(const WebInputEvent& input_event, 375 void InputRouterImpl::OfferToHandlers(const WebInputEvent& input_event,
361 const ui::LatencyInfo& latency_info) { 376 const ui::LatencyInfo& latency_info) {
377 LOG(ERROR) << "======= mDebug " << __FUNCTION__
378 << " t=" << WebInputEventTraits::GetName(input_event.type);
379
362 output_stream_validator_.Validate(input_event); 380 output_stream_validator_.Validate(input_event);
363 381
364 if (OfferToClient(input_event, latency_info)) 382 if (OfferToClient(input_event, latency_info))
365 return; 383 return;
366 384
367 OfferToRenderer(input_event, latency_info); 385 OfferToRenderer(input_event, latency_info);
368 386
369 // Touch events should always indicate in the event whether they are 387 // Touch events should always indicate in the event whether they are
370 // cancelable (respect ACK disposition) or not except touchmove. 388 // cancelable (respect ACK disposition) or not except touchmove.
371 bool needs_synthetic_ack = 389 bool needs_synthetic_ack =
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 654
637 flush_requested_ = false; 655 flush_requested_ = false;
638 client_->DidFlush(); 656 client_->DidFlush();
639 } 657 }
640 658
641 void InputRouterImpl::SetFrameTreeNodeId(int frameTreeNodeId) { 659 void InputRouterImpl::SetFrameTreeNodeId(int frameTreeNodeId) {
642 frame_tree_node_id_ = frameTreeNodeId; 660 frame_tree_node_id_ = frameTreeNodeId;
643 } 661 }
644 662
645 } // namespace content 663 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698