Chromium Code Reviews| Index: ui/events/gesture_detection/gesture_provider.cc |
| diff --git a/ui/events/gesture_detection/gesture_provider.cc b/ui/events/gesture_detection/gesture_provider.cc |
| index 7607f08d8765a7fbc02a96f7eb471af5f813efcb..1f57adf2f96de7841ea038c3bff999e933fd9c10 100644 |
| --- a/ui/events/gesture_detection/gesture_provider.cc |
| +++ b/ui/events/gesture_detection/gesture_provider.cc |
| @@ -130,7 +130,9 @@ class GestureProvider::ScaleGestureListenerImpl |
| : scale_gesture_detector_(config, this), |
| provider_(provider), |
| ignore_multitouch_events_(false), |
| - pinch_event_sent_(false) {} |
| + pinch_event_sent_(false), |
| + min_pinch_update_span_delta_(config.min_pinch_update_span_delta), |
| + prev_span_(0) {} |
| bool OnTouchEvent(const MotionEvent& event) { |
| // TODO: Need to deal with multi-touch transition. |
| @@ -171,6 +173,16 @@ class GestureProvider::ScaleGestureListenerImpl |
| const MotionEvent& e) OVERRIDE { |
| if (ignore_multitouch_events_ && !detector.InDoubleTapMode()) |
| return false; |
| + |
| + float span = detector.GetCurrentSpan(); |
| + bool pinch_occured = |
|
jdduke (slow)
2014/05/22 17:37:24
Hmm, why are you doing this before the if (!pinch_
tdresser
2014/05/22 17:57:22
Done.
|
| + std::abs(span - prev_span_) >= min_pinch_update_span_delta_; |
| + |
| + if (!pinch_occured) |
| + return true; |
| + |
| + prev_span_ = span; |
| + |
| if (!pinch_event_sent_) { |
| pinch_event_sent_ = true; |
| provider_->Send(CreateGesture(ET_GESTURE_PINCH_BEGIN, |
| @@ -247,6 +259,12 @@ class GestureProvider::ScaleGestureListenerImpl |
| // Whether any pinch zoom event has been sent to native. |
| bool pinch_event_sent_; |
| + // The minimum change in span required before this is considered a pinch. See |
| + // crbug.com/373318. |
| + float min_pinch_update_span_delta_; |
| + |
| + float prev_span_; |
|
jdduke (slow)
2014/05/22 17:37:24
See comment above, we shouldn't need to cache the
tdresser
2014/05/22 17:57:22
Done.
|
| + |
| DISALLOW_COPY_AND_ASSIGN(ScaleGestureListenerImpl); |
| }; |