Index: ui/events/gesture_detection/snap_scroll_controller.cc |
diff --git a/ui/events/gesture_detection/snap_scroll_controller.cc b/ui/events/gesture_detection/snap_scroll_controller.cc |
index 9ecf6b108c8a71030bc282bda1dbc1c5f065696a..827c32738c28ae85c406a210b8675faf935eede5 100644 |
--- a/ui/events/gesture_detection/snap_scroll_controller.cc |
+++ b/ui/events/gesture_detection/snap_scroll_controller.cc |
@@ -91,7 +91,7 @@ void SnapScrollController::SetSnapScrollMode( |
void SnapScrollController::UpdateSnapScrollMode(float distance_x, |
float distance_y) { |
- if (!IsSnappingScrolls()) |
+ if (mode_ != SNAP_VERT && mode_ != SNAP_HORIZ) |
return; |
accumulated_distance_ += |
@@ -110,15 +110,25 @@ void SnapScrollController::UpdateSnapScrollMode(float distance_x, |
} |
bool SnapScrollController::IsSnapVertical() const { |
- return mode_ == SNAP_VERT; |
+ return ScrollRailState() == GestureEventDetails::ScrollRailState::Vertical; |
} |
bool SnapScrollController::IsSnapHorizontal() const { |
- return mode_ == SNAP_HORIZ; |
+ return ScrollRailState() == GestureEventDetails::ScrollRailState::Horizontal; |
} |
bool SnapScrollController::IsSnappingScrolls() const { |
- return IsSnapHorizontal() || IsSnapVertical(); |
+ return ScrollRailState() != GestureEventDetails::ScrollRailState::Free; |
+} |
+ |
+ |
+GestureEventDetails::ScrollRailState SnapScrollController::ScrollRailState() |
+ const { |
+ if (mode_ == SNAP_VERT) |
+ return GestureEventDetails::ScrollRailState::Vertical; |
+ if (mode_ == SNAP_HORIZ) |
+ return GestureEventDetails::ScrollRailState::Horizontal; |
+ return GestureEventDetails::ScrollRailState::Free; |
} |
} // namespace ui |