OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.util.Log; | 8 import android.util.Log; |
9 import android.view.Gravity; | 9 import android.view.Gravity; |
10 import android.view.MotionEvent; | 10 import android.view.MotionEvent; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 138 } |
139 } | 139 } |
140 | 140 |
141 // Passes the touch event to ScaleGestureDetector so that its internal state | 141 // Passes the touch event to ScaleGestureDetector so that its internal state |
142 // won't go wrong. ScaleGestureDetector needs two pointers in a MotionEvent | 142 // won't go wrong. ScaleGestureDetector needs two pointers in a MotionEvent |
143 // to recognize a zoom gesture. | 143 // to recognize a zoom gesture. |
144 boolean processTouchEvent(MotionEvent event) { | 144 boolean processTouchEvent(MotionEvent event) { |
145 // TODO: Need to deal with multi-touch transition | 145 // TODO: Need to deal with multi-touch transition |
146 mMultiTouchListener.setTemporarilyIgnoreDetectorEvents(false); | 146 mMultiTouchListener.setTemporarilyIgnoreDetectorEvents(false); |
147 try { | 147 try { |
148 return mMultiTouchDetector.onTouchEvent(event); | 148 boolean inGesture = isScaleGestureDetectionInProgress(); |
| 149 boolean retVal = mMultiTouchDetector.onTouchEvent(event); |
| 150 if (event.getActionMasked() == MotionEvent.ACTION_UP && !inGesture)
return false; |
| 151 return retVal; |
149 } catch (Exception e) { | 152 } catch (Exception e) { |
150 Log.e(TAG, "ScaleGestureDetector got into a bad state!", e); | 153 Log.e(TAG, "ScaleGestureDetector got into a bad state!", e); |
151 assert(false); | 154 assert(false); |
152 } | 155 } |
153 return false; | 156 return false; |
154 } | 157 } |
155 | 158 |
156 void updateMultiTouchSupport() { | 159 void updateMultiTouchSupport() { |
157 mMultiTouchListener.setPermanentlyIgnoreDetectorEvents( | 160 mMultiTouchListener.setPermanentlyIgnoreDetectorEvents( |
158 !mContentViewCore.getContentSettings().supportsMultiTouchZoom()); | 161 !mContentViewCore.getContentSettings().supportsMultiTouchZoom()); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 if (zoomIn) { | 213 if (zoomIn) { |
211 mContentViewCore.zoomIn(); | 214 mContentViewCore.zoomIn(); |
212 } else { | 215 } else { |
213 mContentViewCore.zoomOut(); | 216 mContentViewCore.zoomOut(); |
214 } | 217 } |
215 // ContentView will call updateZoomControls after its current page s
cale | 218 // ContentView will call updateZoomControls after its current page s
cale |
216 // is got updated from the native code. | 219 // is got updated from the native code. |
217 } | 220 } |
218 } | 221 } |
219 } | 222 } |
OLD | NEW |