| 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 #include "ui/events/blink/input_scroll_elasticity_controller.h" | 5 #include "ui/events/blink/input_scroll_elasticity_controller.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 if (helper_) | 104 if (helper_) |
| 105 return weak_factory_.GetWeakPtr(); | 105 return weak_factory_.GetWeakPtr(); |
| 106 return base::WeakPtr<InputScrollElasticityController>(); | 106 return base::WeakPtr<InputScrollElasticityController>(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 void InputScrollElasticityController::ObserveGestureEventAndResult( | 109 void InputScrollElasticityController::ObserveGestureEventAndResult( |
| 110 const blink::WebGestureEvent& gesture_event, | 110 const blink::WebGestureEvent& gesture_event, |
| 111 const cc::InputHandlerScrollResult& scroll_result) { | 111 const cc::InputHandlerScrollResult& scroll_result) { |
| 112 base::TimeTicks event_timestamp = | 112 base::TimeTicks event_timestamp = |
| 113 base::TimeTicks() + | 113 base::TimeTicks() + |
| 114 base::TimeDelta::FromSecondsD(gesture_event.timeStampSeconds); | 114 base::TimeDelta::FromSecondsD(gesture_event.timeStampSeconds()); |
| 115 | 115 |
| 116 switch (gesture_event.type) { | 116 switch (gesture_event.type()) { |
| 117 case blink::WebInputEvent::GestureScrollBegin: { | 117 case blink::WebInputEvent::GestureScrollBegin: { |
| 118 if (gesture_event.data.scrollBegin.synthetic) | 118 if (gesture_event.data.scrollBegin.synthetic) |
| 119 return; | 119 return; |
| 120 if (gesture_event.data.scrollBegin.inertialPhase == | 120 if (gesture_event.data.scrollBegin.inertialPhase == |
| 121 blink::WebGestureEvent::MomentumPhase) { | 121 blink::WebGestureEvent::MomentumPhase) { |
| 122 if (state_ == kStateInactive) | 122 if (state_ == kStateInactive) |
| 123 state_ = kStateMomentumScroll; | 123 state_ = kStateMomentumScroll; |
| 124 } else if (gesture_event.data.scrollBegin.inertialPhase == | 124 } else if (gesture_event.data.scrollBegin.inertialPhase == |
| 125 blink::WebGestureEvent::NonMomentumPhase && | 125 blink::WebGestureEvent::NonMomentumPhase && |
| 126 gesture_event.data.scrollBegin.deltaHintUnits == | 126 gesture_event.data.scrollBegin.deltaHintUnits == |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 break; | 417 break; |
| 418 default: | 418 default: |
| 419 // These cases should not be hit because the stretch must be zero in the | 419 // These cases should not be hit because the stretch must be zero in the |
| 420 // Inactive and MomentumScroll states. | 420 // Inactive and MomentumScroll states. |
| 421 NOTREACHED(); | 421 NOTREACHED(); |
| 422 break; | 422 break; |
| 423 } | 423 } |
| 424 } | 424 } |
| 425 | 425 |
| 426 } // namespace ui | 426 } // namespace ui |
| OLD | NEW |