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 "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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 expect_scroll_update_end_(false), | 232 expect_scroll_update_end_(false), |
233 #endif | 233 #endif |
234 gesture_scroll_on_impl_thread_(false), | 234 gesture_scroll_on_impl_thread_(false), |
235 gesture_pinch_on_impl_thread_(false), | 235 gesture_pinch_on_impl_thread_(false), |
236 fling_may_be_active_on_main_thread_(false), | 236 fling_may_be_active_on_main_thread_(false), |
237 disallow_horizontal_fling_scroll_(false), | 237 disallow_horizontal_fling_scroll_(false), |
238 disallow_vertical_fling_scroll_(false), | 238 disallow_vertical_fling_scroll_(false), |
239 has_fling_animation_started_(false), | 239 has_fling_animation_started_(false), |
240 smooth_scroll_enabled_(false), | 240 smooth_scroll_enabled_(false), |
241 uma_latency_reporting_enabled_(base::TimeTicks::IsHighResolution()), | 241 uma_latency_reporting_enabled_(base::TimeTicks::IsHighResolution()), |
242 use_gesture_events_for_mouse_wheel_(true), | |
243 touch_start_result_(kEventDispositionUndefined) { | 242 touch_start_result_(kEventDispositionUndefined) { |
244 DCHECK(client); | 243 DCHECK(client); |
245 input_handler_->BindToClient(this); | 244 input_handler_->BindToClient(this); |
246 cc::ScrollElasticityHelper* scroll_elasticity_helper = | 245 cc::ScrollElasticityHelper* scroll_elasticity_helper = |
247 input_handler_->CreateScrollElasticityHelper(); | 246 input_handler_->CreateScrollElasticityHelper(); |
248 if (scroll_elasticity_helper) { | 247 if (scroll_elasticity_helper) { |
249 scroll_elasticity_controller_.reset( | 248 scroll_elasticity_controller_.reset( |
250 new InputScrollElasticityController(scroll_elasticity_helper)); | 249 new InputScrollElasticityController(scroll_elasticity_helper)); |
251 } | 250 } |
252 } | 251 } |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 #endif | 442 #endif |
444 } | 443 } |
445 | 444 |
446 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleMouseWheel( | 445 InputHandlerProxy::EventDisposition InputHandlerProxy::HandleMouseWheel( |
447 const WebMouseWheelEvent& wheel_event) { | 446 const WebMouseWheelEvent& wheel_event) { |
448 // Only call |CancelCurrentFling()| if a fling was active, as it will | 447 // Only call |CancelCurrentFling()| if a fling was active, as it will |
449 // otherwise disrupt an in-progress touch scroll. | 448 // otherwise disrupt an in-progress touch scroll. |
450 if (!wheel_event.hasPreciseScrollingDeltas && fling_curve_) | 449 if (!wheel_event.hasPreciseScrollingDeltas && fling_curve_) |
451 CancelCurrentFling(); | 450 CancelCurrentFling(); |
452 | 451 |
453 if (use_gesture_events_for_mouse_wheel_) { | |
454 cc::EventListenerProperties properties = | 452 cc::EventListenerProperties properties = |
455 input_handler_->GetEventListenerProperties( | 453 input_handler_->GetEventListenerProperties( |
456 cc::EventListenerClass::kMouseWheel); | 454 cc::EventListenerClass::kMouseWheel); |
457 switch (properties) { | 455 switch (properties) { |
458 case cc::EventListenerProperties::kPassive: | 456 case cc::EventListenerProperties::kPassive: |
459 return DID_HANDLE_NON_BLOCKING; | 457 return DID_HANDLE_NON_BLOCKING; |
460 case cc::EventListenerProperties::kBlockingAndPassive: | 458 case cc::EventListenerProperties::kBlockingAndPassive: |
461 case cc::EventListenerProperties::kBlocking: | 459 case cc::EventListenerProperties::kBlocking: |
462 return DID_NOT_HANDLE; | 460 return DID_NOT_HANDLE; |
463 case cc::EventListenerProperties::kNone: | 461 case cc::EventListenerProperties::kNone: |
464 return DROP_EVENT; | 462 return DROP_EVENT; |
465 default: | 463 default: |
466 NOTREACHED(); | 464 NOTREACHED(); |
467 return DROP_EVENT; | 465 return DROP_EVENT; |
468 } | 466 } |
469 } | |
470 return ScrollByMouseWheel(wheel_event); | |
471 } | 467 } |
472 | 468 |
473 InputHandlerProxy::EventDisposition InputHandlerProxy::ScrollByMouseWheel( | 469 InputHandlerProxy::EventDisposition InputHandlerProxy::ScrollByMouseWheel( |
474 const WebMouseWheelEvent& wheel_event) { | 470 const WebMouseWheelEvent& wheel_event) { |
475 InputHandlerProxy::EventDisposition result = DID_NOT_HANDLE; | 471 InputHandlerProxy::EventDisposition result = DID_NOT_HANDLE; |
476 cc::InputHandlerScrollResult scroll_result; | 472 cc::InputHandlerScrollResult scroll_result; |
477 | 473 |
478 // TODO(ccameron): The rail information should be pushed down into | 474 // TODO(ccameron): The rail information should be pushed down into |
479 // InputHandler. | 475 // InputHandler. |
480 gfx::Vector2dF scroll_delta( | 476 gfx::Vector2dF scroll_delta( |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1363 // is made asynchronously, to minimize divergence between main thread and | 1359 // is made asynchronously, to minimize divergence between main thread and |
1364 // impl thread event handling paths. | 1360 // impl thread event handling paths. |
1365 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1361 base::ThreadTaskRunnerHandle::Get()->PostTask( |
1366 FROM_HERE, | 1362 FROM_HERE, |
1367 base::Bind(&InputScrollElasticityController::ObserveGestureEventAndResult, | 1363 base::Bind(&InputScrollElasticityController::ObserveGestureEventAndResult, |
1368 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, | 1364 scroll_elasticity_controller_->GetWeakPtr(), gesture_event, |
1369 scroll_result)); | 1365 scroll_result)); |
1370 } | 1366 } |
1371 | 1367 |
1372 } // namespace ui | 1368 } // namespace ui |
OLD | NEW |