Chromium Code Reviews| 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..49cf5fe4d95483155426bd49ffb320416f6a6442 100644 |
| --- a/ui/base/gestures/gesture_sequence.cc |
| +++ b/ui/base/gestures/gesture_sequence.cc |
| @@ -38,7 +38,9 @@ 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. In particular, |
| + // this means that a JavaScript touch handler called |
| + // |preventDefault| on the associated touch event. |
|
sadrul
2012/09/21 23:09:40
This is also for touch-events that were processed
rjkroege
2012/09/24 13:53:16
Done.
|
| TSI_ALWAYS // The touch-event should always affect gesture |
| // recognition. |
| @@ -89,6 +91,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 +219,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 +280,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 +383,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()); |
| @@ -390,8 +395,8 @@ GestureSequence::Gestures* GestureSequence::ProcessTouchEventForGesture( |
| if (scroll_type_ == ST_VERTICAL || |
| scroll_type_ == ST_HORIZONTAL) |
| BreakRailScroll(event, point, gestures.get()); |
| - if (ScrollUpdate(event, point, gestures.get())) |
| - point.UpdateForScroll(); |
| + if (ScrollUpdate(event, point, gestures.get())) |
|
rjkroege
2012/09/21 22:50:38
oops.
rjkroege
2012/09/24 13:53:16
Done.
|
| + point.UpdateForScroll(); |
| break; |
| case GST_SCROLL_FIRST_RELEASED: |
| case GST_SCROLL_FIRST_CANCELLED: |
| @@ -703,9 +708,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(); |
| + int dx, dy; |
| + if (point_count_ == 1) { |
| + dx = round(point.x_delta()); |
| + dy = round(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) |