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

Unified Diff: ui/base/gestures/gesture_sequence.cc

Issue 11415293: Refactor access to scroll deltas in GesturePoint (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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
« no previous file with comments | « ui/base/gestures/gesture_point.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/gestures/gesture_sequence.cc
diff --git a/ui/base/gestures/gesture_sequence.cc b/ui/base/gestures/gesture_sequence.cc
index 07d42eda3f74e8e4ea95ac081e387cdb67aea8e0..164f97fb3669a77a2074d631824e6748310e7efb 100644
--- a/ui/base/gestures/gesture_sequence.cc
+++ b/ui/base/gestures/gesture_sequence.cc
@@ -733,26 +733,24 @@ void GestureSequence::AppendScrollGestureEnd(const GesturePoint& point,
void GestureSequence::AppendScrollGestureUpdate(GesturePoint& point,
Gestures* gestures) {
- float dx, dy;
+ gfx::Vector2d d;
gfx::Point location;
if (point_count_ == 1) {
- dx = point.x_delta();
- dy = point.y_delta();
+ d = point.ScrollDelta();
location = point.last_touch_position();
} else {
location = bounding_box_.CenterPoint();
- dx = location.x() - latest_multi_scroll_update_location_.x();
- dy = location.y() - latest_multi_scroll_update_location_.y();
+ d = location - latest_multi_scroll_update_location_;
latest_multi_scroll_update_location_ = location;
}
if (scroll_type_ == ST_HORIZONTAL)
- dy = 0;
+ d.set_y(0);
else if (scroll_type_ == ST_VERTICAL)
- dx = 0;
- if (dx == 0 && dy == 0)
+ d.set_x(0);
+ if (d == gfx::Vector2d())
sadrul 2012/12/04 21:27:44 d.IsZero()?
rjkroege 2012/12/04 21:53:34 Done.
return;
- GestureEventDetails details(ui::ET_GESTURE_SCROLL_UPDATE, dx, dy);
+ GestureEventDetails details(ui::ET_GESTURE_SCROLL_UPDATE, d.x(), d.y());
details.SetScrollVelocity(
scroll_type_ == ST_VERTICAL ? 0 : point.XVelocity(),
scroll_type_ == ST_HORIZONTAL ? 0 : point.YVelocity());
« no previous file with comments | « ui/base/gestures/gesture_point.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698