| 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/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 CancelCurrentFling(true); | 648 CancelCurrentFling(true); |
| 649 } | 649 } |
| 650 } | 650 } |
| 651 | 651 |
| 652 void InputHandlerProxy::MainThreadHasStoppedFlinging() { | 652 void InputHandlerProxy::MainThreadHasStoppedFlinging() { |
| 653 fling_may_be_active_on_main_thread_ = false; | 653 fling_may_be_active_on_main_thread_ = false; |
| 654 client_->DidStopFlinging(); | 654 client_->DidStopFlinging(); |
| 655 } | 655 } |
| 656 | 656 |
| 657 void InputHandlerProxy::DidOverscroll( | 657 void InputHandlerProxy::DidOverscroll( |
| 658 const gfx::PointF& causal_event_viewport_point, |
| 658 const gfx::Vector2dF& accumulated_overscroll, | 659 const gfx::Vector2dF& accumulated_overscroll, |
| 659 const gfx::Vector2dF& latest_overscroll_delta) { | 660 const gfx::Vector2dF& latest_overscroll_delta) { |
| 660 DCHECK(client_); | 661 DCHECK(client_); |
| 661 | 662 |
| 662 TRACE_EVENT2("input", | 663 TRACE_EVENT2("input", |
| 663 "InputHandlerProxy::DidOverscroll", | 664 "InputHandlerProxy::DidOverscroll", |
| 664 "dx", | 665 "dx", |
| 665 latest_overscroll_delta.x(), | 666 latest_overscroll_delta.x(), |
| 666 "dy", | 667 "dy", |
| 667 latest_overscroll_delta.y()); | 668 latest_overscroll_delta.y()); |
| 668 | 669 |
| 669 DidOverscrollParams params; | 670 DidOverscrollParams params; |
| 670 params.accumulated_overscroll = accumulated_overscroll; | 671 params.accumulated_overscroll = accumulated_overscroll; |
| 671 params.latest_overscroll_delta = latest_overscroll_delta; | 672 params.latest_overscroll_delta = latest_overscroll_delta; |
| 672 params.current_fling_velocity = | 673 params.current_fling_velocity = |
| 673 ToClientScrollIncrement(current_fling_velocity_); | 674 ToClientScrollIncrement(current_fling_velocity_); |
| 675 params.causal_event_viewport_point = causal_event_viewport_point; |
| 674 | 676 |
| 675 if (fling_curve_) { | 677 if (fling_curve_) { |
| 676 static const int kFlingOverscrollThreshold = 1; | 678 static const int kFlingOverscrollThreshold = 1; |
| 677 disallow_horizontal_fling_scroll_ |= | 679 disallow_horizontal_fling_scroll_ |= |
| 678 std::abs(params.accumulated_overscroll.x()) >= | 680 std::abs(params.accumulated_overscroll.x()) >= |
| 679 kFlingOverscrollThreshold; | 681 kFlingOverscrollThreshold; |
| 680 disallow_vertical_fling_scroll_ |= | 682 disallow_vertical_fling_scroll_ |= |
| 681 std::abs(params.accumulated_overscroll.y()) >= | 683 std::abs(params.accumulated_overscroll.y()) >= |
| 682 kFlingOverscrollThreshold; | 684 kFlingOverscrollThreshold; |
| 683 } | 685 } |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 // trigger a scroll, e.g., with a trivial time delta between fling updates. | 804 // trigger a scroll, e.g., with a trivial time delta between fling updates. |
| 803 // Return true in this case to prevent early fling termination. | 805 // Return true in this case to prevent early fling termination. |
| 804 if (std::abs(clipped_increment.width) < kScrollEpsilon && | 806 if (std::abs(clipped_increment.width) < kScrollEpsilon && |
| 805 std::abs(clipped_increment.height) < kScrollEpsilon) | 807 std::abs(clipped_increment.height) < kScrollEpsilon) |
| 806 return true; | 808 return true; |
| 807 | 809 |
| 808 return did_scroll; | 810 return did_scroll; |
| 809 } | 811 } |
| 810 | 812 |
| 811 } // namespace content | 813 } // namespace content |
| OLD | NEW |