Chromium Code Reviews| Index: ui/events/gesture_detection/gesture_provider.cc |
| diff --git a/ui/events/gesture_detection/gesture_provider.cc b/ui/events/gesture_detection/gesture_provider.cc |
| index 84fb854aec78d5669059458c118a6033579ba76b..e054c7784bb4dc67bb3cc3d018e3cc9ee2d0b96e 100644 |
| --- a/ui/events/gesture_detection/gesture_provider.cc |
| +++ b/ui/events/gesture_detection/gesture_provider.cc |
| @@ -318,6 +318,10 @@ class GestureProvider::GestureListenerImpl |
| distance_y *= ratio; |
| } |
| } |
| + |
| + float ordinal_distance_x = distance_x; |
|
jdduke (slow)
2014/04/24 19:58:53
Nit: Let's make these const above and below sugges
|
| + float ordinal_distance_y = distance_y; |
| + |
| snap_scroll_controller_.UpdateSnapScrollMode(distance_x, distance_y); |
| if (snap_scroll_controller_.IsSnappingScrolls()) { |
| if (snap_scroll_controller_.IsSnapHorizontal()) { |
| @@ -346,8 +350,11 @@ class GestureProvider::GestureListenerImpl |
| } |
| if (distance_x || distance_y) { |
| - GestureEventDetails scroll_details( |
| - ET_GESTURE_SCROLL_UPDATE, -distance_x, -distance_y); |
| + GestureEventDetails scroll_details(ET_GESTURE_SCROLL_UPDATE, |
| + -distance_x, |
| + -distance_y, |
| + -ordinal_distance_x, |
| + -ordinal_distance_y); |
| provider_->Send( |
| CreateGesture(ET_GESTURE_SCROLL_UPDATE, e2, scroll_details)); |
| } |
| @@ -359,6 +366,9 @@ class GestureProvider::GestureListenerImpl |
| const MotionEvent& e2, |
| float velocity_x, |
| float velocity_y) OVERRIDE { |
| + float ordinal_velocity_x = velocity_x; |
| + float ordinal_velocity_y = velocity_y; |
| + |
| if (snap_scroll_controller_.IsSnappingScrolls()) { |
| if (snap_scroll_controller_.IsSnapHorizontal()) { |
| velocity_y = 0; |
| @@ -367,7 +377,8 @@ class GestureProvider::GestureListenerImpl |
| } |
| } |
| - provider_->Fling(e2, velocity_x, velocity_y); |
| + provider_->Fling( |
| + e2, velocity_x, velocity_y, ordinal_velocity_x, ordinal_velocity_y); |
| return true; |
| } |
| @@ -587,7 +598,9 @@ bool GestureProvider::CanHandle(const MotionEvent& event) const { |
| void GestureProvider::Fling(const MotionEvent& event, |
| float velocity_x, |
| - float velocity_y) { |
| + float velocity_y, |
| + float ordinal_velocity_x, |
| + float ordinal_velocity_y) { |
| if (!velocity_x && !velocity_y) { |
| EndTouchScrollIfNecessary(event, true); |
| return; |
| @@ -604,8 +617,11 @@ void GestureProvider::Fling(const MotionEvent& event, |
| } |
| EndTouchScrollIfNecessary(event, false); |
| - GestureEventDetails fling_details( |
| - ET_SCROLL_FLING_START, velocity_x, velocity_y); |
| + GestureEventDetails fling_details(ET_SCROLL_FLING_START, |
| + velocity_x, |
| + velocity_y, |
| + ordinal_velocity_x, |
| + ordinal_velocity_y); |
| Send(CreateGesture( |
| ET_SCROLL_FLING_START, event, fling_details)); |
| } |