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

Side by Side Diff: Source/platform/scroll/ScrollAnimator.cpp

Issue 1018183002: Add rails to input wheel events. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: More plumbing and tests 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 unified diff | Download patch
« no previous file with comments | « Source/platform/PlatformWheelEvent.h ('k') | Source/web/WebInputEvent.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2010, Google Inc. All rights reserved. 2 * Copyright (c) 2010, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 67
68 void ScrollAnimator::scrollToOffsetWithoutAnimation(const FloatPoint& offset) 68 void ScrollAnimator::scrollToOffsetWithoutAnimation(const FloatPoint& offset)
69 { 69 {
70 m_currentPosX = offset.x(); 70 m_currentPosX = offset.x();
71 m_currentPosY = offset.y(); 71 m_currentPosY = offset.y();
72 notifyPositionChanged(); 72 notifyPositionChanged();
73 } 73 }
74 74
75 ScrollResult ScrollAnimator::handleWheelEvent(const PlatformWheelEvent& e) 75 ScrollResult ScrollAnimator::handleWheelEvent(const PlatformWheelEvent& e)
76 { 76 {
77 bool canScrollX = m_scrollableArea->userInputScrollable(HorizontalScrollbar) ; 77 bool canScrollX = m_scrollableArea->userInputScrollable(HorizontalScrollbar)
78 bool canScrollY = m_scrollableArea->userInputScrollable(VerticalScrollbar); 78 && e.railsMode() != PlatformEvent::RailsModeVertical;
79 bool canScrollY = m_scrollableArea->userInputScrollable(VerticalScrollbar)
80 && e.railsMode() != PlatformEvent::RailsModeHorizontal;
79 81
80 // Accept the event if we are scrollable in that direction and can still 82 // Accept the event if we are scrollable in that direction and can still
81 // scroll any further. 83 // scroll any further.
82 float deltaX = canScrollX ? e.deltaX() : 0; 84 float deltaX = canScrollX ? e.deltaX() : 0;
83 float deltaY = canScrollY ? e.deltaY() : 0; 85 float deltaY = canScrollY ? e.deltaY() : 0;
84 86
85 ScrollResult result(false); 87 ScrollResult result(false);
86 88
87 #if !OS(MACOSX) 89 #if !OS(MACOSX)
88 ScrollGranularity granularity = e.hasPreciseScrollingDeltas() ? ScrollByPrec isePixel : ScrollByPixel; 90 ScrollGranularity granularity = e.hasPreciseScrollingDeltas() ? ScrollByPrec isePixel : ScrollByPixel;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 162 }
161 163
162 float ScrollAnimator::clampScrollPosition(ScrollbarOrientation orientation, floa t pos) 164 float ScrollAnimator::clampScrollPosition(ScrollbarOrientation orientation, floa t pos)
163 { 165 {
164 float maxScrollPos = m_scrollableArea->maximumScrollPosition(orientation); 166 float maxScrollPos = m_scrollableArea->maximumScrollPosition(orientation);
165 float minScrollPos = m_scrollableArea->minimumScrollPosition(orientation); 167 float minScrollPos = m_scrollableArea->minimumScrollPosition(orientation);
166 return std::max(std::min(pos, maxScrollPos), minScrollPos); 168 return std::max(std::min(pos, maxScrollPos), minScrollPos);
167 } 169 }
168 170
169 } // namespace blink 171 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/PlatformWheelEvent.h ('k') | Source/web/WebInputEvent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698