Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef UI_EVENTS_BLINK_INPUT_SCROLL_ELASTICITY_CONTROLLER_H_ | 5 #ifndef UI_EVENTS_BLINK_INPUT_SCROLL_ELASTICITY_CONTROLLER_H_ |
| 6 #define UI_EVENTS_BLINK_INPUT_SCROLL_ELASTICITY_CONTROLLER_H_ | 6 #define UI_EVENTS_BLINK_INPUT_SCROLL_ELASTICITY_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "cc/input/scroll_elasticity_helper.h" | 10 #include "cc/input/scroll_elasticity_helper.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 base::WeakPtr<InputScrollElasticityController> GetWeakPtr(); | 51 base::WeakPtr<InputScrollElasticityController> GetWeakPtr(); |
| 52 | 52 |
| 53 // Update the overscroll state based a wheel event that has been processed. | 53 // Update the overscroll state based a wheel event that has been processed. |
| 54 // Note that this assumes that all events are coming from a single input | 54 // Note that this assumes that all events are coming from a single input |
| 55 // device. If the user simultaneously uses multiple input devices, Cocoa may | 55 // device. If the user simultaneously uses multiple input devices, Cocoa may |
| 56 // not correctly pass all the gesture begin and end events. In this case, | 56 // not correctly pass all the gesture begin and end events. In this case, |
| 57 // this class may disregard some scrolls that come in at unexpected times. | 57 // this class may disregard some scrolls that come in at unexpected times. |
| 58 void ObserveWheelEventAndResult( | 58 void ObserveWheelEventAndResult( |
| 59 const blink::WebMouseWheelEvent& wheel_event, | 59 const blink::WebMouseWheelEvent& wheel_event, |
| 60 const cc::InputHandlerScrollResult& scroll_result); | 60 const cc::InputHandlerScrollResult& scroll_result); |
| 61 // Update the overscroll state based a gesture event that has been processed. | |
| 62 // Note that this assumes that all events are coming from a single input | |
| 63 // device. If the user simultaneously uses multiple input devices, Cocoa may | |
| 64 // not correctly pass all the gesture begin and end events. In this case, | |
| 65 // this class may disregard some scrolls that come in at unexpected times. | |
|
tdresser
2016/03/08 14:28:53
How hard would it be to have a test of this behavi
dtapuska
2016/03/08 20:31:49
I think the behavior is that if you are using two
| |
| 66 void ObserveGestureEventAndResult( | |
| 67 const blink::WebGestureEvent& gesture_event, | |
| 68 const cc::InputHandlerScrollResult& scroll_result); | |
| 69 | |
| 61 void Animate(base::TimeTicks time); | 70 void Animate(base::TimeTicks time); |
| 62 | 71 |
| 63 void ReconcileStretchAndScroll(); | 72 void ReconcileStretchAndScroll(); |
| 64 | 73 |
| 65 private: | 74 private: |
| 66 enum State { | 75 enum State { |
| 67 // The initial state, during which the overscroll amount is zero and | 76 // The initial state, during which the overscroll amount is zero and |
| 68 // there are no active or momentum scroll events coming in. This state | 77 // there are no active or momentum scroll events coming in. This state |
| 69 // is briefly returned to between the active and momentum phases of a | 78 // is briefly returned to between the active and momentum phases of a |
| 70 // scroll (if there is no overscroll). | 79 // scroll (if there is no overscroll). |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 // behavior as would happen if the scroll were caused by an active scroll). | 147 // behavior as would happen if the scroll were caused by an active scroll). |
| 139 bool momentum_animation_reset_at_next_frame_; | 148 bool momentum_animation_reset_at_next_frame_; |
| 140 | 149 |
| 141 base::WeakPtrFactory<InputScrollElasticityController> weak_factory_; | 150 base::WeakPtrFactory<InputScrollElasticityController> weak_factory_; |
| 142 DISALLOW_COPY_AND_ASSIGN(InputScrollElasticityController); | 151 DISALLOW_COPY_AND_ASSIGN(InputScrollElasticityController); |
| 143 }; | 152 }; |
| 144 | 153 |
| 145 } // namespace ui | 154 } // namespace ui |
| 146 | 155 |
| 147 #endif // UI_EVENTS_BLINK_INPUT_SCROLL_ELASTICITY_CONTROLLER_H_ | 156 #endif // UI_EVENTS_BLINK_INPUT_SCROLL_ELASTICITY_CONTROLLER_H_ |
| OLD | NEW |