Bug 1307522 - Delete a bunch of classes and related goop no longer used now that JPZ is gone. r?snorp draft
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 04 Oct 2016 14:41:13 -0400
changeset 420802 dfcdbd6f1b4d6e5ac05ad5b69aed19eddb94baef
parent 420680 42c95d88aaaa7c2eca1d278399421d437441ac4d
child 420803 7f9afe1fb3b617cab0af79e0c3c954b7703a06fd
push id31302
push userkgupta@mozilla.com
push dateTue, 04 Oct 2016 18:43:45 +0000
reviewerssnorp
bugs1307522
milestone52.0a1
Bug 1307522 - Delete a bunch of classes and related goop no longer used now that JPZ is gone. r?snorp MozReview-Commit-ID: Jq6xJEO0u9x
mobile/android/base/moz.build
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/Axis.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/DisplayPortCalculator.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/DisplayPortMetrics.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/DrawTimingQueue.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/PanZoomTarget.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SimpleScaleGestureDetector.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SubdocumentScrollHelper.java
widget/android/GeneratedJNIWrappers.cpp
widget/android/GeneratedJNIWrappers.h
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -231,23 +231,19 @@ gvjar.sources += [geckoview_source_dir +
     'GeckoScreenOrientation.java',
     'GeckoSharedPrefs.java',
     'GeckoSmsManager.java',
     'GeckoThread.java',
     'GeckoView.java',
     'GeckoViewChrome.java',
     'GeckoViewContent.java',
     'GeckoViewFragment.java',
-    'gfx/Axis.java',
     'gfx/BitmapUtils.java',
     'gfx/BufferedImage.java',
     'gfx/BufferedImageGLInfo.java',
-    'gfx/DisplayPortCalculator.java',
-    'gfx/DisplayPortMetrics.java',
-    'gfx/DrawTimingQueue.java',
     'gfx/DynamicToolbarAnimator.java',
     'gfx/FloatSize.java',
     'gfx/FullScreenState.java',
     'gfx/GeckoLayerClient.java',
     'gfx/ImmutableViewportMetrics.java',
     'gfx/IntSize.java',
     'gfx/LayerRenderer.java',
     'gfx/LayerView.java',
@@ -256,19 +252,17 @@ gvjar.sources += [geckoview_source_dir +
     'gfx/OverscrollEdgeEffect.java',
     'gfx/PanningPerfAPI.java',
     'gfx/PanZoomController.java',
     'gfx/PanZoomTarget.java',
     'gfx/PointUtils.java',
     'gfx/ProgressiveUpdateData.java',
     'gfx/RectUtils.java',
     'gfx/RenderTask.java',
-    'gfx/SimpleScaleGestureDetector.java',
     'gfx/StackScroller.java',
-    'gfx/SubdocumentScrollHelper.java',
     'gfx/SurfaceTextureListener.java',
     'gfx/ViewTransform.java',
     'InputConnectionListener.java',
     'InputMethods.java',
     'NotificationListener.java',
     'NSSBridge.java',
     'permissions/PermissionBlock.java',
     'permissions/Permissions.java',
deleted file mode 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/Axis.java
+++ /dev/null
@@ -1,532 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.gfx;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.mozilla.gecko.GeckoAppShell;
-import org.mozilla.gecko.PrefsHelper;
-import org.mozilla.gecko.util.FloatUtils;
-
-import android.os.SystemClock;
-import android.util.Log;
-import android.view.View;
-
-/**
- * This class represents the physics for one axis of movement (i.e. either
- * horizontal or vertical). It tracks the different properties of movement
- * like displacement, velocity, viewport dimensions, etc. pertaining to
- * a particular axis.
- */
-abstract class Axis {
-    private static final String LOGTAG = "GeckoAxis";
-
-    private static final String PREF_SCROLLING_FRICTION_SLOW = "ui.scrolling.friction_slow";
-    private static final String PREF_SCROLLING_FRICTION_FAST = "ui.scrolling.friction_fast";
-    private static final String PREF_SCROLLING_MAX_EVENT_ACCELERATION = "ui.scrolling.max_event_acceleration";
-    private static final String PREF_SCROLLING_OVERSCROLL_DECEL_RATE = "ui.scrolling.overscroll_decel_rate";
-    private static final String PREF_SCROLLING_OVERSCROLL_SNAP_LIMIT = "ui.scrolling.overscroll_snap_limit";
-    private static final String PREF_SCROLLING_MIN_SCROLLABLE_DISTANCE = "ui.scrolling.min_scrollable_distance";
-    private static final String PREF_FLING_ACCEL_INTERVAL = "ui.scrolling.fling_accel_interval";
-    private static final String PREF_FLING_ACCEL_BASE_MULTIPLIER = "ui.scrolling.fling_accel_base_multiplier";
-    private static final String PREF_FLING_ACCEL_SUPPLEMENTAL_MULTIPLIER = "ui.scrolling.fling_accel_supplemental_multiplier";
-    private static final String PREF_FLING_CURVE_FUNCTION_X1 = "ui.scrolling.fling_curve_function_x1";
-    private static final String PREF_FLING_CURVE_FUNCTION_Y1 = "ui.scrolling.fling_curve_function_y1";
-    private static final String PREF_FLING_CURVE_FUNCTION_X2 = "ui.scrolling.fling_curve_function_x2";
-    private static final String PREF_FLING_CURVE_FUNCTION_Y2 = "ui.scrolling.fling_curve_function_y2";
-    private static final String PREF_FLING_CURVE_THRESHOLD_VELOCITY = "ui.scrolling.fling_curve_threshold_velocity";
-    private static final String PREF_FLING_CURVE_MAXIMUM_VELOCITY = "ui.scrolling.fling_curve_max_velocity";
-    private static final String PREF_FLING_CURVE_NEWTON_ITERATIONS = "ui.scrolling.fling_curve_newton_iterations";
-
-    // This fraction of velocity remains after every animation frame when the velocity is low.
-    private static float FRICTION_SLOW;
-    // This fraction of velocity remains after every animation frame when the velocity is high.
-    private static float FRICTION_FAST;
-    // Below this velocity (in pixels per frame), the friction starts increasing from FRICTION_FAST
-    // to FRICTION_SLOW.
-    private static float VELOCITY_THRESHOLD;
-    // The maximum velocity change factor between events, per ms, in %.
-    // Direction changes are excluded.
-    private static float MAX_EVENT_ACCELERATION;
-
-    // The rate of deceleration when the surface has overscrolled.
-    private static float OVERSCROLL_DECEL_RATE;
-    // The percentage of the surface which can be overscrolled before it must snap back.
-    private static float SNAP_LIMIT;
-
-    // The minimum amount of space that must be present for an axis to be considered scrollable,
-    // in pixels.
-    private static float MIN_SCROLLABLE_DISTANCE;
-
-    // The interval within which if two flings are done then scrolling effect is accelerated.
-    private static long FLING_ACCEL_INTERVAL;
-
-    // The multiplication constant of the base velocity in case of accelerated scrolling.
-    private static float FLING_ACCEL_BASE_MULTIPLIER;
-
-    // The multiplication constant of the supplemental velocity in case of accelerated scrolling.
-    private static float FLING_ACCEL_SUPPLEMENTAL_MULTIPLIER;
-
-    // x co-ordinate of the second bezier control point
-    private static float FLING_CURVE_FUNCTION_X1;
-
-    // y co-ordinate of the second bezier control point
-    private static float FLING_CURVE_FUNCTION_Y1;
-
-    // x co-ordinate of the third bezier control point
-    private static float FLING_CURVE_FUNCTION_X2;
-
-    // y co-ordinate of the third bezier control point
-    private static float FLING_CURVE_FUNCTION_Y2;
-
-    // Minimum velocity for curve to be implemented i.e fling curving
-    private static float FLING_CURVE_THRESHOLD_VELOCITY;
-
-    // Maximum permitted velocity
-    private static float FLING_CURVE_MAXIMUM_VELOCITY;
-
-    // Number of iterations in the Newton-Raphson method
-    private static int FLING_CURVE_NEWTON_ITERATIONS;
-
-    private static float getFloatPref(Map<String, Integer> prefs, String prefName, int defaultValue) {
-        Integer value = (prefs == null ? null : prefs.get(prefName));
-        return (value == null || value < 0 ? defaultValue : value) / 1000f;
-    }
-
-    private static int getIntPref(Map<String, Integer> prefs, String prefName, int defaultValue) {
-        Integer value = (prefs == null ? null : prefs.get(prefName));
-        return (value == null || value < 0 ? defaultValue : value);
-    }
-
-    static void initPrefs() {
-        final String[] prefs = { PREF_SCROLLING_FRICTION_FAST,
-                                 PREF_SCROLLING_FRICTION_SLOW,
-                                 PREF_SCROLLING_MAX_EVENT_ACCELERATION,
-                                 PREF_SCROLLING_OVERSCROLL_DECEL_RATE,
-                                 PREF_SCROLLING_OVERSCROLL_SNAP_LIMIT,
-                                 PREF_SCROLLING_MIN_SCROLLABLE_DISTANCE,
-                                 PREF_FLING_ACCEL_INTERVAL,
-                                 PREF_FLING_ACCEL_BASE_MULTIPLIER,
-                                 PREF_FLING_ACCEL_SUPPLEMENTAL_MULTIPLIER,
-                                 PREF_FLING_CURVE_FUNCTION_X1,
-                                 PREF_FLING_CURVE_FUNCTION_Y1,
-                                 PREF_FLING_CURVE_FUNCTION_X2,
-                                 PREF_FLING_CURVE_FUNCTION_Y2,
-                                 PREF_FLING_CURVE_THRESHOLD_VELOCITY,
-                                 PREF_FLING_CURVE_MAXIMUM_VELOCITY,
-                                 PREF_FLING_CURVE_NEWTON_ITERATIONS };
-
-        PrefsHelper.getPrefs(prefs, new PrefsHelper.PrefHandlerBase() {
-            Map<String, Integer> mPrefs = new HashMap<String, Integer>();
-
-            @Override public void prefValue(String name, int value) {
-                mPrefs.put(name, value);
-            }
-
-            @Override public void finish() {
-                setPrefs(mPrefs);
-            }
-        });
-    }
-
-    static final float MS_PER_FRAME = 1000.0f / 60.0f;
-    static final long NS_PER_FRAME = Math.round(1000000000f / 60f);
-    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 currentNsPerFrame:
-    static float getFrameAdjustedFriction(float baseFriction, long currentNsPerFrame) {
-        float framerateMultiplier = (float)currentNsPerFrame / NS_PER_FRAME;
-        return (float)Math.pow(Math.E, (Math.log(baseFriction) / framerateMultiplier));
-    }
-
-    static void setPrefs(Map<String, Integer> prefs) {
-        FRICTION_SLOW = getFloatPref(prefs, PREF_SCROLLING_FRICTION_SLOW, 850);
-        FRICTION_FAST = 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);
-        OVERSCROLL_DECEL_RATE = 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);
-        FLING_ACCEL_INTERVAL = getIntPref(prefs, PREF_FLING_ACCEL_INTERVAL, 500);
-        FLING_ACCEL_BASE_MULTIPLIER = getFloatPref(prefs, PREF_FLING_ACCEL_BASE_MULTIPLIER, 1000);
-        FLING_ACCEL_SUPPLEMENTAL_MULTIPLIER = getFloatPref(prefs, PREF_FLING_ACCEL_SUPPLEMENTAL_MULTIPLIER, 1000);
-        FLING_CURVE_FUNCTION_X1 = getFloatPref(prefs, PREF_FLING_CURVE_FUNCTION_X1, 410);
-        FLING_CURVE_FUNCTION_Y1 = getFloatPref(prefs, PREF_FLING_CURVE_FUNCTION_Y1, 0);
-        FLING_CURVE_FUNCTION_X2 = getFloatPref(prefs, PREF_FLING_CURVE_FUNCTION_X2, 800);
-        FLING_CURVE_FUNCTION_Y2 = getFloatPref(prefs, PREF_FLING_CURVE_FUNCTION_Y2, 1000);
-        FLING_CURVE_THRESHOLD_VELOCITY = getFloatPref(prefs, PREF_FLING_CURVE_THRESHOLD_VELOCITY, 30);
-        FLING_CURVE_MAXIMUM_VELOCITY = getFloatPref(prefs, PREF_FLING_CURVE_MAXIMUM_VELOCITY, 70);
-        FLING_CURVE_NEWTON_ITERATIONS = getIntPref(prefs, PREF_FLING_CURVE_NEWTON_ITERATIONS, 5);
-
-        Log.i(LOGTAG, "Prefs: " + FRICTION_SLOW + "," + FRICTION_FAST + "," + VELOCITY_THRESHOLD + ","
-                + MAX_EVENT_ACCELERATION + "," + OVERSCROLL_DECEL_RATE + "," + SNAP_LIMIT + "," + MIN_SCROLLABLE_DISTANCE);
-    }
-
-    static {
-        // set the scrolling parameters to default values on startup
-        setPrefs(null);
-    }
-
-    private enum FlingStates {
-        STOPPED,
-        PANNING,
-        FLINGING,
-    }
-
-    private enum Overscroll {
-        NONE,
-        MINUS,      // Overscrolled in the negative direction
-        PLUS,       // Overscrolled in the positive direction
-        BOTH,       // Overscrolled in both directions (page is zoomed to smaller than screen)
-    }
-
-    private final SubdocumentScrollHelper mSubscroller;
-
-    private int mOverscrollMode; /* Default to only overscrolling if we're allowed to scroll in a direction */
-    private float mFirstTouchPos;            /* Position of the first touch event on the current drag. */
-    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 final 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;
-    private long mLastFlingTime;
-    private float mLastFlingVelocity;
-
-    private FlingStates mFlingState = FlingStates.STOPPED; /* The fling state we're in on this axis. */
-
-    protected abstract float getOrigin();
-    protected abstract float getViewportLength();
-    protected abstract float getPageStart();
-    protected abstract float getPageLength();
-    protected abstract float getVisibleEndOfLayerView();
-
-    Axis(SubdocumentScrollHelper subscroller) {
-        mSubscroller = subscroller;
-        mOverscrollMode = View.OVER_SCROLL_IF_CONTENT_SCROLLS;
-        mRecentVelocities = new float[FLING_VELOCITY_POINTS];
-    }
-
-    // Implementors can override these to show effects when the axis overscrolls
-    protected void overscrollFling(float velocity) { }
-    protected void overscrollPan(float displacement) { }
-
-    public void setOverScrollMode(int overscrollMode) {
-        mOverscrollMode = overscrollMode;
-    }
-
-    public int getOverScrollMode() {
-        return mOverscrollMode;
-    }
-
-    private float getViewportEnd() {
-        return getOrigin() + getViewportLength();
-    }
-
-    private float getPageEnd() {
-        return getPageStart() + getPageLength();
-    }
-
-    void startTouch(float pos) {
-        mVelocity = 0.0f;
-        mScrollingDisabled = false;
-        mFirstTouchPos = mTouchPos = mLastTouchPos = pos;
-        mRecentVelocityCount = 0;
-    }
-
-    float panDistance(float currentPos) {
-        return currentPos - mFirstTouchPos;
-    }
-
-    void setScrollingDisabled(boolean disabled) {
-        mScrollingDisabled = disabled;
-    }
-
-    void saveTouchPos() {
-        mLastTouchPos = mTouchPos;
-    }
-
-    // Calculates and return the slope of the curve at given parameter t
-    float getSlope(float t) {
-        float y1 = FLING_CURVE_FUNCTION_Y1;
-        float y2 = FLING_CURVE_FUNCTION_Y2;
-
-        return (3 * y1)
-             + t * (6 * y2 - 12 * y1)
-             + t * t * (9 * y1 - 9 * y2 + 3);
-    }
-
-    // Calculates and returns the value of the bezier curve with the given parameter t and control points p1 and p2
-    float cubicBezier(float p1, float p2, float t) {
-        return (3 * t * (1 - t) * (1 - t) * p1)
-             + (3 * t * t * (1 - t) * p2)
-             + (t * t * t);
-    }
-
-    // Responsible for mapping the physical velocity to a the velocity obtained after applying bezier curve (with control points (X1,Y1) and (X2,Y2))
-    float flingCurve(float By) {
-        int ni = FLING_CURVE_NEWTON_ITERATIONS;
-        float[] guess = new float[ni];
-        float y1 = FLING_CURVE_FUNCTION_Y1;
-        float y2 = FLING_CURVE_FUNCTION_Y2;
-        guess[0] = By;
-
-        for (int i = 1; i < ni; i++) {
-            guess[i] = guess[i - 1] - (cubicBezier(y1, y2, guess[i - 1]) - By) / getSlope(guess[i - 1]);
-        }
-        // guess[4] is the final approximate root the cubic equation.
-        float t = guess[4];
-
-        float x1 = FLING_CURVE_FUNCTION_X1;
-        float x2 = FLING_CURVE_FUNCTION_X2;
-        return cubicBezier(x1, x2, t);
-    }
-
-    void updateWithTouchAt(float pos, float timeDelta) {
-        float curveVelocityThreshold = FLING_CURVE_THRESHOLD_VELOCITY * GeckoAppShell.getDpi() * MS_PER_FRAME;
-        float maxVelocity = FLING_CURVE_MAXIMUM_VELOCITY * GeckoAppShell.getDpi() * MS_PER_FRAME;
-
-        float newVelocity = (mTouchPos - pos) / timeDelta * MS_PER_FRAME;
-
-        if (Math.abs(newVelocity) > curveVelocityThreshold && Math.abs(newVelocity) < maxVelocity) {
-            float sign = Math.signum(newVelocity);
-            newVelocity = newVelocity * sign;
-            float scale = maxVelocity - curveVelocityThreshold;
-            float functInp = (newVelocity - curveVelocityThreshold) / scale;
-            float functOut = flingCurve(functInp);
-            newVelocity = functOut * scale + curveVelocityThreshold;
-            newVelocity = newVelocity * sign;
-        }
-
-        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.
-        boolean curVelocityIsLow = Math.abs(mVelocity) < 1.0f / FRAMERATE_MULTIPLIER;
-        boolean directionChange = (mVelocity > 0) != (newVelocity > 0);
-        if (curVelocityIsLow || (directionChange && !FloatUtils.fuzzyEquals(newVelocity, 0.0f))) {
-            mVelocity = newVelocity;
-        } else {
-            float maxChange = Math.abs(mVelocity * timeDelta * MAX_EVENT_ACCELERATION);
-            mVelocity = Math.min(mVelocity + maxChange, Math.max(mVelocity - maxChange, newVelocity));
-        }
-
-        mTouchPos = pos;
-    }
-
-    boolean overscrolled() {
-        return getOverscroll() != Overscroll.NONE;
-    }
-
-    private Overscroll getOverscroll() {
-        boolean minus = (getOrigin() < getPageStart());
-        boolean plus = (getViewportEnd() > getPageEnd());
-        if (minus && plus) {
-            return Overscroll.BOTH;
-        } else if (minus) {
-            return Overscroll.MINUS;
-        } else if (plus) {
-            return Overscroll.PLUS;
-        } else {
-            return Overscroll.NONE;
-        }
-    }
-
-    // Returns the amount that the page has been overscrolled. If the page hasn't been
-    // overscrolled on this axis, returns 0.
-    private float getExcess() {
-        switch (getOverscroll()) {
-        case MINUS:     return getPageStart() - getOrigin();
-        case PLUS:      return getViewportEnd() - getPageEnd();
-        case BOTH:      return (getViewportEnd() - getPageEnd()) + (getPageStart() - getOrigin());
-        default:        return 0.0f;
-        }
-    }
-
-    /*
-     * Returns true if the page is zoomed in to some degree along this axis such that scrolling is
-     * possible and this axis has not been scroll locked while panning. Otherwise, returns false.
-     */
-    boolean scrollable() {
-        // If we're scrolling a subdocument, ignore the viewport length restrictions (since those
-        // apply to the top-level document) and only take into account axis locking.
-        if (mSubscroller.scrolling()) {
-            return !mScrollingDisabled;
-        }
-
-        // if we are axis locked, return false
-        if (mScrollingDisabled) {
-            return false;
-        }
-
-        // there is scrollable space, and we're not disabled, or the document fits the viewport
-        // but we always allow overscroll anyway
-        return getViewportLength() <= getPageLength() - MIN_SCROLLABLE_DISTANCE ||
-               getOverScrollMode() == View.OVER_SCROLL_ALWAYS;
-    }
-
-    /*
-     * Returns the resistance, as a multiplier, that should be taken into account when
-     * tracking or pinching.
-     */
-    float getEdgeResistance(boolean forPinching) {
-        float excess = getExcess();
-        if (excess > 0.0f && (getOverscroll() == Overscroll.BOTH || !forPinching)) {
-            // excess can be greater than viewport length, but the resistance
-            // must never drop below 0.0
-            return Math.max(0.0f, SNAP_LIMIT - excess / getViewportLength());
-        }
-        return 1.0f;
-    }
-
-    /* Returns the velocity. If the axis is locked, returns 0. */
-    float getRealVelocity() {
-        return scrollable() ? mVelocity : 0f;
-    }
-
-    void startPan() {
-        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;
-    }
-
-    float accelerate(float velocity, float lastFlingVelocity) {
-        return (FLING_ACCEL_BASE_MULTIPLIER * velocity + FLING_ACCEL_SUPPLEMENTAL_MULTIPLIER * lastFlingVelocity);
-    }
-
-    void startFling(boolean stopped) {
-        mDisableSnap = mSubscroller.scrolling();
-
-        if (stopped) {
-            mFlingState = FlingStates.STOPPED;
-        } else {
-            long now = SystemClock.uptimeMillis();
-            mVelocity = calculateFlingVelocity();
-
-            if ((now - mLastFlingTime < FLING_ACCEL_INTERVAL) && Math.signum(mVelocity) == Math.signum(mLastFlingVelocity)) {
-                mVelocity = accelerate(mVelocity, mLastFlingVelocity);
-            }
-            mFlingState = FlingStates.FLINGING;
-            mLastFlingVelocity = mVelocity;
-            mLastFlingTime = now;
-        }
-    }
-
-    /* Advances a fling animation by one step. */
-    boolean advanceFling(long realNsPerFrame) {
-        if (mFlingState != FlingStates.FLINGING) {
-            return false;
-        }
-        if (mSubscroller.scrolling() && !mSubscroller.lastScrollSucceeded()) {
-            // if the subdocument stopped scrolling, it's because it reached the end
-            // of the subdocument. we don't do overscroll on subdocuments, so there's
-            // no point in continuing this fling.
-            return false;
-        }
-
-        float excess = getExcess();
-        Overscroll overscroll = getOverscroll();
-        boolean decreasingOverscroll = false;
-        if ((overscroll == Overscroll.MINUS && mVelocity > 0) ||
-            (overscroll == Overscroll.PLUS && mVelocity < 0))
-        {
-            decreasingOverscroll = true;
-        }
-
-        if (mDisableSnap || FloatUtils.fuzzyEquals(excess, 0.0f) || decreasingOverscroll) {
-            // If we aren't overscrolled, just apply friction.
-            if (Math.abs(mVelocity) >= VELOCITY_THRESHOLD) {
-                mVelocity *= getFrameAdjustedFriction(FRICTION_FAST, realNsPerFrame);
-            } else {
-                float t = mVelocity / VELOCITY_THRESHOLD;
-                mVelocity *= FloatUtils.interpolate(getFrameAdjustedFriction(FRICTION_SLOW, realNsPerFrame),
-                                                    getFrameAdjustedFriction(FRICTION_FAST, realNsPerFrame), t);
-            }
-        } else {
-            // Otherwise, decrease the velocity linearly.
-            float elasticity = 1.0f - excess / (getViewportLength() * SNAP_LIMIT);
-            float overscrollDecelRate = getFrameAdjustedFriction(OVERSCROLL_DECEL_RATE, realNsPerFrame);
-            if (overscroll == Overscroll.MINUS) {
-                mVelocity = Math.min((mVelocity + overscrollDecelRate) * elasticity, 0.0f);
-            } else { // must be Overscroll.PLUS
-                mVelocity = Math.max((mVelocity - overscrollDecelRate) * elasticity, 0.0f);
-            }
-        }
-
-        return true;
-    }
-
-    void stopFling() {
-        mVelocity = 0.0f;
-        mFlingState = FlingStates.STOPPED;
-    }
-
-    // Performs displacement of the viewport position according to the current velocity.
-    void displace() {
-        // if this isn't scrollable just return
-        if (!scrollable())
-            return;
-
-        if (mFlingState == FlingStates.PANNING)
-            mDisplacement += (mLastTouchPos - mTouchPos) * getEdgeResistance(false);
-        else
-            mDisplacement += mVelocity * getEdgeResistance(false);
-
-        // if overscroll is disabled and we're trying to overscroll, reset the displacement
-        // to remove any excess. Using getExcess alone isn't enough here since it relies on
-        // getOverscroll which doesn't take into account any new displacment being applied.
-        // If we using a subscroller, we don't want to alter the scrolling being done
-        if (getOverScrollMode() == View.OVER_SCROLL_NEVER && !mSubscroller.scrolling()) {
-            float originalDisplacement = mDisplacement;
-
-            if (mDisplacement + getOrigin() < getPageStart()) {
-                mDisplacement = getPageStart() - getOrigin();
-            } else if (mDisplacement + getOrigin() + getVisibleEndOfLayerView() > getPageEnd()) {
-                mDisplacement = getPageEnd() - getOrigin() - getVisibleEndOfLayerView();
-            }
-
-            // Return the amount of overscroll so that the overscroll controller can draw it for us
-            if (originalDisplacement != mDisplacement) {
-                if (mFlingState == FlingStates.FLINGING) {
-                    overscrollFling(mVelocity / MS_PER_FRAME * 1000);
-                    stopFling();
-                } else if (mFlingState == FlingStates.PANNING) {
-                    overscrollPan(originalDisplacement - mDisplacement);
-                }
-            }
-        }
-    }
-
-    float resetDisplacement() {
-        float d = mDisplacement;
-        mDisplacement = 0.0f;
-        return d;
-    }
-
-    void setAutoscrollVelocity(float velocity) {
-        if (mFlingState != FlingStates.STOPPED) {
-            Log.e(LOGTAG, "Setting autoscroll velocity while in a fling is not allowed!");
-            return;
-        }
-        mVelocity = velocity;
-    }
-}
deleted file mode 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/DisplayPortCalculator.java
+++ /dev/null
@@ -1,771 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.gfx;
-
-import org.mozilla.gecko.GeckoAppShell;
-import org.mozilla.gecko.PrefsHelper;
-import org.mozilla.gecko.util.FloatUtils;
-
-import org.json.JSONArray;
-
-import android.graphics.PointF;
-import android.graphics.RectF;
-import android.util.Log;
-
-import java.util.HashMap;
-import java.util.Map;
-
-final class DisplayPortCalculator {
-    private static final String LOGTAG = "GeckoDisplayPort";
-    private static final PointF ZERO_VELOCITY = new PointF(0, 0);
-
-    private static final String PREF_DISPLAYPORT_STRATEGY = "gfx.displayport.strategy";
-    private static final String PREF_DISPLAYPORT_FM_MULTIPLIER = "gfx.displayport.strategy_fm.multiplier";
-    private static final String PREF_DISPLAYPORT_FM_DANGER_X = "gfx.displayport.strategy_fm.danger_x";
-    private static final String PREF_DISPLAYPORT_FM_DANGER_Y = "gfx.displayport.strategy_fm.danger_y";
-    private static final String PREF_DISPLAYPORT_VB_MULTIPLIER = "gfx.displayport.strategy_vb.multiplier";
-    private static final String PREF_DISPLAYPORT_VB_VELOCITY_THRESHOLD = "gfx.displayport.strategy_vb.threshold";
-    private static final String PREF_DISPLAYPORT_VB_REVERSE_BUFFER = "gfx.displayport.strategy_vb.reverse_buffer";
-    private static final String PREF_DISPLAYPORT_VB_DANGER_X_BASE = "gfx.displayport.strategy_vb.danger_x_base";
-    private static final String PREF_DISPLAYPORT_VB_DANGER_Y_BASE = "gfx.displayport.strategy_vb.danger_y_base";
-    private static final String PREF_DISPLAYPORT_VB_DANGER_X_INCR = "gfx.displayport.strategy_vb.danger_x_incr";
-    private static final String PREF_DISPLAYPORT_VB_DANGER_Y_INCR = "gfx.displayport.strategy_vb.danger_y_incr";
-    private static final String PREF_DISPLAYPORT_PB_VELOCITY_THRESHOLD = "gfx.displayport.strategy_pb.threshold";
-
-    private static DisplayPortStrategy sStrategy = new VelocityBiasStrategy(null);
-
-    static DisplayPortMetrics calculate(ImmutableViewportMetrics metrics, PointF velocity) {
-        return sStrategy.calculate(metrics, (velocity == null ? ZERO_VELOCITY : velocity));
-    }
-
-    static boolean aboutToCheckerboard(ImmutableViewportMetrics metrics, PointF velocity, DisplayPortMetrics displayPort) {
-        if (displayPort == null) {
-            return true;
-        }
-        return sStrategy.aboutToCheckerboard(metrics, (velocity == null ? ZERO_VELOCITY : velocity), displayPort);
-    }
-
-    static boolean drawTimeUpdate(long millis, int pixels) {
-        return sStrategy.drawTimeUpdate(millis, pixels);
-    }
-
-    static void resetPageState() {
-        sStrategy.resetPageState();
-    }
-
-    static void initPrefs() {
-        final String[] prefs = { PREF_DISPLAYPORT_STRATEGY,
-                                 PREF_DISPLAYPORT_FM_MULTIPLIER,
-                                 PREF_DISPLAYPORT_FM_DANGER_X,
-                                 PREF_DISPLAYPORT_FM_DANGER_Y,
-                                 PREF_DISPLAYPORT_VB_MULTIPLIER,
-                                 PREF_DISPLAYPORT_VB_VELOCITY_THRESHOLD,
-                                 PREF_DISPLAYPORT_VB_REVERSE_BUFFER,
-                                 PREF_DISPLAYPORT_VB_DANGER_X_BASE,
-                                 PREF_DISPLAYPORT_VB_DANGER_Y_BASE,
-                                 PREF_DISPLAYPORT_VB_DANGER_X_INCR,
-                                 PREF_DISPLAYPORT_VB_DANGER_Y_INCR,
-                                 PREF_DISPLAYPORT_PB_VELOCITY_THRESHOLD };
-
-        PrefsHelper.getPrefs(prefs, new PrefsHelper.PrefHandlerBase() {
-            private final Map<String, Integer> mValues = new HashMap<String, Integer>();
-
-            @Override public void prefValue(String pref, int value) {
-                mValues.put(pref, value);
-            }
-
-            @Override public void finish() {
-                setStrategy(mValues);
-            }
-        });
-    }
-
-    /**
-     * Set the active strategy to use.
-     * See the gfx.displayport.strategy pref in mobile/android/app/mobile.js to see the
-     * mapping between ints and strategies.
-     */
-    static boolean setStrategy(Map<String, Integer> prefs) {
-        Integer strategy = prefs.get(PREF_DISPLAYPORT_STRATEGY);
-        if (strategy == null) {
-            return false;
-        }
-
-        switch (strategy) {
-            case 0:
-                sStrategy = new FixedMarginStrategy(prefs);
-                break;
-            case 1:
-                sStrategy = new VelocityBiasStrategy(prefs);
-                break;
-            case 2:
-                sStrategy = new DynamicResolutionStrategy(prefs);
-                break;
-            case 3:
-                sStrategy = new NoMarginStrategy(prefs);
-                break;
-            case 4:
-                sStrategy = new PredictionBiasStrategy(prefs);
-                break;
-            default:
-                Log.e(LOGTAG, "Invalid strategy index specified");
-                return false;
-        }
-        Log.i(LOGTAG, "Set strategy " + sStrategy.toString());
-        return true;
-    }
-
-    private static float getFloatPref(Map<String, Integer> prefs, String prefName, int defaultValue) {
-        Integer value = (prefs == null ? null : prefs.get(prefName));
-        return (value == null || value < 0 ? defaultValue : value) / 1000f;
-    }
-
-    private static abstract class DisplayPortStrategy {
-        /** Calculates a displayport given a viewport and panning velocity. */
-        public abstract DisplayPortMetrics calculate(ImmutableViewportMetrics metrics, PointF velocity);
-        /** Returns true if a checkerboard is about to be visible and we should not throttle drawing. */
-        public abstract boolean aboutToCheckerboard(ImmutableViewportMetrics metrics, PointF velocity, DisplayPortMetrics displayPort);
-        /** Notify the strategy of a new recorded draw time. Return false to turn off draw time recording. */
-        public boolean drawTimeUpdate(long millis, int pixels) { return false; }
-        /** Reset any page-specific state stored, as the page being displayed has changed. */
-        public void resetPageState() {}
-    }
-
-    /**
-     * Return the dimensions for a rect that has area (width*height) that does not exceed the page size in the
-     * given metrics object. The area in the returned FloatSize may be less than width*height if the page is
-     * small, but it will never be larger than width*height.
-     * Note that this process may change the relative aspect ratio of the given dimensions.
-     */
-    private static FloatSize reshapeForPage(float width, float height, ImmutableViewportMetrics metrics) {
-        // figure out how much of the desired buffer amount we can actually use on the horizontal axis
-        float usableWidth = Math.min(width, metrics.getPageWidth());
-        // if we reduced the buffer amount on the horizontal axis, we should take that saved memory and
-        // use it on the vertical axis
-        float extraUsableHeight = (float)Math.floor(((width - usableWidth) * height) / usableWidth);
-        float usableHeight = Math.min(height + extraUsableHeight, metrics.getPageHeight());
-        if (usableHeight < height && usableWidth == width) {
-            // and the reverse - if we shrunk the buffer on the vertical axis we can add it to the horizontal
-            float extraUsableWidth = (float)Math.floor(((height - usableHeight) * width) / usableHeight);
-            usableWidth = Math.min(width + extraUsableWidth, metrics.getPageWidth());
-        }
-        return new FloatSize(usableWidth, usableHeight);
-    }
-
-    /**
-     * Expand the given rect in all directions by a "danger zone". The size of the danger zone on an axis
-     * is the size of the view on that axis multiplied by the given multiplier. The expanded rect is then
-     * clamped to page bounds and returned.
-     */
-    private static RectF expandByDangerZone(RectF rect, float dangerZoneXMultiplier, float dangerZoneYMultiplier, ImmutableViewportMetrics metrics) {
-        // calculate the danger zone amounts in pixels
-        float dangerZoneX = metrics.getWidth() * dangerZoneXMultiplier;
-        float dangerZoneY = metrics.getHeight() * dangerZoneYMultiplier;
-        rect = RectUtils.expand(rect, dangerZoneX, dangerZoneY);
-        // clamp to page bounds
-        return clampToPageBounds(rect, metrics);
-    }
-
-    /**
-     * Calculate the display port by expanding the viewport by the specified
-     * margins, then clamping to the page size.
-     */
-    private static DisplayPortMetrics getPageClampedDisplayPortMetrics(RectF margins, float zoom, ImmutableViewportMetrics metrics) {
-        float left = metrics.viewportRectLeft - margins.left;
-        float top = metrics.viewportRectTop - margins.top;
-        float right = metrics.viewportRectRight() + margins.right;
-        float bottom = metrics.viewportRectBottom() + margins.bottom;
-        left = Math.max(metrics.pageRectLeft, left);
-        top = Math.max(metrics.pageRectTop, top);
-        right = Math.min(metrics.pageRectRight, right);
-        bottom = Math.min(metrics.pageRectBottom, bottom);
-
-        return new DisplayPortMetrics(left, top, right, bottom, zoom);
-    }
-
-    /**
-     * Adjust the given margins so if they are applied on the viewport in the metrics, the resulting rect
-     * does not exceed the page bounds. This code will maintain the total margin amount for a given axis;
-     * it assumes that margins.left + metrics.getWidth() + margins.right is less than or equal to
-     * metrics.getPageWidth(); and the same for the y axis.
-     */
-    private static RectF shiftMarginsForPageBounds(RectF margins, ImmutableViewportMetrics metrics) {
-        // check how much we're overflowing in each direction. note that at most one of leftOverflow
-        // and rightOverflow can be greater than zero, and at most one of topOverflow and bottomOverflow
-        // can be greater than zero, because of the assumption described in the method javadoc.
-        float leftOverflow = metrics.pageRectLeft - (metrics.viewportRectLeft - margins.left);
-        float rightOverflow = (metrics.viewportRectRight() + margins.right) - metrics.pageRectRight;
-        float topOverflow = metrics.pageRectTop - (metrics.viewportRectTop - margins.top);
-        float bottomOverflow = (metrics.viewportRectBottom() + margins.bottom) - metrics.pageRectBottom;
-
-        // if the margins overflow the page bounds, shift them to other side on the same axis
-        if (leftOverflow > 0) {
-            margins.left -= leftOverflow;
-            margins.right += leftOverflow;
-        } else if (rightOverflow > 0) {
-            margins.right -= rightOverflow;
-            margins.left += rightOverflow;
-        }
-        if (topOverflow > 0) {
-            margins.top -= topOverflow;
-            margins.bottom += topOverflow;
-        } else if (bottomOverflow > 0) {
-            margins.bottom -= bottomOverflow;
-            margins.top += bottomOverflow;
-        }
-        return margins;
-    }
-
-    /**
-     * Clamp the given rect to the page bounds and return it.
-     */
-    private static RectF clampToPageBounds(RectF rect, ImmutableViewportMetrics metrics) {
-        if (rect.top < metrics.pageRectTop) rect.top = metrics.pageRectTop;
-        if (rect.left < metrics.pageRectLeft) rect.left = metrics.pageRectLeft;
-        if (rect.right > metrics.pageRectRight) rect.right = metrics.pageRectRight;
-        if (rect.bottom > metrics.pageRectBottom) rect.bottom = metrics.pageRectBottom;
-        return rect;
-    }
-
-    /**
-     * This class implements the variation where we basically don't bother with a a display port.
-     */
-    private static class NoMarginStrategy extends DisplayPortStrategy {
-        NoMarginStrategy(Map<String, Integer> prefs) {
-            // no prefs in this strategy
-        }
-
-        @Override
-        public DisplayPortMetrics calculate(ImmutableViewportMetrics metrics, PointF velocity) {
-            return new DisplayPortMetrics(metrics.viewportRectLeft,
-                    metrics.viewportRectTop,
-                    metrics.viewportRectRight(),
-                    metrics.viewportRectBottom(),
-                    metrics.zoomFactor);
-        }
-
-        @Override
-        public boolean aboutToCheckerboard(ImmutableViewportMetrics metrics, PointF velocity, DisplayPortMetrics displayPort) {
-            return true;
-        }
-
-        @Override
-        public String toString() {
-            return "NoMarginStrategy";
-        }
-    }
-
-    /**
-     * This class implements the variation where we use a fixed-size margin on the display port.
-     * The margin is always 300 pixels in all directions, except when we are (a) approaching a page
-     * boundary, and/or (b) if we are limited by the page size. In these cases we try to maintain
-     * the area of the display port by (a) shifting the buffer to the other side on the same axis,
-     * and/or (b) increasing the buffer on the other axis to compensate for the reduced buffer on
-     * one axis.
-     */
-    private static class FixedMarginStrategy extends DisplayPortStrategy {
-        // The length of each axis of the display port will be the corresponding view length
-        // multiplied by this factor.
-        private final float SIZE_MULTIPLIER;
-
-        // If the visible rect is within the danger zone (measured as a fraction of the view size
-        // from the edge of the displayport) we start redrawing to minimize checkerboarding.
-        private final float DANGER_ZONE_X_MULTIPLIER;
-        private final float DANGER_ZONE_Y_MULTIPLIER;
-
-        FixedMarginStrategy(Map<String, Integer> prefs) {
-            SIZE_MULTIPLIER = getFloatPref(prefs, PREF_DISPLAYPORT_FM_MULTIPLIER, 2000);
-            DANGER_ZONE_X_MULTIPLIER = getFloatPref(prefs, PREF_DISPLAYPORT_FM_DANGER_X, 100);
-            DANGER_ZONE_Y_MULTIPLIER = getFloatPref(prefs, PREF_DISPLAYPORT_FM_DANGER_Y, 200);
-        }
-
-        @Override
-        public DisplayPortMetrics calculate(ImmutableViewportMetrics metrics, PointF velocity) {
-            float displayPortWidth = metrics.getWidth() * SIZE_MULTIPLIER;
-            float displayPortHeight = metrics.getHeight() * SIZE_MULTIPLIER;
-
-            // we need to avoid having a display port that is larger than the page, or we will end up
-            // painting things outside the page bounds (bug 729169). we simultaneously need to make
-            // the display port as large as possible so that we redraw less. reshape the display
-            // port dimensions to accomplish this.
-            FloatSize usableSize = reshapeForPage(displayPortWidth, displayPortHeight, metrics);
-            float horizontalBuffer = usableSize.width - metrics.getWidth();
-            float verticalBuffer = usableSize.height - metrics.getHeight();
-
-            // and now calculate the display port margins based on how much buffer we've decided to use and
-            // the page bounds, ensuring we use all of the available buffer amounts on one side or the other
-            // on any given axis. (i.e. if we're scrolled to the top of the page, the vertical buffer is
-            // entirely below the visible viewport, but if we're halfway down the page, the vertical buffer
-            // is split).
-            RectF margins = new RectF();
-            margins.left = horizontalBuffer / 2.0f;
-            margins.right = horizontalBuffer - margins.left;
-            margins.top = verticalBuffer / 2.0f;
-            margins.bottom = verticalBuffer - margins.top;
-            margins = shiftMarginsForPageBounds(margins, metrics);
-
-            return getPageClampedDisplayPortMetrics(margins, metrics.zoomFactor, metrics);
-        }
-
-        @Override
-        public boolean aboutToCheckerboard(ImmutableViewportMetrics metrics, PointF velocity, DisplayPortMetrics displayPort) {
-            // Increase the size of the viewport based on the danger zone multiplier (and clamp to page
-            // boundaries), and intersect it with the current displayport to determine whether we're
-            // close to checkerboarding.
-            RectF adjustedViewport = expandByDangerZone(metrics.getViewport(), DANGER_ZONE_X_MULTIPLIER, DANGER_ZONE_Y_MULTIPLIER, metrics);
-            return !displayPort.contains(adjustedViewport);
-        }
-
-        @Override
-        public String toString() {
-            return "FixedMarginStrategy mult=" + SIZE_MULTIPLIER + ", dangerX=" + DANGER_ZONE_X_MULTIPLIER + ", dangerY=" + DANGER_ZONE_Y_MULTIPLIER;
-        }
-    }
-
-    /**
-     * This class implements the variation with a small fixed-size margin with velocity bias.
-     * In this variation, the default margins are pretty small relative to the view size, but
-     * they are affected by the panning velocity. Specifically, if we are panning on one axis,
-     * we remove the margins on the other axis because we are likely axis-locked. Also once
-     * we are panning in one direction above a certain threshold velocity, we shift the buffer
-     * so that it is almost entirely in the direction of the pan, with a little bit in the
-     * reverse direction.
-     */
-    private static class VelocityBiasStrategy extends DisplayPortStrategy {
-        // The length of each axis of the display port will be the corresponding view length
-        // multiplied by this factor.
-        private final float SIZE_MULTIPLIER;
-        // The velocity above which we apply the velocity bias
-        private final float VELOCITY_THRESHOLD;
-        // How much of the buffer to keep in the reverse direction of the velocity
-        private final float REVERSE_BUFFER;
-        // If the visible rect is within the danger zone we start redrawing to minimize
-        // checkerboarding. the danger zone amount is a linear function of the form:
-        //    viewportsize * (base + velocity * incr)
-        // where base and incr are configurable values.
-        private final float DANGER_ZONE_BASE_X_MULTIPLIER;
-        private final float DANGER_ZONE_BASE_Y_MULTIPLIER;
-        private final float DANGER_ZONE_INCR_X_MULTIPLIER;
-        private final float DANGER_ZONE_INCR_Y_MULTIPLIER;
-
-        VelocityBiasStrategy(Map<String, Integer> prefs) {
-            SIZE_MULTIPLIER = getFloatPref(prefs, PREF_DISPLAYPORT_VB_MULTIPLIER, 2000);
-            VELOCITY_THRESHOLD = GeckoAppShell.getDpi() * getFloatPref(prefs, PREF_DISPLAYPORT_VB_VELOCITY_THRESHOLD, 32);
-            REVERSE_BUFFER = getFloatPref(prefs, PREF_DISPLAYPORT_VB_REVERSE_BUFFER, 200);
-            DANGER_ZONE_BASE_X_MULTIPLIER = getFloatPref(prefs, PREF_DISPLAYPORT_VB_DANGER_X_BASE, 1000);
-            DANGER_ZONE_BASE_Y_MULTIPLIER = getFloatPref(prefs, PREF_DISPLAYPORT_VB_DANGER_Y_BASE, 1000);
-            DANGER_ZONE_INCR_X_MULTIPLIER = getFloatPref(prefs, PREF_DISPLAYPORT_VB_DANGER_X_INCR, 0);
-            DANGER_ZONE_INCR_Y_MULTIPLIER = getFloatPref(prefs, PREF_DISPLAYPORT_VB_DANGER_Y_INCR, 0);
-        }
-
-        /**
-         * Split the given amounts into margins based on the VELOCITY_THRESHOLD and REVERSE_BUFFER values.
-         * If the velocity is above the VELOCITY_THRESHOLD on an axis, split the amount into REVERSE_BUFFER
-         * and 1.0 - REVERSE_BUFFER fractions. The REVERSE_BUFFER fraction is set as the margin in the
-         * direction opposite to the velocity, and the remaining fraction is set as the margin in the direction
-         * of the velocity. If the velocity is lower than VELOCITY_THRESHOLD, split the amount evenly into the
-         * two margins on that axis.
-         */
-        private RectF velocityBiasedMargins(float xAmount, float yAmount, PointF velocity) {
-            RectF margins = new RectF();
-
-            if (velocity.x > VELOCITY_THRESHOLD) {
-                margins.left = xAmount * REVERSE_BUFFER;
-            } else if (velocity.x < -VELOCITY_THRESHOLD) {
-                margins.left = xAmount * (1.0f - REVERSE_BUFFER);
-            } else {
-                margins.left = xAmount / 2.0f;
-            }
-            margins.right = xAmount - margins.left;
-
-            if (velocity.y > VELOCITY_THRESHOLD) {
-                margins.top = yAmount * REVERSE_BUFFER;
-            } else if (velocity.y < -VELOCITY_THRESHOLD) {
-                margins.top = yAmount * (1.0f - REVERSE_BUFFER);
-            } else {
-                margins.top = yAmount / 2.0f;
-            }
-            margins.bottom = yAmount - margins.top;
-
-            return margins;
-        }
-
-        @Override
-        public DisplayPortMetrics calculate(ImmutableViewportMetrics metrics, PointF velocity) {
-            float displayPortWidth = metrics.getWidth() * SIZE_MULTIPLIER;
-            float displayPortHeight = metrics.getHeight() * SIZE_MULTIPLIER;
-
-            // but if we're panning on one axis, set the margins for the other axis to zero since we are likely
-            // axis locked and won't be displaying that extra area.
-            if (Math.abs(velocity.x) > VELOCITY_THRESHOLD && FloatUtils.fuzzyEquals(velocity.y, 0)) {
-                displayPortHeight = metrics.getHeight();
-            } else if (Math.abs(velocity.y) > VELOCITY_THRESHOLD && FloatUtils.fuzzyEquals(velocity.x, 0)) {
-                displayPortWidth = metrics.getWidth();
-            }
-
-            // we need to avoid having a display port that is larger than the page, or we will end up
-            // painting things outside the page bounds (bug 729169).
-            displayPortWidth = Math.min(displayPortWidth, metrics.getPageWidth());
-            displayPortHeight = Math.min(displayPortHeight, metrics.getPageHeight());
-            float horizontalBuffer = displayPortWidth - metrics.getWidth();
-            float verticalBuffer = displayPortHeight - metrics.getHeight();
-
-            // split the buffer amounts into margins based on velocity, and shift it to
-            // take into account the page bounds
-            RectF margins = velocityBiasedMargins(horizontalBuffer, verticalBuffer, velocity);
-            margins = shiftMarginsForPageBounds(margins, metrics);
-
-            return getPageClampedDisplayPortMetrics(margins, metrics.zoomFactor, metrics);
-        }
-
-        @Override
-        public boolean aboutToCheckerboard(ImmutableViewportMetrics metrics, PointF velocity, DisplayPortMetrics displayPort) {
-            // calculate the danger zone amounts based on the prefs
-            float dangerZoneX = metrics.getWidth() * (DANGER_ZONE_BASE_X_MULTIPLIER + (velocity.x * DANGER_ZONE_INCR_X_MULTIPLIER));
-            float dangerZoneY = metrics.getHeight() * (DANGER_ZONE_BASE_Y_MULTIPLIER + (velocity.y * DANGER_ZONE_INCR_Y_MULTIPLIER));
-            // clamp it such that when added to the viewport, they don't exceed page size.
-            // this is a prerequisite to calling shiftMarginsForPageBounds as we do below.
-            dangerZoneX = Math.min(dangerZoneX, metrics.getPageWidth() - metrics.getWidth());
-            dangerZoneY = Math.min(dangerZoneY, metrics.getPageHeight() - metrics.getHeight());
-
-            // split the danger zone into margins based on velocity, and ensure it doesn't exceed
-            // page bounds.
-            RectF dangerMargins = velocityBiasedMargins(dangerZoneX, dangerZoneY, velocity);
-            dangerMargins = shiftMarginsForPageBounds(dangerMargins, metrics);
-
-            // we're about to checkerboard if the current viewport area + the danger zone margins
-            // fall out of the current displayport anywhere.
-            RectF adjustedViewport = new RectF(
-                    metrics.viewportRectLeft - dangerMargins.left,
-                    metrics.viewportRectTop - dangerMargins.top,
-                    metrics.viewportRectRight() + dangerMargins.right,
-                    metrics.viewportRectBottom() + dangerMargins.bottom);
-            return !displayPort.contains(adjustedViewport);
-        }
-
-        @Override
-        public String toString() {
-            return "VelocityBiasStrategy mult=" + SIZE_MULTIPLIER + ", threshold=" + VELOCITY_THRESHOLD + ", reverse=" + REVERSE_BUFFER
-                + ", dangerBaseX=" + DANGER_ZONE_BASE_X_MULTIPLIER + ", dangerBaseY=" + DANGER_ZONE_BASE_Y_MULTIPLIER
-                + ", dangerIncrX=" + DANGER_ZONE_INCR_Y_MULTIPLIER + ", dangerIncrY=" + DANGER_ZONE_INCR_Y_MULTIPLIER;
-        }
-    }
-
-    /**
-     * This class implements the variation where we draw more of the page at low resolution while panning.
-     * In this variation, as we pan faster, we increase the page area we are drawing, but reduce the draw
-     * resolution to compensate. This results in the same device-pixel area drawn; the compositor then
-     * scales this up to the viewport zoom level. This results in a large area of the page drawn but it
-     * looks blurry. The assumption is that drawing extra that we never display is better than checkerboarding,
-     * where we draw less but never even show it on the screen.
-     */
-    private static class DynamicResolutionStrategy extends DisplayPortStrategy {
-        // The length of each axis of the display port will be the corresponding view length
-        // multiplied by this factor.
-        private static final float SIZE_MULTIPLIER = 1.5f;
-
-        // The velocity above which we start zooming out the display port to keep up
-        // with the panning.
-        private static final float VELOCITY_EXPANSION_THRESHOLD = GeckoAppShell.getDpi() / 16f;
-
-        // How much we increase the display port based on velocity. Assuming no friction and
-        // splitting (see below), this should be be the number of frames (@60fps) between us
-        // calculating the display port and the draw of the *next* display port getting composited
-        // and displayed on the screen. This is because the timeline looks like this:
-        //      Java: pan pan pan pan pan pan ! pan pan pan pan pan pan !
-        //     Gecko:   \-> draw -> composite /   \-> draw -> composite /
-        // The display port calculated on the first "pan" gets composited to the screen at the
-        // first exclamation mark, and remains on the screen until the second exclamation mark.
-        // In order to avoid checkerboarding, that display port must be able to contain all of
-        // the panning until the second exclamation mark, which encompasses two entire draw/composite
-        // cycles.
-        // If we take into account friction, our velocity multiplier should be reduced as the
-        // amount of pan will decrease each time. If we take into account display port splitting,
-        // it should be increased as the splitting means some of the display port will be used to
-        // draw in the opposite direction of the velocity. For now I'm assuming these two cancel
-        // each other out.
-        private static final float VELOCITY_MULTIPLIER = 60.0f;
-
-        // The following constants adjust how biased the display port is in the direction of panning.
-        // When panning fast (above the FAST_THRESHOLD) we use the fast split factor to split the
-        // display port "buffer" area, otherwise we use the slow split factor. This is based on the
-        // assumption that if the user is panning fast, they are less likely to reverse directions
-        // and go backwards, so we should spend more of our display port buffer in the direction of
-        // panning.
-        private static final float VELOCITY_FAST_THRESHOLD = VELOCITY_EXPANSION_THRESHOLD * 2.0f;
-        private static final float FAST_SPLIT_FACTOR = 0.95f;
-        private static final float SLOW_SPLIT_FACTOR = 0.8f;
-
-        // The following constants are used for viewport prediction; we use them to estimate where
-        // the viewport will be soon and whether or not we should trigger a draw right now. "soon"
-        // in the previous sentence really refers to the amount of time it would take to draw and
-        // composite from the point at which we do the calculation, and that is not really a known
-        // quantity. The velocity multiplier is how much we multiply the velocity by; it has the
-        // same caveats as the VELOCITY_MULTIPLIER above except that it only needs to take into account
-        // one draw/composite cycle instead of two. The danger zone multiplier is a multiplier of the
-        // viewport size that we use as an extra "danger zone" around the viewport; if this danger
-        // zone falls outside the display port then we are approaching the point at which we will
-        // checkerboard, and hence should start drawing. Note that if DANGER_ZONE_MULTIPLIER is
-        // greater than (SIZE_MULTIPLIER - 1.0f), then at zero velocity we will always be in the
-        // danger zone, and thus will be constantly drawing.
-        private static final float PREDICTION_VELOCITY_MULTIPLIER = 30.0f;
-        private static final float DANGER_ZONE_MULTIPLIER = 0.20f; // must be less than (SIZE_MULTIPLIER - 1.0f)
-
-        DynamicResolutionStrategy(Map<String, Integer> prefs) {
-            // ignore prefs for now
-        }
-
-        @Override
-        public DisplayPortMetrics calculate(ImmutableViewportMetrics metrics, PointF velocity) {
-            float displayPortWidth = metrics.getWidth() * SIZE_MULTIPLIER;
-            float displayPortHeight = metrics.getHeight() * SIZE_MULTIPLIER;
-
-            // for resolution calculation purposes, we need to know what the adjusted display port dimensions
-            // would be if we had zero velocity, so calculate that here before we increase the display port
-            // based on velocity.
-            FloatSize reshapedSize = reshapeForPage(displayPortWidth, displayPortHeight, metrics);
-
-            // increase displayPortWidth and displayPortHeight based on the velocity, but maintaining their
-            // relative aspect ratio.
-            if (velocity.length() > VELOCITY_EXPANSION_THRESHOLD) {
-                float velocityFactor = Math.max(Math.abs(velocity.x) / displayPortWidth,
-                                                Math.abs(velocity.y) / displayPortHeight);
-                velocityFactor *= VELOCITY_MULTIPLIER;
-
-                displayPortWidth += (displayPortWidth * velocityFactor);
-                displayPortHeight += (displayPortHeight * velocityFactor);
-            }
-
-            // at this point, displayPortWidth and displayPortHeight are how much of the page (in device pixels)
-            // we want to be rendered by Gecko. Note here "device pixels" is equivalent to CSS pixels multiplied
-            // by metrics.zoomFactor
-
-            // we need to avoid having a display port that is larger than the page, or we will end up
-            // painting things outside the page bounds (bug 729169). we simultaneously need to make
-            // the display port as large as possible so that we redraw less. reshape the display
-            // port dimensions to accomplish this. this may change the aspect ratio of the display port,
-            // but we are assuming that this is desirable because the advantages from pre-drawing will
-            // outweigh the disadvantages from any buffer reallocations that might occur.
-            FloatSize usableSize = reshapeForPage(displayPortWidth, displayPortHeight, metrics);
-            float horizontalBuffer = usableSize.width - metrics.getWidth();
-            float verticalBuffer = usableSize.height - metrics.getHeight();
-
-            // at this point, horizontalBuffer and verticalBuffer are the dimensions of the buffer area we have.
-            // the buffer area is the off-screen area that is part of the display port and will be pre-drawn in case
-            // the user scrolls there. we now need to split the buffer area on each axis so that we know
-            // what the exact margins on each side will be. first we split the buffer amount based on the direction
-            // we're moving, so that we have a larger buffer in the direction of travel.
-            RectF margins = new RectF();
-            margins.left = splitBufferByVelocity(horizontalBuffer, velocity.x);
-            margins.right = horizontalBuffer - margins.left;
-            margins.top = splitBufferByVelocity(verticalBuffer, velocity.y);
-            margins.bottom = verticalBuffer - margins.top;
-
-            // then, we account for running into the page bounds - so that if we hit the top of the page, we need
-            // to drop the top margin and move that amount to the bottom margin.
-            margins = shiftMarginsForPageBounds(margins, metrics);
-
-            // finally, we calculate the resolution we want to render the display port area at. We do this
-            // so that as we expand the display port area (because of velocity), we reduce the resolution of
-            // the painted area so as to maintain the size of the buffer Gecko is painting into. we calculate
-            // the reduction in resolution by comparing the display port size with and without the velocity
-            // changes applied.
-            // this effectively means that as we pan faster and faster, the display port grows, but we paint
-            // at lower resolutions. this paints more area to reduce checkerboard at the cost of increasing
-            // compositor-scaling and blurriness. Once we stop panning, the blurriness must be entirely gone.
-            // Note that usable* could be less than base* if we are pinch-zoomed out into overscroll, so we
-            // clamp it to make sure this doesn't increase our display resolution past metrics.zoomFactor.
-            float scaleFactor = Math.min(reshapedSize.width / usableSize.width, reshapedSize.height / usableSize.height);
-            float displayResolution = metrics.zoomFactor * Math.min(1.0f, scaleFactor);
-
-            DisplayPortMetrics dpMetrics = new DisplayPortMetrics(
-                metrics.viewportRectLeft - margins.left,
-                metrics.viewportRectTop - margins.top,
-                metrics.viewportRectRight() + margins.right,
-                metrics.viewportRectBottom() + margins.bottom,
-                displayResolution);
-            return dpMetrics;
-        }
-
-        /**
-         * Split the given buffer amount into two based on the velocity.
-         * Given an amount of total usable buffer on an axis, this will
-         * return the amount that should be used on the left/top side of
-         * the axis (the side which a negative velocity vector corresponds
-         * to).
-         */
-        private float splitBufferByVelocity(float amount, float velocity) {
-            // if no velocity, so split evenly
-            if (FloatUtils.fuzzyEquals(velocity, 0)) {
-                return amount / 2.0f;
-            }
-            // if we're moving quickly, assign more of the amount in that direction
-            // since is is less likely that we will reverse direction immediately
-            if (velocity < -VELOCITY_FAST_THRESHOLD) {
-                return amount * FAST_SPLIT_FACTOR;
-            }
-            if (velocity > VELOCITY_FAST_THRESHOLD) {
-                return amount * (1.0f - FAST_SPLIT_FACTOR);
-            }
-            // if we're moving slowly, then assign less of the amount in that direction
-            if (velocity < 0) {
-                return amount * SLOW_SPLIT_FACTOR;
-            } else {
-                return amount * (1.0f - SLOW_SPLIT_FACTOR);
-            }
-        }
-
-        @Override
-        public boolean aboutToCheckerboard(ImmutableViewportMetrics metrics, PointF velocity, DisplayPortMetrics displayPort) {
-            // Expand the viewport based on our velocity (and clamp it to page boundaries).
-            // Then intersect it with the last-requested displayport to determine whether we're
-            // close to checkerboarding.
-
-            RectF predictedViewport = metrics.getViewport();
-
-            // first we expand the viewport in the direction we're moving based on some
-            // multiple of the current velocity.
-            if (velocity.length() > 0) {
-                if (velocity.x < 0) {
-                    predictedViewport.left += velocity.x * PREDICTION_VELOCITY_MULTIPLIER;
-                } else if (velocity.x > 0) {
-                    predictedViewport.right += velocity.x * PREDICTION_VELOCITY_MULTIPLIER;
-                }
-
-                if (velocity.y < 0) {
-                    predictedViewport.top += velocity.y * PREDICTION_VELOCITY_MULTIPLIER;
-                } else if (velocity.y > 0) {
-                    predictedViewport.bottom += velocity.y * PREDICTION_VELOCITY_MULTIPLIER;
-                }
-            }
-
-            // then we expand the viewport evenly in all directions just to have an extra
-            // safety zone. this also clamps it to page bounds.
-            predictedViewport = expandByDangerZone(predictedViewport, DANGER_ZONE_MULTIPLIER, DANGER_ZONE_MULTIPLIER, metrics);
-            return !displayPort.contains(predictedViewport);
-        }
-
-        @Override
-        public String toString() {
-            return "DynamicResolutionStrategy";
-        }
-    }
-
-    /**
-     * This class implements the variation where we use the draw time to predict where we will be when
-     * a draw completes, and draw that instead of where we are now. In this variation, when our panning
-     * speed drops below a certain threshold, we draw 9 viewports' worth of content so that the user can
-     * pan in any direction without encountering checkerboarding.
-     * Once the user is panning, we modify the displayport to encompass an area range of where we think
-     * the user will be when the draw completes. This heuristic relies on both the estimated draw time
-     * the panning velocity; unexpected changes in either of these values will cause the heuristic to
-     * fail and show checkerboard.
-     */
-    private static class PredictionBiasStrategy extends DisplayPortStrategy {
-        private static float VELOCITY_THRESHOLD;
-
-        private int mPixelArea;         // area of the viewport, used in draw time calculations
-        private int mMinFramesToDraw;   // minimum number of frames we take to draw
-        private int mMaxFramesToDraw;   // maximum number of frames we take to draw
-
-        PredictionBiasStrategy(Map<String, Integer> prefs) {
-            VELOCITY_THRESHOLD = GeckoAppShell.getDpi() * getFloatPref(prefs, PREF_DISPLAYPORT_PB_VELOCITY_THRESHOLD, 16);
-            resetPageState();
-        }
-
-        @Override
-        public DisplayPortMetrics calculate(ImmutableViewportMetrics metrics, PointF velocity) {
-            float width = metrics.getWidth();
-            float height = metrics.getHeight();
-            mPixelArea = (int)(width * height);
-
-            if (velocity.length() < VELOCITY_THRESHOLD) {
-                // if we're going slow, expand the displayport to 9x viewport size
-                RectF margins = new RectF(width, height, width, height);
-                return getPageClampedDisplayPortMetrics(margins, metrics.zoomFactor, metrics);
-            }
-
-            // figure out how far we expect to be
-            float minDx = velocity.x * mMinFramesToDraw;
-            float minDy = velocity.y * mMinFramesToDraw;
-            float maxDx = velocity.x * mMaxFramesToDraw;
-            float maxDy = velocity.y * mMaxFramesToDraw;
-
-            // figure out how many pixels we will be drawing when we draw the above-calculated range.
-            // this will be larger than the viewport area.
-            float pixelsToDraw = (width + Math.abs(maxDx - minDx)) * (height + Math.abs(maxDy - minDy));
-            // adjust how far we will get because of the time spent drawing all these extra pixels. this
-            // will again increase the number of pixels drawn so really we could keep iterating this over
-            // and over, but once seems enough for now.
-            maxDx = maxDx * pixelsToDraw / mPixelArea;
-            maxDy = maxDy * pixelsToDraw / mPixelArea;
-
-            // and finally generate the displayport. the min/max stuff takes care of
-            // negative velocities as well as positive.
-            RectF margins = new RectF(
-                -Math.min(minDx, maxDx),
-                -Math.min(minDy, maxDy),
-                Math.max(minDx, maxDx),
-                Math.max(minDy, maxDy));
-            return getPageClampedDisplayPortMetrics(margins, metrics.zoomFactor, metrics);
-        }
-
-        @Override
-        public boolean aboutToCheckerboard(ImmutableViewportMetrics metrics, PointF velocity, DisplayPortMetrics displayPort) {
-            // the code below is the same as in calculate() but is awkward to refactor since it has multiple outputs.
-            // refer to the comments in calculate() to understand what this is doing.
-            float minDx = velocity.x * mMinFramesToDraw;
-            float minDy = velocity.y * mMinFramesToDraw;
-            float maxDx = velocity.x * mMaxFramesToDraw;
-            float maxDy = velocity.y * mMaxFramesToDraw;
-            float pixelsToDraw = (metrics.getWidth() + Math.abs(maxDx - minDx)) * (metrics.getHeight() + Math.abs(maxDy - minDy));
-            maxDx = maxDx * pixelsToDraw / mPixelArea;
-            maxDy = maxDy * pixelsToDraw / mPixelArea;
-
-            // now that we have an idea of how far we will be when the draw completes, take the farthest
-            // end of that range and see if it falls outside the displayport bounds. if it does, allow
-            // the draw to go through
-            RectF predictedViewport = metrics.getViewport();
-            predictedViewport.left += maxDx;
-            predictedViewport.top += maxDy;
-            predictedViewport.right += maxDx;
-            predictedViewport.bottom += maxDy;
-
-            predictedViewport = clampToPageBounds(predictedViewport, metrics);
-            return !displayPort.contains(predictedViewport);
-        }
-
-        @Override
-        public boolean drawTimeUpdate(long millis, int pixels) {
-            // calculate the number of frames it took to draw a viewport-sized area
-            float normalizedTime = (float)mPixelArea * millis / pixels;
-            int normalizedFrames = (int) Math.ceil(normalizedTime * 60f / 1000f);
-            // broaden our range on how long it takes to draw if the draw falls outside
-            // the range. this allows it to grow gradually. this heuristic may need to
-            // be tweaked into more of a floating window average or something.
-            if (normalizedFrames <= mMinFramesToDraw) {
-                mMinFramesToDraw--;
-            } else if (normalizedFrames > mMaxFramesToDraw) {
-                mMaxFramesToDraw++;
-            } else {
-                return true;
-            }
-            Log.d(LOGTAG, "Widened draw range to [" + mMinFramesToDraw + ", " + mMaxFramesToDraw + "]");
-            return true;
-        }
-
-        @Override
-        public void resetPageState() {
-            mMinFramesToDraw = 0;
-            mMaxFramesToDraw = 2;
-        }
-
-        @Override
-        public String toString() {
-            return "PredictionBiasStrategy threshold=" + VELOCITY_THRESHOLD;
-        }
-    }
-}
deleted file mode 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/DisplayPortMetrics.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.gfx;
-
-import org.mozilla.gecko.annotation.WrapForJNI;
-import org.mozilla.gecko.util.FloatUtils;
-
-import android.graphics.RectF;
-
-/*
- * This class keeps track of the area we request Gecko to paint, as well
- * as the resolution of the paint. The area may be different from the visible
- * area of the page, and the resolution may be different from the resolution
- * used in the compositor to render the page. This is so that we can ask Gecko
- * to paint a much larger area without using extra memory, and then render some
- * subsection of that with compositor scaling.
- */
-public final class DisplayPortMetrics {
-    @WrapForJNI(calledFrom = "gecko")
-    public final float resolution;
-    @WrapForJNI(calledFrom = "gecko")
-    private final RectF mPosition;
-
-    public DisplayPortMetrics() {
-        this(0, 0, 0, 0, 1);
-    }
-
-    @WrapForJNI(calledFrom = "gecko")
-    public DisplayPortMetrics(float left, float top, float right, float bottom, float resolution) {
-        this.resolution = resolution;
-        mPosition = new RectF(left, top, right, bottom);
-    }
-
-    public float getLeft() {
-        return mPosition.left;
-    }
-
-    public float getTop() {
-        return mPosition.top;
-    }
-
-    public float getRight() {
-        return mPosition.right;
-    }
-
-    public float getBottom() {
-        return mPosition.bottom;
-    }
-
-    public boolean contains(RectF rect) {
-        return mPosition.contains(rect);
-    }
-
-    public boolean fuzzyEquals(DisplayPortMetrics metrics) {
-        return RectUtils.fuzzyEquals(mPosition, metrics.mPosition)
-            && FloatUtils.fuzzyEquals(resolution, metrics.resolution);
-    }
-
-    public String toJSON() {
-        StringBuilder sb = new StringBuilder(256);
-        sb.append("{ \"left\": ").append(mPosition.left)
-          .append(", \"top\": ").append(mPosition.top)
-          .append(", \"right\": ").append(mPosition.right)
-          .append(", \"bottom\": ").append(mPosition.bottom)
-          .append(", \"resolution\": ").append(resolution)
-          .append('}');
-        return sb.toString();
-    }
-
-    @Override
-    public String toString() {
-        return "DisplayPortMetrics v=(" + mPosition.left + "," + mPosition.top + "," + mPosition.right + ","
-                + mPosition.bottom + ") z=" + resolution;
-    }
-}
deleted file mode 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/DrawTimingQueue.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.gfx;
-
-import android.os.SystemClock;
-
-/**
- * A custom-built data structure to assist with measuring draw times.
- *
- * This class maintains a fixed-size circular buffer of DisplayPortMetrics
- * objects and associated timestamps. It provides only three operations, which
- * is all we require for our purposes of measuring draw times. Note
- * in particular that the class is designed so that even though it is
- * accessed from multiple threads, it does not require synchronization;
- * any concurrency errors that result from this are handled gracefully.
- *
- * Assuming an unrolled buffer so that mTail is greater than mHead, the data
- * stored in the buffer at entries [mHead, mTail) will never be modified, and
- * so are "safe" to read. If this reading is done on the same thread that
- * owns mHead, then reading the range [mHead, mTail) is guaranteed to be safe
- * since the range itself will not shrink.
- */
-final class DrawTimingQueue {
-    private static final String LOGTAG = "GeckoDrawTimingQueue";
-    private static final int BUFFER_SIZE = 16;
-
-    private final DisplayPortMetrics[] mMetrics;
-    private final long[] mTimestamps;
-
-    private int mHead;
-    private int mTail;
-
-    DrawTimingQueue() {
-        mMetrics = new DisplayPortMetrics[BUFFER_SIZE];
-        mTimestamps = new long[BUFFER_SIZE];
-        mHead = BUFFER_SIZE - 1;
-    }
-
-    /**
-     * Add a new entry to the tail of the queue. If the buffer is full,
-     * do nothing. This must only be called from the Java UI thread.
-     */
-    boolean add(DisplayPortMetrics metrics) {
-        if (mHead == mTail) {
-            return false;
-        }
-        mMetrics[mTail] = metrics;
-        mTimestamps[mTail] = SystemClock.uptimeMillis();
-        mTail = (mTail + 1) % BUFFER_SIZE;
-        return true;
-    }
-
-    /**
-     * Find the timestamp associated with the given metrics, AND remove
-     * all metrics objects from the start of the queue up to and including
-     * the one provided. Note that because of draw coalescing, the metrics
-     * object passed in here may not be the one at the head of the queue,
-     * and so we must iterate our way through the list to find it.
-     * This must only be called from the compositor thread.
-     */
-    long findTimeFor(DisplayPortMetrics metrics) {
-        // keep a copy of the tail pointer so that we ignore new items
-        // added to the queue while we are searching. this is fine because
-        // the one we are looking for will either have been added already
-        // or will not be in the queue at all.
-        int tail = mTail;
-        // walk through the "safe" range from mHead to tail; these entries
-        // will not be modified unless we change mHead.
-        int i = (mHead + 1) % BUFFER_SIZE;
-        while (i != tail) {
-            if (mMetrics[i].fuzzyEquals(metrics)) {
-                // found it, copy out the timestamp to a local var BEFORE
-                // changing mHead or add could clobber the timestamp.
-                long timestamp = mTimestamps[i];
-                mHead = i;
-                return timestamp;
-            }
-            i = (i + 1) % BUFFER_SIZE;
-        }
-        return -1;
-    }
-
-    /**
-     * Reset the buffer to empty.
-     * This must only be called from the compositor thread.
-     */
-    void reset() {
-        // we can only modify mHead on this thread.
-        mHead = (mTail + BUFFER_SIZE - 1) % BUFFER_SIZE;
-    }
-}
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
@@ -34,48 +34,28 @@ class GeckoLayerClient implements LayerV
     private static int sPaintSyncId = 1;
 
     private LayerRenderer mLayerRenderer;
     private boolean mLayerRendererInitialized;
 
     private final Context mContext;
     private IntSize mScreenSize;
     private IntSize mWindowSize;
-    private DisplayPortMetrics mDisplayPort;
-
-    private boolean mRecordDrawTimes;
-    private final DrawTimingQueue mDrawTimingQueue;
-
-    /* The Gecko viewport as per the UI thread. Must be touched only on the UI thread.
-     * If any events being sent to Gecko that are relative to the Gecko viewport position,
-     * they must (a) be relative to this viewport, and (b) be sent on the UI thread to
-     * avoid races. As long as these two conditions are satisfied, and the events being
-     * sent to Gecko are processed in FIFO order, the events will properly be relative
-     * to the Gecko viewport position. Note that if Gecko updates its viewport independently,
-     * we get notified synchronously and also update this on the UI thread.
-     */
-    private ImmutableViewportMetrics mGeckoViewport;
 
     /*
      * The viewport metrics being used to draw the current frame. This is only
      * accessed by the compositor thread, and so needs no synchronisation.
      */
     private ImmutableViewportMetrics mFrameMetrics;
 
     private final List<DrawListener> mDrawListeners;
 
     /* Used as temporaries by syncViewportInfo */
     private final ViewTransform mCurrentViewTransform;
 
-    /* Used as the return value of progressiveUpdateCallback */
-    private final ProgressiveUpdateData mProgressiveUpdateData;
-    private DisplayPortMetrics mProgressiveUpdateDisplayPort;
-    private boolean mLastProgressiveUpdateWasLowPrecision;
-    private boolean mProgressiveUpdateWasInDanger;
-
     private boolean mForceRedraw;
 
     /* The current viewport metrics.
      * This is volatile so that we can read and write to it from different threads.
      * We avoid synchronization to make getting the viewport metrics from
      * the compositor as cheap as possible. The viewport is immutable so
      * we don't need to worry about anyone mutating it while we're reading from it.
      * Specifically:
@@ -108,22 +88,17 @@ class GeckoLayerClient implements LayerV
     private volatile int mClearColor = Color.WHITE;
 
     public GeckoLayerClient(Context context, LayerView view, EventDispatcher eventDispatcher) {
         // we can fill these in with dummy values because they are always written
         // to before being read
         mContext = context;
         mScreenSize = new IntSize(0, 0);
         mWindowSize = new IntSize(0, 0);
-        mDisplayPort = new DisplayPortMetrics();
-        mRecordDrawTimes = true;
-        mDrawTimingQueue = new DrawTimingQueue();
         mCurrentViewTransform = new ViewTransform(0, 0, 1);
-        mProgressiveUpdateData = new ProgressiveUpdateData();
-        mProgressiveUpdateDisplayPort = new DisplayPortMetrics();
 
         mForceRedraw = true;
         DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
         mViewportMetrics = new ImmutableViewportMetrics(displayMetrics)
                            .setViewportSize(view.getWidth(), view.getHeight());
 
         mFrameMetrics = mViewportMetrics;
 
@@ -152,18 +127,16 @@ class GeckoLayerClient implements LayerV
     @WrapForJNI(calledFrom = "gecko")
     private void onGeckoReady() {
         mGeckoIsReady = true;
 
         mLayerRenderer = mView.getRenderer();
 
         sendResizeEventIfNecessary(true, null);
 
-        DisplayPortCalculator.initPrefs();
-
         // Gecko being ready is one of the two conditions (along with having an available
         // surface) that cause us to create the compositor. So here, now that we know gecko
         // is ready, call updateCompositor() to see if we can actually do the creation.
         // This needs to run on the UI thread so that the surface validity can't change on
         // us while we're in the middle of creating the compositor.
         mView.post(new Runnable() {
             @Override
             public void run() {
@@ -337,36 +310,27 @@ class GeckoLayerClient implements LayerV
             RectF cssPageRect = new RectF(cssPageLeft, cssPageTop, cssPageRight, cssPageBottom);
             RectF pageRect = RectUtils.scaleAndRound(cssPageRect, zoom);
 
             final ImmutableViewportMetrics newMetrics = currentMetrics
                 .setViewportOrigin(offsetX, offsetY)
                 .setZoomFactor(zoom)
                 .setPageRect(pageRect, cssPageRect);
             // Since we have switched to displaying a different document, we need to update any
-            // viewport-related state we have lying around. This includes mGeckoViewport and
-            // mViewportMetrics. Usually this information is updated via handleViewportMessage
+            // viewport-related state we have lying around (i.e. mViewportMetrics).
+            // Usually this information is updated via handleViewportMessage
             // while we remain on the same document.
-            post(new Runnable() {
-                @Override
-                public void run() {
-                    mGeckoViewport = newMetrics;
-                }
-            });
-
             setViewportMetrics(newMetrics);
 
             // Indicate that the document is about to be composited so the
             // LayerView background can be removed.
             if (mView.getPaintState() == LayerView.PAINT_START) {
                 mView.setPaintState(LayerView.PAINT_BEFORE_FIRST);
             }
         }
-        DisplayPortCalculator.resetPageState();
-        mDrawTimingQueue.reset();
 
         mContentDocumentIsDisplayed = true;
     }
 
     /** The compositor invokes this function whenever it determines that the page rect
       * has changed (based on the information it gets from layout). If setFirstPaintViewport
       * is invoked on a frame, then this function will not be. For any given frame, this
       * function will be invoked before syncViewportInfo.
@@ -401,29 +365,16 @@ class GeckoLayerClient implements LayerV
         // of the compositor thread.
         mFrameMetrics = getViewportMetrics();
 
         if (paintSyncId == sPaintSyncId) {
             mToolbarAnimator.scrollChangeResizeCompleted();
         }
         mToolbarAnimator.populateViewTransform(mCurrentViewTransform, mFrameMetrics);
 
-        if (layersUpdated && mRecordDrawTimes) {
-            // If we got a layers update, that means a draw finished. Check to see if the area drawn matches
-            // one of our requested displayports; if it does calculate the draw time and notify the
-            // DisplayPortCalculator
-            DisplayPortMetrics drawn = new DisplayPortMetrics(x, y, x + width, y + height, resolution);
-            long time = mDrawTimingQueue.findTimeFor(drawn);
-            if (time >= 0) {
-                long now = SystemClock.uptimeMillis();
-                time = now - time;
-                mRecordDrawTimes = DisplayPortCalculator.drawTimeUpdate(time, width * height);
-            }
-        }
-
         if (layersUpdated) {
             for (DrawListener listener : mDrawListeners) {
                 listener.drawFinished();
             }
         }
 
         return mCurrentViewTransform;
     }
@@ -673,17 +624,17 @@ class GeckoLayerClient implements LayerV
         try {
             return mLayerRenderer.createFrame(mFrameMetrics);
         } catch (Exception e) {
             Log.w(LOGTAG, e);
             return null;
         }
     }
 
-    private void geometryChanged(DisplayPortMetrics displayPort) {
+    private void geometryChanged() {
         /* Let Gecko know if the screensize has changed */
         sendResizeEventIfNecessary(false, null);
     }
 
     /** Implementation of LayerView.Listener */
     @Override
     public void surfaceChanged(int width, int height) {
         IntSize viewportSize = mToolbarAnimator.getViewportSize();
@@ -706,23 +657,16 @@ class GeckoLayerClient implements LayerV
     @Override
     public PointF getVisibleEndOfLayerView() {
         return mToolbarAnimator.getVisibleEndOfLayerView();
     }
 
     /** Implementation of PanZoomTarget */
     @Override
     public void setAnimationTarget(ImmutableViewportMetrics metrics) {
-        if (mGeckoIsReady) {
-            // We know what the final viewport of the animation is going to be, so
-            // immediately request a draw of that area by setting the display port
-            // accordingly. This way we should have the content pre-rendered by the
-            // time the animation is done.
-            DisplayPortMetrics displayPort = DisplayPortCalculator.calculate(metrics, null);
-        }
     }
 
     /** Implementation of PanZoomTarget
      * You must hold the monitor while calling this.
      */
     @Override
     public void setViewportMetrics(ImmutableViewportMetrics metrics) {
         setViewportMetrics(metrics, true);
@@ -746,17 +690,17 @@ class GeckoLayerClient implements LayerV
     /*
      * You must hold the monitor while calling this.
      */
     private void viewportMetricsChanged(boolean notifyGecko) {
         mToolbarAnimator.onMetricsChanged(mViewportMetrics);
 
         mView.requestRender();
         if (notifyGecko && mGeckoIsReady) {
-            geometryChanged(null);
+            geometryChanged();
         }
     }
 
     /*
      * Updates the viewport metrics, overriding the viewport size and margins
      * which are normally retained when calling setViewportMetrics.
      * You must hold the monitor while calling this.
      */
@@ -787,25 +731,16 @@ class GeckoLayerClient implements LayerV
     /** Implementation of PanZoomTarget */
     @Override
     public void panZoomStopped() {
         mToolbarAnimator.onPanZoomStopped();
     }
 
     /** Implementation of PanZoomTarget */
     @Override
-    public void forceRedraw(DisplayPortMetrics displayPort) {
-        mForceRedraw = true;
-        if (mGeckoIsReady) {
-            geometryChanged(displayPort);
-        }
-    }
-
-    /** Implementation of PanZoomTarget */
-    @Override
     public boolean post(Runnable action) {
         return mView.post(action);
     }
 
     /** Implementation of PanZoomTarget */
     @Override
     public void postRenderTask(RenderTask task) {
         mView.postRenderTask(task);
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/PanZoomTarget.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/PanZoomTarget.java
@@ -12,18 +12,16 @@ public interface PanZoomTarget {
     public ImmutableViewportMetrics getViewportMetrics();
     public FullScreenState getFullScreenState();
     public PointF getVisibleEndOfLayerView();
 
     public void setAnimationTarget(ImmutableViewportMetrics viewport);
     public void setViewportMetrics(ImmutableViewportMetrics viewport);
     public void scrollBy(float dx, float dy);
     public void panZoomStopped();
-    /** This triggers an (asynchronous) viewport update/redraw. */
-    public void forceRedraw(DisplayPortMetrics displayPort);
 
     public boolean isGeckoReady();
     public boolean post(Runnable action);
     public void postRenderTask(RenderTask task);
     public void removeRenderTask(RenderTask task);
     public Object getLock();
     public PointF convertViewPointToLayerPoint(PointF viewPoint);
     public Matrix getMatrixForLayerRectToViewRect();
deleted file mode 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SimpleScaleGestureDetector.java
+++ /dev/null
@@ -1,322 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.gfx;
-
-import org.json.JSONException;
-
-import android.graphics.PointF;
-import android.util.Log;
-import android.view.MotionEvent;
-
-import java.util.LinkedList;
-import java.util.ListIterator;
-import java.util.Stack;
-
-/**
- * A less buggy, and smoother, replacement for the built-in Android ScaleGestureDetector.
- *
- * This gesture detector is more reliable than the built-in ScaleGestureDetector because:
- *
- *   - It doesn't assume that pointer IDs are numbered 0 and 1.
- *
- *   - It doesn't attempt to correct for "slop" when resting one's hand on the device. On some
- *     devices (e.g. the Droid X) this can cause the ScaleGestureDetector to lose track of how many
- *     pointers are down, with disastrous results (bug 706684).
- *
- *   - Cancelling a zoom into a pan is handled correctly.
- *
- *   - Starting with three or more fingers down, releasing fingers so that only two are down, and
- *     then performing a scale gesture is handled correctly.
- *
- *   - It doesn't take pressure into account, which results in smoother scaling.
- */
-class SimpleScaleGestureDetector {
-    private static final String LOGTAG = "GeckoSimpleScaleGestureDetector";
-
-    private final SimpleScaleGestureListener mListener;
-    private long mLastEventTime;
-    private boolean mScaleResult;
-
-    /* Information about all pointers that are down. */
-    private final LinkedList<PointerInfo> mPointerInfo;
-
-    /** Creates a new gesture detector with the given listener. */
-    SimpleScaleGestureDetector(SimpleScaleGestureListener listener) {
-        mListener = listener;
-        mPointerInfo = new LinkedList<PointerInfo>();
-    }
-
-    /** Forward touch events to this function. */
-    public void onTouchEvent(MotionEvent event) {
-        switch (event.getAction() & MotionEvent.ACTION_MASK) {
-        case MotionEvent.ACTION_DOWN:
-            // If we get ACTION_DOWN while still tracking any pointers,
-            // something is wrong.  Cancel the current gesture and start over.
-            if (getPointersDown() > 0)
-                onTouchEnd(event);
-            onTouchStart(event);
-            break;
-        case MotionEvent.ACTION_POINTER_DOWN:
-            onTouchStart(event);
-            break;
-        case MotionEvent.ACTION_MOVE:
-            onTouchMove(event);
-            break;
-        case MotionEvent.ACTION_POINTER_UP:
-        case MotionEvent.ACTION_UP:
-        case MotionEvent.ACTION_CANCEL:
-            onTouchEnd(event);
-            break;
-        }
-    }
-
-    private int getPointersDown() {
-        return mPointerInfo.size();
-    }
-
-    private int getActionIndex(MotionEvent event) {
-        return (event.getAction() & MotionEvent.ACTION_POINTER_INDEX_MASK)
-            >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;
-    }
-
-    private void onTouchStart(MotionEvent event) {
-        mLastEventTime = event.getEventTime();
-        mPointerInfo.addFirst(PointerInfo.create(event, getActionIndex(event)));
-        if (getPointersDown() == 2) {
-            sendScaleGesture(EventType.BEGIN);
-        }
-    }
-
-    private void onTouchMove(MotionEvent event) {
-        mLastEventTime = event.getEventTime();
-        for (int i = 0; i < event.getPointerCount(); i++) {
-            PointerInfo pointerInfo = pointerInfoForEventIndex(event, i);
-            if (pointerInfo != null) {
-                pointerInfo.populate(event, i);
-            }
-        }
-
-        if (getPointersDown() == 2) {
-            sendScaleGesture(EventType.CONTINUE);
-        }
-    }
-
-    private void onTouchEnd(MotionEvent event) {
-        mLastEventTime = event.getEventTime();
-
-        int action = event.getAction() & MotionEvent.ACTION_MASK;
-        boolean isCancel = (action == MotionEvent.ACTION_CANCEL ||
-                            action == MotionEvent.ACTION_DOWN);
-
-        int id = event.getPointerId(getActionIndex(event));
-        ListIterator<PointerInfo> iterator = mPointerInfo.listIterator();
-        while (iterator.hasNext()) {
-            PointerInfo pointerInfo = iterator.next();
-            if (!(isCancel || pointerInfo.getId() == id)) {
-                continue;
-            }
-
-            // One of the pointers we were tracking was lifted. Remove its info object from the
-            // list, recycle it to avoid GC pauses, and send an onScaleEnd() notification if this
-            // ended the gesture.
-            iterator.remove();
-            pointerInfo.recycle();
-            if (getPointersDown() == 1) {
-                sendScaleGesture(EventType.END);
-            }
-        }
-    }
-
-    /**
-     * Returns the X coordinate of the focus location (the midpoint of the two fingers). If only
-     * one finger is down, returns the location of that finger.
-     */
-    public float getFocusX() {
-        switch (getPointersDown()) {
-        case 1:
-            return mPointerInfo.getFirst().getCurrent().x;
-        case 2:
-            PointerInfo pointerA = mPointerInfo.getFirst(), pointerB = mPointerInfo.getLast();
-            return (pointerA.getCurrent().x + pointerB.getCurrent().x) / 2.0f;
-        }
-
-        Log.e(LOGTAG, "No gesture taking place in getFocusX()!");
-        return 0.0f;
-    }
-
-    /**
-     * Returns the Y coordinate of the focus location (the midpoint of the two fingers). If only
-     * one finger is down, returns the location of that finger.
-     */
-    public float getFocusY() {
-        switch (getPointersDown()) {
-        case 1:
-            return mPointerInfo.getFirst().getCurrent().y;
-        case 2:
-            PointerInfo pointerA = mPointerInfo.getFirst(), pointerB = mPointerInfo.getLast();
-            return (pointerA.getCurrent().y + pointerB.getCurrent().y) / 2.0f;
-        }
-
-        Log.e(LOGTAG, "No gesture taking place in getFocusY()!");
-        return 0.0f;
-    }
-
-    /** Returns the most recent distance between the two pointers. */
-    public float getCurrentSpan() {
-        if (getPointersDown() != 2) {
-            Log.e(LOGTAG, "No gesture taking place in getCurrentSpan()!");
-            return 0.0f;
-        }
-
-        PointerInfo pointerA = mPointerInfo.getFirst(), pointerB = mPointerInfo.getLast();
-        return PointUtils.distance(pointerA.getCurrent(), pointerB.getCurrent());
-    }
-
-    /** Returns the second most recent distance between the two pointers. */
-    public float getPreviousSpan() {
-        if (getPointersDown() != 2) {
-            Log.e(LOGTAG, "No gesture taking place in getPreviousSpan()!");
-            return 0.0f;
-        }
-
-        PointerInfo pointerA = mPointerInfo.getFirst(), pointerB = mPointerInfo.getLast();
-        PointF a = pointerA.getPrevious(), b = pointerB.getPrevious();
-        if (a == null || b == null) {
-            a = pointerA.getCurrent();
-            b = pointerB.getCurrent();
-        }
-
-        return PointUtils.distance(a, b);
-    }
-
-    /** Returns the time of the last event related to the gesture. */
-    public long getEventTime() {
-        return mLastEventTime;
-    }
-
-    /** Returns true if the scale gesture is in progress and false otherwise. */
-    public boolean isInProgress() {
-        return getPointersDown() == 2;
-    }
-
-    /* Sends the requested scale gesture notification to the listener. */
-    private void sendScaleGesture(EventType eventType) {
-        switch (eventType) {
-        case BEGIN:
-            mScaleResult = mListener.onScaleBegin(this);
-            break;
-        case CONTINUE:
-            if (mScaleResult) {
-                mListener.onScale(this);
-            }
-            break;
-        case END:
-            if (mScaleResult) {
-                mListener.onScaleEnd(this);
-            }
-            break;
-        }
-    }
-
-    /*
-     * Returns the pointer info corresponding to the given pointer index, or null if the pointer
-     * isn't one that's being tracked.
-     */
-    private PointerInfo pointerInfoForEventIndex(MotionEvent event, int index) {
-        int id = event.getPointerId(index);
-        for (PointerInfo pointerInfo : mPointerInfo) {
-            if (pointerInfo.getId() == id) {
-                return pointerInfo;
-            }
-        }
-        return null;
-    }
-
-    private enum EventType {
-        BEGIN,
-        CONTINUE,
-        END,
-    }
-
-    /* Encapsulates information about one of the two fingers involved in the gesture. */
-    private static class PointerInfo {
-        /* A free list that recycles pointer info objects, to reduce GC pauses. */
-        private static Stack<PointerInfo> sPointerInfoFreeList;
-
-        private int mId;
-        private PointF mCurrent, mPrevious;
-
-        private PointerInfo() {
-            // External users should use create() instead.
-        }
-
-        /* Creates or recycles a new PointerInfo instance from an event and a pointer index. */
-        public static PointerInfo create(MotionEvent event, int index) {
-            if (sPointerInfoFreeList == null) {
-                sPointerInfoFreeList = new Stack<PointerInfo>();
-            }
-
-            PointerInfo pointerInfo;
-            if (sPointerInfoFreeList.empty()) {
-                pointerInfo = new PointerInfo();
-            } else {
-                pointerInfo = sPointerInfoFreeList.pop();
-            }
-
-            pointerInfo.populate(event, index);
-            return pointerInfo;
-        }
-
-        /*
-         * Fills in the fields of this instance from the given motion event and pointer index
-         * within that event.
-         */
-        public void populate(MotionEvent event, int index) {
-            mId = event.getPointerId(index);
-            mPrevious = mCurrent;
-            mCurrent = new PointF(event.getX(index), event.getY(index));
-        }
-
-        public void recycle() {
-            mId = -1;
-            mPrevious = mCurrent = null;
-            sPointerInfoFreeList.push(this);
-        }
-
-        public int getId() { return mId; }
-        public PointF getCurrent() { return mCurrent; }
-        public PointF getPrevious() { return mPrevious; }
-
-        @Override
-        public String toString() {
-            if (mId == -1) {
-                return "(up)";
-            }
-
-            try {
-                String prevString;
-                if (mPrevious == null) {
-                    prevString = "n/a";
-                } else {
-                    prevString = PointUtils.toJSON(mPrevious).toString();
-                }
-
-                // The current position should always be non-null.
-                String currentString = PointUtils.toJSON(mCurrent).toString();
-                return "id=" + mId + " cur=" + currentString + " prev=" + prevString;
-            } catch (JSONException e) {
-                throw new RuntimeException(e);
-            }
-        }
-    }
-
-    public static interface SimpleScaleGestureListener {
-        public boolean onScale(SimpleScaleGestureDetector detector);
-        public boolean onScaleBegin(SimpleScaleGestureDetector detector);
-        public void onScaleEnd(SimpleScaleGestureDetector detector);
-    }
-}
-
deleted file mode 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/SubdocumentScrollHelper.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/* -*- Mode: Java; c-basic-offset: 4; tab-width: 20; indent-tabs-mode: nil; -*-
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-package org.mozilla.gecko.gfx;
-
-import org.mozilla.gecko.GeckoAppShell;
-import org.mozilla.gecko.EventDispatcher;
-import org.mozilla.gecko.util.GeckoEventListener;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import android.graphics.PointF;
-import android.os.Handler;
-import android.util.Log;
-
-class SubdocumentScrollHelper implements GeckoEventListener {
-    private static final String LOGTAG = "GeckoSubdocScroll";
-
-    private static final String MESSAGE_PANNING_OVERRIDE = "Panning:Override";
-    private static final String MESSAGE_CANCEL_OVERRIDE = "Panning:CancelOverride";
-    private static final String MESSAGE_SCROLL = "Gesture:Scroll";
-    private static final String MESSAGE_SCROLL_ACK = "Gesture:ScrollAck";
-
-    private final Handler mUiHandler;
-    private final EventDispatcher mEventDispatcher;
-
-    /* This is the amount of displacement we have accepted but not yet sent to JS; this is
-     * only valid when mOverrideScrollPending is true. */
-    private final PointF mPendingDisplacement;
-
-    /* When this is true, we're sending scroll events to JS to scroll the active subdocument. */
-    private boolean mOverridePanning;
-
-    /* When this is true, we have received an ack for the last scroll event we sent to JS, and
-     * are ready to send the next scroll event. Note we only ever have one scroll event inflight
-     * at a time. */
-    private boolean mOverrideScrollAck;
-
-    /* When this is true, we have a pending scroll that we need to send to JS; we were unable
-     * to send it when it was initially requested because mOverrideScrollAck was not true. */
-    private boolean mOverrideScrollPending;
-
-    /* When this is true, the last scroll event we sent actually did some amount of scrolling on
-     * the subdocument; we use this to decide when we have reached the end of the subdocument. */
-    private boolean mScrollSucceeded;
-
-    SubdocumentScrollHelper(EventDispatcher eventDispatcher) {
-        // mUiHandler will be bound to the UI thread since that's where this constructor runs
-        mUiHandler = new Handler();
-        mPendingDisplacement = new PointF();
-
-        mEventDispatcher = eventDispatcher;
-        mEventDispatcher.registerGeckoThreadListener(this,
-            MESSAGE_PANNING_OVERRIDE,
-            MESSAGE_CANCEL_OVERRIDE,
-            MESSAGE_SCROLL_ACK);
-    }
-
-    void destroy() {
-        mEventDispatcher.unregisterGeckoThreadListener(this,
-            MESSAGE_PANNING_OVERRIDE,
-            MESSAGE_CANCEL_OVERRIDE,
-            MESSAGE_SCROLL_ACK);
-    }
-
-    boolean scrollBy(PointF displacement) {
-        if (! mOverridePanning) {
-            return false;
-        }
-
-        if (! mOverrideScrollAck) {
-            mOverrideScrollPending = true;
-            mPendingDisplacement.x += displacement.x;
-            mPendingDisplacement.y += displacement.y;
-            return true;
-        }
-
-        JSONObject json = new JSONObject();
-        try {
-            json.put("x", displacement.x);
-            json.put("y", displacement.y);
-        } catch (JSONException e) {
-            Log.e(LOGTAG, "Error forming subwindow scroll message: ", e);
-        }
-        GeckoAppShell.notifyObservers(MESSAGE_SCROLL, json.toString());
-
-        mOverrideScrollAck = false;
-        mOverrideScrollPending = false;
-        // clear the |mPendingDisplacement| after serializing |displacement| to
-        // JSON because they might be the same object
-        mPendingDisplacement.x = 0;
-        mPendingDisplacement.y = 0;
-
-        return true;
-    }
-
-    void cancel() {
-        mOverridePanning = false;
-    }
-
-    boolean scrolling() {
-        return mOverridePanning;
-    }
-
-    boolean lastScrollSucceeded() {
-        return mScrollSucceeded;
-    }
-
-    // GeckoEventListener implementation
-
-    @Override
-    public void handleMessage(final String event, final JSONObject message) {
-        // This comes in on the Gecko thread; hand off the handling to the UI thread.
-        mUiHandler.post(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    if (MESSAGE_PANNING_OVERRIDE.equals(event)) {
-                        mOverridePanning = true;
-                        mOverrideScrollAck = true;
-                        mOverrideScrollPending = false;
-                        mScrollSucceeded = true;
-                    } else if (MESSAGE_CANCEL_OVERRIDE.equals(event)) {
-                        mOverridePanning = false;
-                    } else if (MESSAGE_SCROLL_ACK.equals(event)) {
-                        mOverrideScrollAck = true;
-                        mScrollSucceeded = message.getBoolean("scrolled");
-                        if (mOverridePanning && mOverrideScrollPending) {
-                            scrollBy(mPendingDisplacement);
-                        }
-                    }
-                } catch (Exception e) {
-                    Log.e(LOGTAG, "Exception handling message", e);
-                }
-            }
-        });
-    }
-}
--- a/widget/android/GeneratedJNIWrappers.cpp
+++ b/widget/android/GeneratedJNIWrappers.cpp
@@ -1087,43 +1087,16 @@ constexpr char SurfaceTextureListener::N
 auto SurfaceTextureListener::New() -> SurfaceTextureListener::LocalRef
 {
     return mozilla::jni::Constructor<New_t>::Call(SurfaceTextureListener::Context(), nullptr);
 }
 
 constexpr char SurfaceTextureListener::OnFrameAvailable_t::name[];
 constexpr char SurfaceTextureListener::OnFrameAvailable_t::signature[];
 
-const char DisplayPortMetrics::name[] =
-        "org/mozilla/gecko/gfx/DisplayPortMetrics";
-
-constexpr char DisplayPortMetrics::New_t::name[];
-constexpr char DisplayPortMetrics::New_t::signature[];
-
-auto DisplayPortMetrics::New(float a0, float a1, float a2, float a3, float a4) -> DisplayPortMetrics::LocalRef
-{
-    return mozilla::jni::Constructor<New_t>::Call(DisplayPortMetrics::Context(), nullptr, a0, a1, a2, a3, a4);
-}
-
-constexpr char DisplayPortMetrics::MPosition_t::name[];
-constexpr char DisplayPortMetrics::MPosition_t::signature[];
-
-auto DisplayPortMetrics::MPosition() const -> mozilla::jni::Object::LocalRef
-{
-    return mozilla::jni::Field<MPosition_t>::Get(DisplayPortMetrics::mCtx, nullptr);
-}
-
-constexpr char DisplayPortMetrics::Resolution_t::name[];
-constexpr char DisplayPortMetrics::Resolution_t::signature[];
-
-auto DisplayPortMetrics::Resolution() const -> float
-{
-    return mozilla::jni::Field<Resolution_t>::Get(DisplayPortMetrics::mCtx, nullptr);
-}
-
 const char GeckoLayerClient::name[] =
         "org/mozilla/gecko/gfx/GeckoLayerClient";
 
 constexpr char GeckoLayerClient::ContentDocumentChanged_t::name[];
 constexpr char GeckoLayerClient::ContentDocumentChanged_t::signature[];
 
 auto GeckoLayerClient::ContentDocumentChanged() const -> void
 {
--- a/widget/android/GeneratedJNIWrappers.h
+++ b/widget/android/GeneratedJNIWrappers.h
@@ -3509,90 +3509,16 @@ public:
     };
 
     static const mozilla::jni::CallingThread callingThread =
             mozilla::jni::CallingThread::ANY;
 
     template<class Impl> class Natives;
 };
 
-class DisplayPortMetrics : public mozilla::jni::ObjectBase<DisplayPortMetrics>
-{
-public:
-    static const char name[];
-
-    explicit DisplayPortMetrics(const Context& ctx) : ObjectBase<DisplayPortMetrics>(ctx) {}
-
-    struct New_t {
-        typedef DisplayPortMetrics Owner;
-        typedef DisplayPortMetrics::LocalRef ReturnType;
-        typedef DisplayPortMetrics::Param SetterType;
-        typedef mozilla::jni::Args<
-                float,
-                float,
-                float,
-                float,
-                float> Args;
-        static constexpr char name[] = "<init>";
-        static constexpr char signature[] =
-                "(FFFFF)V";
-        static const bool isStatic = false;
-        static const mozilla::jni::ExceptionMode exceptionMode =
-                mozilla::jni::ExceptionMode::ABORT;
-        static const mozilla::jni::CallingThread callingThread =
-                mozilla::jni::CallingThread::GECKO;
-        static const mozilla::jni::DispatchTarget dispatchTarget =
-                mozilla::jni::DispatchTarget::CURRENT;
-    };
-
-    static auto New(float, float, float, float, float) -> DisplayPortMetrics::LocalRef;
-
-    struct MPosition_t {
-        typedef DisplayPortMetrics Owner;
-        typedef mozilla::jni::Object::LocalRef ReturnType;
-        typedef mozilla::jni::Object::Param SetterType;
-        typedef mozilla::jni::Args<> Args;
-        static constexpr char name[] = "mPosition";
-        static constexpr char signature[] =
-                "Landroid/graphics/RectF;";
-        static const bool isStatic = false;
-        static const mozilla::jni::ExceptionMode exceptionMode =
-                mozilla::jni::ExceptionMode::ABORT;
-        static const mozilla::jni::CallingThread callingThread =
-                mozilla::jni::CallingThread::GECKO;
-        static const mozilla::jni::DispatchTarget dispatchTarget =
-                mozilla::jni::DispatchTarget::CURRENT;
-    };
-
-    auto MPosition() const -> mozilla::jni::Object::LocalRef;
-
-    struct Resolution_t {
-        typedef DisplayPortMetrics Owner;
-        typedef float ReturnType;
-        typedef float SetterType;
-        typedef mozilla::jni::Args<> Args;
-        static constexpr char name[] = "resolution";
-        static constexpr char signature[] =
-                "F";
-        static const bool isStatic = false;
-        static const mozilla::jni::ExceptionMode exceptionMode =
-                mozilla::jni::ExceptionMode::ABORT;
-        static const mozilla::jni::CallingThread callingThread =
-                mozilla::jni::CallingThread::GECKO;
-        static const mozilla::jni::DispatchTarget dispatchTarget =
-                mozilla::jni::DispatchTarget::CURRENT;
-    };
-
-    auto Resolution() const -> float;
-
-    static const mozilla::jni::CallingThread callingThread =
-            mozilla::jni::CallingThread::GECKO;
-
-};
-
 class GeckoLayerClient : public mozilla::jni::ObjectBase<GeckoLayerClient>
 {
 public:
     static const char name[];
 
     explicit GeckoLayerClient(const Context& ctx) : ObjectBase<GeckoLayerClient>(ctx) {}
 
     struct ContentDocumentChanged_t {