Chromium Code Reviews| 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/renderer/input/input_handler_proxy.h" | 5 #include "content/renderer/input/input_handler_proxy.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "content/renderer/input/input_handler_proxy_client.h" | 10 #include "content/renderer/input/input_handler_proxy_client.h" |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 345 } else { | 345 } else { |
| 346 TRACE_EVENT_INSTANT0("renderer", | 346 TRACE_EVENT_INSTANT0("renderer", |
| 347 "InputHandlerProxy::animate::flingOver", | 347 "InputHandlerProxy::animate::flingOver", |
| 348 TRACE_EVENT_SCOPE_THREAD); | 348 TRACE_EVENT_SCOPE_THREAD); |
| 349 CancelCurrentFling(); | 349 CancelCurrentFling(); |
| 350 } | 350 } |
| 351 } | 351 } |
| 352 | 352 |
| 353 void InputHandlerProxy::MainThreadHasStoppedFlinging() { | 353 void InputHandlerProxy::MainThreadHasStoppedFlinging() { |
| 354 fling_may_be_active_on_main_thread_ = false; | 354 fling_may_be_active_on_main_thread_ = false; |
| 355 client_->DidStopFlinging(); | |
|
jdduke (slow)
2014/01/09 20:07:14
What if there's a fling active on the impl thread?
| |
| 355 } | 356 } |
| 356 | 357 |
| 357 void InputHandlerProxy::DidOverscroll(const cc::DidOverscrollParams& params) { | 358 void InputHandlerProxy::DidOverscroll(const cc::DidOverscrollParams& params) { |
| 358 DCHECK(client_); | 359 DCHECK(client_); |
| 359 if (fling_curve_) { | 360 if (fling_curve_) { |
| 360 static const int kFlingOverscrollThreshold = 1; | 361 static const int kFlingOverscrollThreshold = 1; |
| 361 disallow_horizontal_fling_scroll_ |= | 362 disallow_horizontal_fling_scroll_ |= |
| 362 std::abs(params.accumulated_overscroll.x()) >= | 363 std::abs(params.accumulated_overscroll.x()) >= |
| 363 kFlingOverscrollThreshold; | 364 kFlingOverscrollThreshold; |
| 364 disallow_vertical_fling_scroll_ |= | 365 disallow_vertical_fling_scroll_ |= |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 381 } | 382 } |
| 382 | 383 |
| 383 TRACE_EVENT_INSTANT1("renderer", | 384 TRACE_EVENT_INSTANT1("renderer", |
| 384 "InputHandlerProxy::CancelCurrentFling", | 385 "InputHandlerProxy::CancelCurrentFling", |
| 385 TRACE_EVENT_SCOPE_THREAD, | 386 TRACE_EVENT_SCOPE_THREAD, |
| 386 "had_fling_animation", | 387 "had_fling_animation", |
| 387 had_fling_animation); | 388 had_fling_animation); |
| 388 fling_curve_.reset(); | 389 fling_curve_.reset(); |
| 389 gesture_scroll_on_impl_thread_ = false; | 390 gesture_scroll_on_impl_thread_ = false; |
| 390 fling_parameters_ = blink::WebActiveWheelFlingParameters(); | 391 fling_parameters_ = blink::WebActiveWheelFlingParameters(); |
| 392 client_->DidStopFlinging(); | |
|
jdduke (slow)
2014/01/09 20:07:14
I think we only want to send this if there was a f
Xianzhu
2014/01/10 20:16:02
Done.
| |
| 391 return had_fling_animation; | 393 return had_fling_animation; |
| 392 } | 394 } |
| 393 | 395 |
| 394 bool InputHandlerProxy::TouchpadFlingScroll( | 396 bool InputHandlerProxy::TouchpadFlingScroll( |
| 395 const WebFloatSize& increment) { | 397 const WebFloatSize& increment) { |
| 396 WebMouseWheelEvent synthetic_wheel; | 398 WebMouseWheelEvent synthetic_wheel; |
| 397 synthetic_wheel.type = WebInputEvent::MouseWheel; | 399 synthetic_wheel.type = WebInputEvent::MouseWheel; |
| 398 synthetic_wheel.deltaX = increment.width; | 400 synthetic_wheel.deltaX = increment.width; |
| 399 synthetic_wheel.deltaY = increment.height; | 401 synthetic_wheel.deltaY = increment.height; |
| 400 synthetic_wheel.hasPreciseScrollingDeltas = true; | 402 synthetic_wheel.hasPreciseScrollingDeltas = true; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 475 TRACE_EVENT2("renderer", | 477 TRACE_EVENT2("renderer", |
| 476 "InputHandlerProxy::notifyCurrentFlingVelocity", | 478 "InputHandlerProxy::notifyCurrentFlingVelocity", |
| 477 "vx", | 479 "vx", |
| 478 velocity.width, | 480 velocity.width, |
| 479 "vy", | 481 "vy", |
| 480 velocity.height); | 482 velocity.height); |
| 481 input_handler_->NotifyCurrentFlingVelocity(ToClientScrollIncrement(velocity)); | 483 input_handler_->NotifyCurrentFlingVelocity(ToClientScrollIncrement(velocity)); |
| 482 } | 484 } |
| 483 | 485 |
| 484 } // namespace content | 486 } // namespace content |
| OLD | NEW |