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

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

Issue 10958053: Fix drift while scrolling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed windows build Created 8 years, 3 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
« no previous file with comments | « ui/aura/gestures/gesture_recognizer_unittest.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 2c3b599e78f8e7771aaaed6ac9084b66a27e6732..e56bfca8d026c3b64114d0476b595835218c6846 100644
--- a/ui/base/gestures/gesture_sequence.cc
+++ b/ui/base/gestures/gesture_sequence.cc
@@ -38,7 +38,10 @@ enum TouchStatusInternal {
// been processed.
TSI_PROCESSED, // The touch-event should affect gesture-recognition only
- // if the touch-event has been processed.
+ // if the touch-event has been processed. For example,,
+ // this means that a JavaScript touch handler called
+ // |preventDefault| on the associated touch event
+ // or was processed by an aura-window or views-view.
TSI_ALWAYS // The touch-event should always affect gesture
// recognition.
@@ -89,6 +92,9 @@ enum EdgeStateSignatureType {
GST_PENDING_SYNTHETIC_CLICK_FIRST_MOVED =
G(GS_PENDING_SYNTHETIC_CLICK, 0, TS_MOVED, TSI_NOT_PROCESSED),
+ GST_PENDING_SYNTHETIC_CLICK_FIRST_MOVED_PROCESSED =
+ G(GS_PENDING_SYNTHETIC_CLICK, 0, TS_MOVED, TSI_PROCESSED),
+
GST_PENDING_SYNTHETIC_CLICK_FIRST_STATIONARY =
G(GS_PENDING_SYNTHETIC_CLICK, 0, TS_STATIONARY, TSI_NOT_PROCESSED),
@@ -214,6 +220,7 @@ EdgeStateSignatureType Signature(GestureState gesture_state,
case GST_PENDING_SYNTHETIC_CLICK_FIRST_RELEASED:
case GST_PENDING_SYNTHETIC_CLICK_FIRST_RELEASED_HANDLED:
case GST_PENDING_SYNTHETIC_CLICK_FIRST_MOVED:
+ case GST_PENDING_SYNTHETIC_CLICK_FIRST_MOVED_PROCESSED:
case GST_PENDING_SYNTHETIC_CLICK_FIRST_STATIONARY:
case GST_PENDING_SYNTHETIC_CLICK_FIRST_CANCELLED:
case GST_PENDING_SYNTHETIC_CLICK_SECOND_PRESSED:
@@ -274,10 +281,6 @@ unsigned int ComputeTouchBitmask(const GesturePoint* points) {
}
float CalibrateFlingVelocity(float velocity) {
- // TODO(sad|rjkroege): fling-curve is currently configured to work well with
- // touchpad scroll-events. This curve needs to be adjusted to work correctly
- // with both touchpad and touchscreen. Until then, scale quadratically.
- // http://crbug.com/120154
const float velocity_scaling =
GestureConfiguration::touchscreen_fling_acceleration_adjustment();
return velocity_scaling * velocity;
@@ -381,6 +384,9 @@ GestureSequence::Gestures* GestureSequence::ProcessTouchEventForGesture(
point.UpdateForScroll();
}
break;
+ case GST_PENDING_SYNTHETIC_CLICK_FIRST_MOVED_PROCESSED:
+ point.UpdateForScroll();
+ break;
case GST_PENDING_SYNTHETIC_CLICK_FIRST_RELEASED_HANDLED:
case GST_PENDING_SYNTHETIC_CLICK_FIRST_CANCELLED:
PrependTapCancelGestureEvent(point, gestures.get());
@@ -703,9 +709,15 @@ void GestureSequence::AppendScrollGestureEnd(const GesturePoint& point,
void GestureSequence::AppendScrollGestureUpdate(GesturePoint& point,
const gfx::Point& location,
Gestures* gestures) {
- gfx::Point current_center = bounding_box_.CenterPoint();
- int dx = current_center.x() - bounding_box_last_center_.x();
- int dy = current_center.y() - bounding_box_last_center_.y();
+ float dx, dy;
+ if (point_count_ == 1) {
+ dx = point.x_delta();
+ dy = point.y_delta();
+ } else {
+ gfx::Point current_center = bounding_box_.CenterPoint();
+ dx = current_center.x() - bounding_box_last_center_.x();
+ dy = current_center.y() - bounding_box_last_center_.y();
+ }
if (scroll_type_ == ST_HORIZONTAL)
dy = 0;
else if (scroll_type_ == ST_VERTICAL)
« no previous file with comments | « ui/aura/gestures/gesture_recognizer_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698