Backed out 2 changesets (bug 815862, bug 805479) for making bug 768459 nearly perma-fail on Android 2.2 opt.

This commit is contained in:
Ryan VanderMeulen 2013-03-12 11:05:03 -04:00
parent 65be6c55d0
commit 6c9499d590

View File

@ -5,7 +5,6 @@
package org.mozilla.gecko.gfx;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.PrefsHelper;
import org.mozilla.gecko.util.FloatUtils;
@ -87,7 +86,6 @@ abstract class Axis {
static final float MS_PER_FRAME = 1000.0f / 60.0f;
private static final float FRAMERATE_MULTIPLIER = (1000f/60f) / MS_PER_FRAME;
private static final int FLING_VELOCITY_POINTS = 8;
// The values we use for friction are based on a 16.6ms frame, adjust them to MS_PER_FRAME:
// FRICTION^1 = FRICTION_ADJUSTED^(16/MS_PER_FRAME)
@ -100,7 +98,7 @@ abstract class Axis {
FRICTION_SLOW = getFrameAdjustedFriction(getFloatPref(prefs, PREF_SCROLLING_FRICTION_SLOW, 850));
FRICTION_FAST = getFrameAdjustedFriction(getFloatPref(prefs, PREF_SCROLLING_FRICTION_FAST, 970));
VELOCITY_THRESHOLD = 10 / FRAMERATE_MULTIPLIER;
MAX_EVENT_ACCELERATION = getFloatPref(prefs, PREF_SCROLLING_MAX_EVENT_ACCELERATION, GeckoAppShell.getDpi() > 300 ? 100 : 40);
MAX_EVENT_ACCELERATION = getFloatPref(prefs, PREF_SCROLLING_MAX_EVENT_ACCELERATION, 12);
OVERSCROLL_DECEL_RATE = getFrameAdjustedFriction(getFloatPref(prefs, PREF_SCROLLING_OVERSCROLL_DECEL_RATE, 40));
SNAP_LIMIT = getFloatPref(prefs, PREF_SCROLLING_OVERSCROLL_SNAP_LIMIT, 300);
MIN_SCROLLABLE_DISTANCE = getFloatPref(prefs, PREF_SCROLLING_MIN_SCROLLABLE_DISTANCE, 500);
@ -133,8 +131,6 @@ abstract class Axis {
private float mTouchPos; /* Position of the most recent touch event on the current drag. */
private float mLastTouchPos; /* Position of the touch event before touchPos. */
private float mVelocity; /* Velocity in this direction; pixels per animation frame. */
private float[] mRecentVelocities; /* Circular buffer of recent velocities since last touch start. */
private int mRecentVelocityCount; /* Number of values put into mRecentVelocities (unbounded). */
private boolean mScrollingDisabled; /* Whether movement on this axis is locked. */
private boolean mDisableSnap; /* Whether overscroll snapping is disabled. */
private float mDisplacement;
@ -149,7 +145,6 @@ abstract class Axis {
Axis(SubdocumentScrollHelper subscroller) {
mSubscroller = subscroller;
mOverscrollMode = View.OVER_SCROLL_IF_CONTENT_SCROLLS;
mRecentVelocities = new float[FLING_VELOCITY_POINTS];
}
public void setOverScrollMode(int overscrollMode) {
@ -172,7 +167,6 @@ abstract class Axis {
mVelocity = 0.0f;
mScrollingDisabled = false;
mFirstTouchPos = mTouchPos = mLastTouchPos = pos;
mRecentVelocityCount = 0;
}
float panDistance(float currentPos) {
@ -190,9 +184,6 @@ abstract class Axis {
void updateWithTouchAt(float pos, float timeDelta) {
float newVelocity = (mTouchPos - pos) / timeDelta * MS_PER_FRAME;
mRecentVelocities[mRecentVelocityCount % FLING_VELOCITY_POINTS] = newVelocity;
mRecentVelocityCount++;
// If there's a direction change, or current velocity is very low,
// allow setting of the velocity outright. Otherwise, use the current
// velocity and a maximum change factor to set the new velocity.
@ -282,25 +273,12 @@ abstract class Axis {
mFlingState = FlingStates.PANNING;
}
private float calculateFlingVelocity() {
int usablePoints = Math.min(mRecentVelocityCount, FLING_VELOCITY_POINTS);
if (usablePoints <= 1) {
return mVelocity;
}
float average = 0;
for (int i = 0; i < usablePoints; i++) {
average += mRecentVelocities[i];
}
return average / usablePoints;
}
void startFling(boolean stopped) {
mDisableSnap = mSubscroller.scrolling();
if (stopped) {
mFlingState = FlingStates.STOPPED;
} else {
mVelocity = calculateFlingVelocity();
mFlingState = FlingStates.FLINGING;
}
}