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

Side by Side Diff: ui/events/blink/input_handler_proxy.cc

Issue 2744243009: [Compositor event queue] FlingCancel should clear on-going gesture flag (Closed)
Patch Set: Created 3 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
« no previous file with comments | « ui/events/blink/input_handler_proxy.h ('k') | ui/events/blink/input_handler_proxy_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/events/blink/input_handler_proxy.h" 5 #include "ui/events/blink/input_handler_proxy.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 fling_may_be_active_on_main_thread_(false), 259 fling_may_be_active_on_main_thread_(false),
260 disallow_horizontal_fling_scroll_(false), 260 disallow_horizontal_fling_scroll_(false),
261 disallow_vertical_fling_scroll_(false), 261 disallow_vertical_fling_scroll_(false),
262 has_fling_animation_started_(false), 262 has_fling_animation_started_(false),
263 smooth_scroll_enabled_(false), 263 smooth_scroll_enabled_(false),
264 uma_latency_reporting_enabled_(base::TimeTicks::IsHighResolution()), 264 uma_latency_reporting_enabled_(base::TimeTicks::IsHighResolution()),
265 touchpad_and_wheel_scroll_latching_enabled_(false), 265 touchpad_and_wheel_scroll_latching_enabled_(false),
266 touch_start_result_(kEventDispositionUndefined), 266 touch_start_result_(kEventDispositionUndefined),
267 mouse_wheel_result_(kEventDispositionUndefined), 267 mouse_wheel_result_(kEventDispositionUndefined),
268 current_overscroll_params_(nullptr), 268 current_overscroll_params_(nullptr),
269 has_ongoing_compositor_scroll_pinch_(false), 269 has_ongoing_compositor_scroll_fling_pinch_(false),
270 tick_clock_(base::MakeUnique<base::DefaultTickClock>()) { 270 tick_clock_(base::MakeUnique<base::DefaultTickClock>()) {
271 DCHECK(client); 271 DCHECK(client);
272 input_handler_->BindToClient(this); 272 input_handler_->BindToClient(this);
273 cc::ScrollElasticityHelper* scroll_elasticity_helper = 273 cc::ScrollElasticityHelper* scroll_elasticity_helper =
274 input_handler_->CreateScrollElasticityHelper(); 274 input_handler_->CreateScrollElasticityHelper();
275 if (scroll_elasticity_helper) { 275 if (scroll_elasticity_helper) {
276 scroll_elasticity_controller_.reset( 276 scroll_elasticity_controller_.reset(
277 new InputScrollElasticityController(scroll_elasticity_helper)); 277 new InputScrollElasticityController(scroll_elasticity_helper));
278 } 278 }
279 compositor_event_queue_ = 279 compositor_event_queue_ =
(...skipping 30 matching lines...) Expand all
310 310
311 // Note: Other input can race ahead of gesture input as they don't have to go 311 // Note: Other input can race ahead of gesture input as they don't have to go
312 // through the queue, but we believe it's OK to do so. 312 // through the queue, but we believe it's OK to do so.
313 if (!compositor_event_queue_ || 313 if (!compositor_event_queue_ ||
314 !IsGestureScrollOrFlingOrPinch(event_with_callback->event().type())) { 314 !IsGestureScrollOrFlingOrPinch(event_with_callback->event().type())) {
315 DispatchSingleInputEvent(std::move(event_with_callback), 315 DispatchSingleInputEvent(std::move(event_with_callback),
316 tick_clock_->NowTicks()); 316 tick_clock_->NowTicks());
317 return; 317 return;
318 } 318 }
319 319
320 if (has_ongoing_compositor_scroll_pinch_) { 320 if (has_ongoing_compositor_scroll_fling_pinch_) {
321 bool needs_animate_input = compositor_event_queue_->empty(); 321 bool needs_animate_input = compositor_event_queue_->empty();
322 compositor_event_queue_->Queue(std::move(event_with_callback), 322 compositor_event_queue_->Queue(std::move(event_with_callback),
323 tick_clock_->NowTicks()); 323 tick_clock_->NowTicks());
324 if (needs_animate_input) 324 if (needs_animate_input)
325 input_handler_->SetNeedsAnimateInput(); 325 input_handler_->SetNeedsAnimateInput();
326 return; 326 return;
327 } 327 }
328 328
329 // We have to dispatch the event to know whether the gesture sequence will be 329 // We have to dispatch the event to know whether the gesture sequence will be
330 // handled by the compositor or not. 330 // handled by the compositor or not.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 std::unique_ptr<cc::SwapPromiseMonitor> latency_info_swap_promise_monitor = 366 std::unique_ptr<cc::SwapPromiseMonitor> latency_info_swap_promise_monitor =
367 input_handler_->CreateLatencyInfoSwapPromiseMonitor( 367 input_handler_->CreateLatencyInfoSwapPromiseMonitor(
368 &monitored_latency_info); 368 &monitored_latency_info);
369 369
370 current_overscroll_params_.reset(); 370 current_overscroll_params_.reset();
371 InputHandlerProxy::EventDisposition disposition = 371 InputHandlerProxy::EventDisposition disposition =
372 HandleInputEvent(event_with_callback->event()); 372 HandleInputEvent(event_with_callback->event());
373 373
374 switch (event_with_callback->event().type()) { 374 switch (event_with_callback->event().type()) {
375 case blink::WebGestureEvent::GestureScrollBegin: 375 case blink::WebGestureEvent::GestureScrollBegin:
376 case blink::WebGestureEvent::GestureFlingStart:
376 case blink::WebGestureEvent::GesturePinchBegin: 377 case blink::WebGestureEvent::GesturePinchBegin:
377 case blink::WebGestureEvent::GestureScrollUpdate: 378 case blink::WebGestureEvent::GestureScrollUpdate:
378 case blink::WebGestureEvent::GesturePinchUpdate: 379 case blink::WebGestureEvent::GesturePinchUpdate:
379 has_ongoing_compositor_scroll_pinch_ = disposition == DID_HANDLE; 380 has_ongoing_compositor_scroll_fling_pinch_ = disposition == DID_HANDLE;
380 break; 381 break;
381 382
382 case blink::WebGestureEvent::GestureScrollEnd: 383 case blink::WebGestureEvent::GestureScrollEnd:
384 case blink::WebGestureEvent::GestureFlingCancel:
383 case blink::WebGestureEvent::GesturePinchEnd: 385 case blink::WebGestureEvent::GesturePinchEnd:
384 has_ongoing_compositor_scroll_pinch_ = false; 386 has_ongoing_compositor_scroll_fling_pinch_ = false;
385 break; 387 break;
386 default: 388 default:
387 break; 389 break;
388 } 390 }
389 391
390 // Will run callback for every original events. 392 // Will run callback for every original events.
391 event_with_callback->RunCallbacks(disposition, monitored_latency_info, 393 event_with_callback->RunCallbacks(disposition, monitored_latency_info,
392 std::move(current_overscroll_params_)); 394 std::move(current_overscroll_params_));
393 } 395 }
394 396
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1614 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, 1616 scroll_elasticity_controller_->GetWeakPtr(), gesture_event,
1615 scroll_result)); 1617 scroll_result));
1616 } 1618 }
1617 1619
1618 void InputHandlerProxy::SetTickClockForTesting( 1620 void InputHandlerProxy::SetTickClockForTesting(
1619 std::unique_ptr<base::TickClock> tick_clock) { 1621 std::unique_ptr<base::TickClock> tick_clock) {
1620 tick_clock_ = std::move(tick_clock); 1622 tick_clock_ = std::move(tick_clock);
1621 } 1623 }
1622 1624
1623 } // namespace ui 1625 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/blink/input_handler_proxy.h ('k') | ui/events/blink/input_handler_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698