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

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewGestureHandler.java

Issue 11228010: Do not wait for the double tap timeout on pages with fixed page scale (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added new method to mock child classes in test file Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.os.Bundle; 8 import android.os.Bundle;
9 import android.util.Log; 9 import android.util.Log;
10 import android.util.Pair; 10 import android.util.Pair;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 * @param x The amount scrolled in the X direction. 191 * @param x The amount scrolled in the X direction.
192 * @param y The amount scrolled in the Y direction. 192 * @param y The amount scrolled in the Y direction.
193 * @return Whether or not the UI consumed and handled this event. 193 * @return Whether or not the UI consumed and handled this event.
194 */ 194 */
195 boolean didUIStealScroll(float x, float y); 195 boolean didUIStealScroll(float x, float y);
196 196
197 /** 197 /**
198 * Show the zoom picker UI. 198 * Show the zoom picker UI.
199 */ 199 */
200 public void invokeZoomPicker(); 200 public void invokeZoomPicker();
201
202 /**
203 * @return Whether changing the page scale is not possible on the curren t page.
204 */
205 public boolean hasFixedPageScale();
201 } 206 }
202 207
203 ContentViewGestureHandler( 208 ContentViewGestureHandler(
204 Context context, MotionEventDelegate delegate, ZoomManager zoomManag er) { 209 Context context, MotionEventDelegate delegate, ZoomManager zoomManag er) {
205 mExtraParamBundle = new Bundle(); 210 mExtraParamBundle = new Bundle();
206 mLongPressDetector = new LongPressDetector(context, this); 211 mLongPressDetector = new LongPressDetector(context, this);
207 mMotionEventDelegate = delegate; 212 mMotionEventDelegate = delegate;
208 mZoomManager = zoomManager; 213 mZoomManager = zoomManager;
209 initGestureDetectors(context); 214 initGestureDetectors(context);
210 } 215 }
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 if (!mIgnoreSingleTap && !mLongPressDetector.isInLongPre ss() && 389 if (!mIgnoreSingleTap && !mLongPressDetector.isInLongPre ss() &&
385 (e.getEventTime() - e.getDownTime() > DOUBLE_TAP _TIMEOUT)) { 390 (e.getEventTime() - e.getDownTime() > DOUBLE_TAP _TIMEOUT)) {
386 float x = e.getX(); 391 float x = e.getX();
387 float y = e.getY(); 392 float y = e.getY();
388 if (mMotionEventDelegate.sendGesture(GESTURE_SINGLE_ TAP_UP, 393 if (mMotionEventDelegate.sendGesture(GESTURE_SINGLE_ TAP_UP,
389 e.getEventTime(), (int) x, (int) y, null)) { 394 e.getEventTime(), (int) x, (int) y, null)) {
390 mIgnoreSingleTap = true; 395 mIgnoreSingleTap = true;
391 } 396 }
392 setClickXAndY((int) x, (int) y); 397 setClickXAndY((int) x, (int) y);
393 return true; 398 return true;
399 } else if (mMotionEventDelegate.hasFixedPageScale()) {
400 // If page is not user scalable, we don't need to wa it
401 // for double tap timeout.
402 float x = e.getX();
403 float y = e.getY();
404 mExtraParamBundle.clear();
405 mExtraParamBundle.putBoolean(SHOW_PRESS, mShowPressI sCalled);
406 if (mMotionEventDelegate.sendGesture(GESTURE_SINGLE_ TAP_CONFIRMED,
407 e.getEventTime(), (int) x, (int) y, mExtraPa ramBundle)) {
408 mIgnoreSingleTap = true;
409 }
410 setClickXAndY((int) x, (int) y);
394 } 411 }
395 return false; 412 return false;
396 } 413 }
397 414
398 @Override 415 @Override
399 public boolean onSingleTapConfirmed(MotionEvent e) { 416 public boolean onSingleTapConfirmed(MotionEvent e) {
400 // Long taps in the edges of the screen have their event s delayed by 417 // Long taps in the edges of the screen have their event s delayed by
401 // ContentViewHolder for tab swipe operations. As a cons equence of the delay 418 // ContentViewHolder for tab swipe operations. As a cons equence of the delay
402 // this method might be called after receiving the up ev ent. 419 // this method might be called after receiving the up ev ent.
403 // These corner cases should be ignored. 420 // These corner cases should be ignored.
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 /** 760 /**
744 * @return Whether the ContentViewGestureHandler can handle a MotionEvent ri ght now. True only 761 * @return Whether the ContentViewGestureHandler can handle a MotionEvent ri ght now. True only
745 * if it's the start of a new stream (ACTION_DOWN), or a continuation of the current stream. 762 * if it's the start of a new stream (ACTION_DOWN), or a continuation of the current stream.
746 */ 763 */
747 boolean canHandle(MotionEvent ev) { 764 boolean canHandle(MotionEvent ev) {
748 return ev.getAction() == MotionEvent.ACTION_DOWN || 765 return ev.getAction() == MotionEvent.ACTION_DOWN ||
749 (mCurrentDownEvent != null && mCurrentDownEvent.getDownTime() == ev.getDownTime()); 766 (mCurrentDownEvent != null && mCurrentDownEvent.getDownTime() == ev.getDownTime());
750 } 767 }
751 768
752 } 769 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698