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

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

Issue 1251323002: Plumb smooth scrolling in Chromium compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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.annotation.SuppressLint; 7 import android.annotation.SuppressLint;
8 import android.annotation.TargetApi; 8 import android.annotation.TargetApi;
9 import android.app.Activity; 9 import android.app.Activity;
10 import android.app.SearchManager; 10 import android.app.SearchManager;
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 // touch pipline, so we ignore them entirely. 1238 // touch pipline, so we ignore them entirely.
1239 return eventAction == MotionEvent.ACTION_DOWN 1239 return eventAction == MotionEvent.ACTION_DOWN
1240 || eventAction == MotionEvent.ACTION_UP 1240 || eventAction == MotionEvent.ACTION_UP
1241 || eventAction == MotionEvent.ACTION_CANCEL 1241 || eventAction == MotionEvent.ACTION_CANCEL
1242 || eventAction == MotionEvent.ACTION_MOVE 1242 || eventAction == MotionEvent.ACTION_MOVE
1243 || eventAction == MotionEvent.ACTION_POINTER_DOWN 1243 || eventAction == MotionEvent.ACTION_POINTER_DOWN
1244 || eventAction == MotionEvent.ACTION_POINTER_UP; 1244 || eventAction == MotionEvent.ACTION_POINTER_UP;
1245 } 1245 }
1246 1246
1247 public boolean isScrollInProgress() { 1247 public boolean isScrollInProgress() {
1248 return mTouchScrollInProgress || mPotentiallyActiveFlingCount > 0 1248 return mTouchScrollInProgress || mPotentiallyActiveFlingCount > 0;
1249 || getContentViewClient().isExternalScrollActive();
1250 } 1249 }
1251 1250
1252 @SuppressWarnings("unused") 1251 @SuppressWarnings("unused")
1253 @CalledByNative 1252 @CalledByNative
1254 private void onFlingStartEventConsumed(int vx, int vy) { 1253 private void onFlingStartEventConsumed(int vx, int vy) {
1255 mTouchScrollInProgress = false; 1254 mTouchScrollInProgress = false;
1256 mPotentiallyActiveFlingCount++; 1255 mPotentiallyActiveFlingCount++;
1257 for (mGestureStateListenersIterator.rewind(); 1256 for (mGestureStateListenersIterator.rewind();
1258 mGestureStateListenersIterator.hasNext();) { 1257 mGestureStateListenersIterator.hasNext();) {
1259 mGestureStateListenersIterator.next().onFlingStartGesture( 1258 mGestureStateListenersIterator.next().onFlingStartGesture(
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 nativeDoubleTap(mNativeContentViewCore, timeMs, x, y); 1347 nativeDoubleTap(mNativeContentViewCore, timeMs, x, y);
1349 } 1348 }
1350 1349
1351 public void flingViewport(long timeMs, int velocityX, int velocityY) { 1350 public void flingViewport(long timeMs, int velocityX, int velocityY) {
1352 if (mNativeContentViewCore == 0) return; 1351 if (mNativeContentViewCore == 0) return;
1353 nativeFlingCancel(mNativeContentViewCore, timeMs); 1352 nativeFlingCancel(mNativeContentViewCore, timeMs);
1354 nativeScrollBegin(mNativeContentViewCore, timeMs, 0, 0, velocityX, veloc ityY, true); 1353 nativeScrollBegin(mNativeContentViewCore, timeMs, 0, 0, velocityX, veloc ityY, true);
1355 nativeFlingStart(mNativeContentViewCore, timeMs, 0, 0, velocityX, veloci tyY, true); 1354 nativeFlingStart(mNativeContentViewCore, timeMs, 0, 0, velocityX, veloci tyY, true);
1356 } 1355 }
1357 1356
1357 public void smoothScroll(int targetX, int targetY, long durationMs) {
jdduke (slow) 2015/07/28 15:54:31 Nit: Javadoc.
hush (inactive) 2015/07/28 21:36:46 Done.
1358 mWebContents.smoothScroll(targetX, targetY, durationMs);
1359 }
1360
1358 /** 1361 /**
1359 * Cancel any fling gestures active. 1362 * Cancel any fling gestures active.
1360 * @param timeMs Current time (in milliseconds). 1363 * @param timeMs Current time (in milliseconds).
1361 */ 1364 */
1362 public void cancelFling(long timeMs) { 1365 public void cancelFling(long timeMs) {
1363 if (mNativeContentViewCore == 0) return; 1366 if (mNativeContentViewCore == 0) return;
1364 nativeFlingCancel(mNativeContentViewCore, timeMs); 1367 nativeFlingCancel(mNativeContentViewCore, timeMs);
1365 } 1368 }
1366 1369
1367 /** 1370 /**
(...skipping 21 matching lines...) Expand all
1389 listener.onPinchStarted(); 1392 listener.onPinchStarted();
1390 break; 1393 break;
1391 case GestureEventType.PINCH_END: 1394 case GestureEventType.PINCH_END:
1392 listener.onPinchEnded(); 1395 listener.onPinchEnded();
1393 break; 1396 break;
1394 case GestureEventType.FLING_END: 1397 case GestureEventType.FLING_END:
1395 listener.onFlingEndGesture( 1398 listener.onFlingEndGesture(
1396 computeVerticalScrollOffset(), 1399 computeVerticalScrollOffset(),
1397 computeVerticalScrollExtent()); 1400 computeVerticalScrollExtent());
1398 break; 1401 break;
1399 case GestureEventType.FLING_CANCEL:
1400 listener.onFlingCancelGesture();
1401 break;
1402 case GestureEventType.SCROLL_START: 1402 case GestureEventType.SCROLL_START:
1403 listener.onScrollStarted( 1403 listener.onScrollStarted(
1404 computeVerticalScrollOffset(), 1404 computeVerticalScrollOffset(),
1405 computeVerticalScrollExtent()); 1405 computeVerticalScrollExtent());
1406 break; 1406 break;
1407 case GestureEventType.SCROLL_END: 1407 case GestureEventType.SCROLL_END:
1408 listener.onScrollEnded( 1408 listener.onScrollEnded(
1409 computeVerticalScrollOffset(), 1409 computeVerticalScrollOffset(),
1410 computeVerticalScrollExtent()); 1410 computeVerticalScrollExtent());
1411 break; 1411 break;
(...skipping 1902 matching lines...) Expand 10 before | Expand all | Expand 10 after
3314 private native void nativeSetTextTrackSettings(long nativeContentViewCoreImp l, 3314 private native void nativeSetTextTrackSettings(long nativeContentViewCoreImp l,
3315 boolean textTracksEnabled, String textTrackBackgroundColor, String t extTrackFontFamily, 3315 boolean textTracksEnabled, String textTrackBackgroundColor, String t extTrackFontFamily,
3316 String textTrackFontStyle, String textTrackFontVariant, String textT rackTextColor, 3316 String textTrackFontStyle, String textTrackFontVariant, String textT rackTextColor,
3317 String textTrackTextShadow, String textTrackTextSize); 3317 String textTrackTextShadow, String textTrackTextSize);
3318 3318
3319 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l, 3319 private native void nativeExtractSmartClipData(long nativeContentViewCoreImp l,
3320 int x, int y, int w, int h); 3320 int x, int y, int w, int h);
3321 3321
3322 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque); 3322 private native void nativeSetBackgroundOpaque(long nativeContentViewCoreImpl , boolean opaque);
3323 } 3323 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698