Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Unified Diff: ui/events/gesture_detection/snap_scroll_controller.cc

Issue 1049383003: Postpone rail application for touch scrolling - chrome side. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698