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..740cde6c3a51ed922f2ad69338ddcfcb6345d46a 100644 |
--- a/ui/events/gesture_detection/gesture_provider.cc |
+++ b/ui/events/gesture_detection/gesture_provider.cc |
@@ -130,7 +130,8 @@ 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) {} |
bool OnTouchEvent(const MotionEvent& event) { |
// TODO: Need to deal with multi-touch transition. |
@@ -171,6 +172,7 @@ class GestureProvider::ScaleGestureListenerImpl |
const MotionEvent& e) OVERRIDE { |
if (ignore_multitouch_events_ && !detector.InDoubleTapMode()) |
return false; |
+ |
if (!pinch_event_sent_) { |
pinch_event_sent_ = true; |
provider_->Send(CreateGesture(ET_GESTURE_PINCH_BEGIN, |
@@ -182,6 +184,13 @@ class GestureProvider::ScaleGestureListenerImpl |
GetBoundingBox(e))); |
} |
+ float span = detector.GetCurrentSpan(); |
+ bool pinch_occured = std::abs(span - detector.GetPreviousSpan()) >= |
+ min_pinch_update_span_delta_; |
+ |
jdduke (slow)
2014/05/22 18:06:35
You might consider merging all of this into:
if (
tdresser
2014/05/22 18:25:17
Done.
|
+ if (!pinch_occured) |
+ return false; |
+ |
float scale = detector.GetScaleFactor(); |
if (scale == 1) |
return true; |
@@ -247,6 +256,10 @@ 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_; |
+ |
DISALLOW_COPY_AND_ASSIGN(ScaleGestureListenerImpl); |
}; |