Bug 1379252 - Remove a bunch of unused fields from ImmutableViewportMetrics. r?rbarker draft
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 07 Jul 2017 14:56:07 -0400
changeset 605449 56189a6ce4b54d197b8b5e5f2d8d3a7c0204a2dc
parent 604915 e23f55311ecb5e0cd14c5010d1b40663b3a2e7d0
child 605450 9c10292ae59d539091097402fa7c55dbde54f00b
push id67410
push userkgupta@mozilla.com
push dateFri, 07 Jul 2017 18:56:35 +0000
reviewersrbarker
bugs1379252
milestone56.0a1
Bug 1379252 - Remove a bunch of unused fields from ImmutableViewportMetrics. r?rbarker Also propagate the removal outwards to remove other unused functions. MozReview-Commit-ID: 9aqcbBA0Mf1
mobile/android/base/moz.build
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/FloatSize.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/ImmutableViewportMetrics.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/RectUtils.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/FloatUtils.java
mobile/android/tests/background/junit4/src/org/mozilla/gecko/util/TestFloatUtils.java
widget/android/GeneratedJNIWrappers.cpp
widget/android/GeneratedJNIWrappers.h
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -399,17 +399,16 @@ gvjar.sources += [geckoview_source_dir +
     'gfx/IntSize.java',
     'gfx/LayerView.java',
     'gfx/NativePanZoomController.java',
     'gfx/Overscroll.java',
     'gfx/OverscrollEdgeEffect.java',
     'gfx/PanningPerfAPI.java',
     'gfx/PanZoomController.java',
     'gfx/PointUtils.java',
-    'gfx/RectUtils.java',
     'gfx/RenderTask.java',
     'gfx/StackScroller.java',
     'gfx/SurfaceAllocator.java',
     'gfx/SurfaceAllocatorService.java',
     'gfx/SurfaceTextureListener.java',
     'gfx/ViewTransform.java',
     'gfx/VsyncSource.java',
     'InputConnectionListener.java',
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/FloatSize.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/FloatSize.java
@@ -1,54 +1,16 @@
 /* -*- 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.util.FloatUtils;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
 public class FloatSize {
     public final float width, height;
 
-    public FloatSize(FloatSize size) { width = size.width; height = size.height; }
-    public FloatSize(IntSize size) { width = size.width; height = size.height; }
     public FloatSize(float aWidth, float aHeight) { width = aWidth; height = aHeight; }
 
-    public FloatSize(JSONObject json) {
-        try {
-            width = (float)json.getDouble("width");
-            height = (float)json.getDouble("height");
-        } catch (JSONException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
     @Override
     public String toString() { return "(" + width + "," + height + ")"; }
-
-    public boolean isPositive() {
-        return (width > 0 && height > 0);
-    }
-
-    public boolean fuzzyEquals(FloatSize size) {
-        return (FloatUtils.fuzzyEquals(size.width, width) &&
-                FloatUtils.fuzzyEquals(size.height, height));
-    }
-
-    public FloatSize scale(float factor) {
-        return new FloatSize(width * factor, height * factor);
-    }
-
-    /*
-     * Returns the size that represents a linear transition between this size and `to` at time `t`,
-     * which is on the scale [0, 1).
-     */
-    public FloatSize interpolate(FloatSize to, float t) {
-        return new FloatSize(FloatUtils.interpolate(width, to.width, t),
-                             FloatUtils.interpolate(height, to.height, t));
-    }
 }
 
--- 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
@@ -4,17 +4,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.gfx;
 
 import org.mozilla.gecko.annotation.RobocopTarget;
 import org.mozilla.gecko.annotation.WrapForJNI;
 import org.mozilla.gecko.EventDispatcher;
 import org.mozilla.gecko.GeckoAppShell;
-import org.mozilla.gecko.util.FloatUtils;
 import org.mozilla.gecko.util.GeckoBundle;
 
 import android.content.Context;
 import android.graphics.Color;
 import android.graphics.Matrix;
 import android.graphics.PointF;
 import android.graphics.RectF;
 import android.os.SystemClock;
@@ -213,20 +212,18 @@ class GeckoLayerClient implements LayerV
     /** The compositor invokes this function just before compositing a frame where the document
       * is different from the document composited on the last frame. In these cases, the viewport
       * information we have in Java is no longer valid and needs to be replaced with the new
       * viewport information provided.
       */
     @WrapForJNI(calledFrom = "ui")
     public void updateRootFrameMetrics(float scrollX, float scrollY, float zoom,
             float cssPageLeft, float cssPageTop, float cssPageRight, float cssPageBottom) {
-        RectF cssPageRect = new RectF(cssPageLeft, cssPageTop, cssPageRight, cssPageBottom);
         mViewportMetrics = mViewportMetrics.setViewportOrigin(scrollX, scrollY)
-            .setZoomFactor(zoom)
-            .setPageRect(RectUtils.scale(cssPageRect, zoom), cssPageRect);
+            .setZoomFactor(zoom);
 
         mToolbarAnimator.onMetricsChanged(mViewportMetrics);
         mContentDocumentIsDisplayed = true;
     }
 
     class PointerInfo {
         // We reserve one pointer ID for the mouse, so that tests don't have
         // to worry about tracking pointer IDs if they just want to test mouse
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/ImmutableViewportMetrics.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/ImmutableViewportMetrics.java
@@ -1,74 +1,47 @@
 /* -*- 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.PointF;
 import android.graphics.RectF;
 import android.util.DisplayMetrics;
 
 /**
  * ImmutableViewportMetrics are used to store the viewport metrics
  * in way that we can access a version of them from multiple threads
  * without having to take a lock
  */
 public class ImmutableViewportMetrics {
 
     // We need to flatten the RectF and FloatSize structures
     // because Java doesn't have the concept of const classes
-    public final float pageRectLeft;
-    public final float pageRectTop;
-    public final float pageRectRight;
-    public final float pageRectBottom;
-    public final float cssPageRectLeft;
-    public final float cssPageRectTop;
-    public final float cssPageRectRight;
-    public final float cssPageRectBottom;
     public final float viewportRectLeft;
     public final float viewportRectTop;
     public final int viewportRectWidth;
     public final int viewportRectHeight;
 
     public final float zoomFactor;
 
     public ImmutableViewportMetrics(DisplayMetrics metrics) {
-        viewportRectLeft   = pageRectLeft   = cssPageRectLeft   = 0;
-        viewportRectTop    = pageRectTop    = cssPageRectTop    = 0;
+        viewportRectLeft   = 0;
+        viewportRectTop    = 0;
         viewportRectWidth = metrics.widthPixels;
         viewportRectHeight = metrics.heightPixels;
-        pageRectRight  = cssPageRectRight  = metrics.widthPixels;
-        pageRectBottom = cssPageRectBottom = metrics.heightPixels;
         zoomFactor = 1.0f;
     }
 
-    /** This constructor is used by native code in AndroidJavaWrappers.cpp, be
-     * careful when modifying the signature.
-     */
-    @WrapForJNI(calledFrom = "gecko")
-    private ImmutableViewportMetrics(float aPageRectLeft, float aPageRectTop,
-        float aPageRectRight, float aPageRectBottom, float aCssPageRectLeft,
-        float aCssPageRectTop, float aCssPageRectRight, float aCssPageRectBottom,
+    private ImmutableViewportMetrics(
         float aViewportRectLeft, float aViewportRectTop, int aViewportRectWidth,
         int aViewportRectHeight, float aZoomFactor)
     {
-        pageRectLeft = aPageRectLeft;
-        pageRectTop = aPageRectTop;
-        pageRectRight = aPageRectRight;
-        pageRectBottom = aPageRectBottom;
-        cssPageRectLeft = aCssPageRectLeft;
-        cssPageRectTop = aCssPageRectTop;
-        cssPageRectRight = aCssPageRectRight;
-        cssPageRectBottom = aCssPageRectBottom;
         viewportRectLeft = aViewportRectLeft;
         viewportRectTop = aViewportRectTop;
         viewportRectWidth = aViewportRectWidth;
         viewportRectHeight = aViewportRectHeight;
         zoomFactor = aZoomFactor;
     }
 
     public float getWidth() {
@@ -97,186 +70,36 @@ public class ImmutableViewportMetrics {
 
     public RectF getViewport() {
         return new RectF(viewportRectLeft,
                          viewportRectTop,
                          viewportRectRight(),
                          viewportRectBottom());
     }
 
-    public RectF getCssViewport() {
-        return RectUtils.scale(getViewport(), 1 / zoomFactor);
-    }
-
-    public RectF getPageRect() {
-        return new RectF(pageRectLeft, pageRectTop, pageRectRight, pageRectBottom);
-    }
-
-    public float getPageWidth() {
-        return pageRectRight - pageRectLeft;
-    }
-
-    public float getPageHeight() {
-        return pageRectBottom - pageRectTop;
-    }
-
-    public RectF getCssPageRect() {
-        return new RectF(cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom);
-    }
-
-    public RectF getOverscroll() {
-        return new RectF(Math.max(0, pageRectLeft - viewportRectLeft),
-                         Math.max(0, pageRectTop - viewportRectTop),
-                         Math.max(0, viewportRectRight() - pageRectRight),
-                         Math.max(0, viewportRectBottom() - pageRectBottom));
-    }
-
-    /*
-     * Returns the viewport metrics that represent a linear transition between "this" and "to" at
-     * time "t", which is on the scale [0, 1). This function interpolates all values stored in
-     * the viewport metrics.
-     */
-    public ImmutableViewportMetrics interpolate(ImmutableViewportMetrics to, float t) {
-        return new ImmutableViewportMetrics(
-            FloatUtils.interpolate(pageRectLeft, to.pageRectLeft, t),
-            FloatUtils.interpolate(pageRectTop, to.pageRectTop, t),
-            FloatUtils.interpolate(pageRectRight, to.pageRectRight, t),
-            FloatUtils.interpolate(pageRectBottom, to.pageRectBottom, t),
-            FloatUtils.interpolate(cssPageRectLeft, to.cssPageRectLeft, t),
-            FloatUtils.interpolate(cssPageRectTop, to.cssPageRectTop, t),
-            FloatUtils.interpolate(cssPageRectRight, to.cssPageRectRight, t),
-            FloatUtils.interpolate(cssPageRectBottom, to.cssPageRectBottom, t),
-            FloatUtils.interpolate(viewportRectLeft, to.viewportRectLeft, t),
-            FloatUtils.interpolate(viewportRectTop, to.viewportRectTop, t),
-            (int)FloatUtils.interpolate(viewportRectWidth, to.viewportRectWidth, t),
-            (int)FloatUtils.interpolate(viewportRectHeight, to.viewportRectHeight, t),
-            FloatUtils.interpolate(zoomFactor, to.zoomFactor, t));
-    }
-
     public ImmutableViewportMetrics setViewportSize(int width, int height) {
         if (width == viewportRectWidth && height == viewportRectHeight) {
             return this;
         }
 
         return new ImmutableViewportMetrics(
-            pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
-            cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
             viewportRectLeft, viewportRectTop, width, height,
             zoomFactor);
     }
 
     public ImmutableViewportMetrics setViewportOrigin(float newOriginX, float newOriginY) {
         return new ImmutableViewportMetrics(
-            pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
-            cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
             newOriginX, newOriginY, viewportRectWidth, viewportRectHeight,
             zoomFactor);
     }
 
     public ImmutableViewportMetrics setZoomFactor(float newZoomFactor) {
         return new ImmutableViewportMetrics(
-            pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
-            cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
             viewportRectLeft, viewportRectTop, viewportRectWidth, viewportRectHeight,
             newZoomFactor);
     }
 
-    public ImmutableViewportMetrics offsetViewportBy(float dx, float dy) {
-        return setViewportOrigin(viewportRectLeft + dx, viewportRectTop + dy);
-    }
-
-    public ImmutableViewportMetrics offsetViewportByAndClamp(float dx, float dy) {
-        return setViewportOrigin(
-            Math.max(pageRectLeft, Math.min(viewportRectLeft + dx, pageRectRight - getWidth())),
-            Math.max(pageRectTop, Math.min(viewportRectTop + dy, pageRectBottom - getHeight())));
-    }
-
-    public ImmutableViewportMetrics setPageRect(RectF pageRect, RectF cssPageRect) {
-        return new ImmutableViewportMetrics(
-            pageRect.left, pageRect.top, pageRect.right, pageRect.bottom,
-            cssPageRect.left, cssPageRect.top, cssPageRect.right, cssPageRect.bottom,
-            viewportRectLeft, viewportRectTop, viewportRectWidth, viewportRectHeight,
-            zoomFactor);
-    }
-
-    public ImmutableViewportMetrics setPageRectFrom(ImmutableViewportMetrics aMetrics) {
-        if (aMetrics.cssPageRectLeft == cssPageRectLeft &&
-            aMetrics.cssPageRectTop == cssPageRectTop &&
-            aMetrics.cssPageRectRight == cssPageRectRight &&
-            aMetrics.cssPageRectBottom == cssPageRectBottom) {
-            return this;
-        }
-        RectF css = aMetrics.getCssPageRect();
-        return setPageRect(RectUtils.scale(css, zoomFactor), css);
-    }
-
-    /* This will set the zoom factor and re-scale page-size and viewport offset
-     * accordingly. The given focus will remain at the same point on the screen
-     * after scaling.
-     */
-    public ImmutableViewportMetrics scaleTo(float newZoomFactor, PointF focus) {
-        // cssPageRect* is invariant, since we're setting the scale factor
-        // here. The page rect is based on the CSS page rect.
-        float newPageRectLeft = cssPageRectLeft * newZoomFactor;
-        float newPageRectTop = cssPageRectTop * newZoomFactor;
-        float newPageRectRight = cssPageRectLeft + ((cssPageRectRight - cssPageRectLeft) * newZoomFactor);
-        float newPageRectBottom = cssPageRectTop + ((cssPageRectBottom - cssPageRectTop) * newZoomFactor);
-
-        PointF origin = getOrigin();
-        origin.offset(focus.x, focus.y);
-        origin = PointUtils.scale(origin, newZoomFactor / zoomFactor);
-        origin.offset(-focus.x, -focus.y);
-
-        return new ImmutableViewportMetrics(
-            newPageRectLeft, newPageRectTop, newPageRectRight, newPageRectBottom,
-            cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
-            origin.x, origin.y, viewportRectWidth, viewportRectHeight,
-            newZoomFactor);
-    }
-
-    /** Clamps the viewport to remain within the page rect. */
-    public ImmutableViewportMetrics clamp() {
-        RectF newViewport = getViewport();
-
-        // The viewport bounds ought to never exceed the page bounds.
-        if (newViewport.right > pageRectRight)
-            newViewport.offset((pageRectRight) - newViewport.right, 0);
-        if (newViewport.left < pageRectLeft)
-            newViewport.offset(pageRectLeft - newViewport.left, 0);
-
-        if (newViewport.bottom > pageRectBottom)
-            newViewport.offset(0, (pageRectBottom) - newViewport.bottom);
-        if (newViewport.top < pageRectTop)
-            newViewport.offset(0, pageRectTop - newViewport.top);
-
-        // Note that since newViewport is only translated around, the viewport's
-        // width and height are unchanged.
-        return new ImmutableViewportMetrics(
-            pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
-            cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
-            newViewport.left, newViewport.top, viewportRectWidth, viewportRectHeight,
-            zoomFactor);
-    }
-
-    public boolean fuzzyEquals(ImmutableViewportMetrics other) {
-        // Don't bother checking the pageRectXXX values because they are a product
-        // of the cssPageRectXXX values and the zoomFactor, except with more rounding
-        // error. Checking those is both inefficient and can lead to false negatives.
-        return FloatUtils.fuzzyEquals(cssPageRectLeft, other.cssPageRectLeft)
-            && FloatUtils.fuzzyEquals(cssPageRectTop, other.cssPageRectTop)
-            && FloatUtils.fuzzyEquals(cssPageRectRight, other.cssPageRectRight)
-            && FloatUtils.fuzzyEquals(cssPageRectBottom, other.cssPageRectBottom)
-            && FloatUtils.fuzzyEquals(viewportRectLeft, other.viewportRectLeft)
-            && FloatUtils.fuzzyEquals(viewportRectTop, other.viewportRectTop)
-            && viewportRectWidth == other.viewportRectWidth
-            && viewportRectHeight == other.viewportRectHeight
-            && FloatUtils.fuzzyEquals(zoomFactor, other.zoomFactor);
-    }
-
     @Override
     public String toString() {
         return "ImmutableViewportMetrics v=(" + viewportRectLeft + "," + viewportRectTop + ","
-                + viewportRectWidth + "x" + viewportRectHeight + ") p=(" + pageRectLeft + ","
-                + pageRectTop + "," + pageRectRight + "," + pageRectBottom + ") c=("
-                + cssPageRectLeft + "," + cssPageRectTop + "," + cssPageRectRight + ","
-                + cssPageRectBottom + ") z=" + zoomFactor;
+                + viewportRectWidth + "x" + viewportRectHeight + ") z=" + zoomFactor;
     }
 }
deleted file mode 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/RectUtils.java
+++ /dev/null
@@ -1,126 +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.util.FloatUtils;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import android.graphics.Point;
-import android.graphics.PointF;
-import android.graphics.Rect;
-import android.graphics.RectF;
-
-public final class RectUtils {
-    private RectUtils() {}
-
-    public static Rect create(JSONObject json) {
-        try {
-            int x = json.getInt("x");
-            int y = json.getInt("y");
-            int width = json.getInt("width");
-            int height = json.getInt("height");
-            return new Rect(x, y, x + width, y + height);
-        } catch (JSONException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    public static String toJSON(RectF rect) {
-        StringBuilder sb = new StringBuilder(256);
-        sb.append("{ \"left\": ").append(rect.left)
-          .append(", \"top\": ").append(rect.top)
-          .append(", \"right\": ").append(rect.right)
-          .append(", \"bottom\": ").append(rect.bottom)
-          .append('}');
-        return sb.toString();
-    }
-
-    public static RectF expand(RectF rect, float moreWidth, float moreHeight) {
-        float halfMoreWidth = moreWidth / 2;
-        float halfMoreHeight = moreHeight / 2;
-        return new RectF(rect.left - halfMoreWidth,
-                         rect.top - halfMoreHeight,
-                         rect.right + halfMoreWidth,
-                         rect.bottom + halfMoreHeight);
-    }
-
-    public static RectF contract(RectF rect, float lessWidth, float lessHeight) {
-        float halfLessWidth = lessWidth / 2.0f;
-        float halfLessHeight = lessHeight / 2.0f;
-        return new RectF(rect.left + halfLessWidth,
-                         rect.top + halfLessHeight,
-                         rect.right - halfLessWidth,
-                         rect.bottom - halfLessHeight);
-    }
-
-    public static RectF intersect(RectF one, RectF two) {
-        float left = Math.max(one.left, two.left);
-        float top = Math.max(one.top, two.top);
-        float right = Math.min(one.right, two.right);
-        float bottom = Math.min(one.bottom, two.bottom);
-        return new RectF(left, top, Math.max(right, left), Math.max(bottom, top));
-    }
-
-    public static RectF scale(RectF rect, float scale) {
-        float x = rect.left * scale;
-        float y = rect.top * scale;
-        return new RectF(x, y,
-                         x + (rect.width() * scale),
-                         y + (rect.height() * scale));
-    }
-
-    public static RectF scaleAndRound(RectF rect, float scale) {
-        float left = rect.left * scale;
-        float top = rect.top * scale;
-        return new RectF(Math.round(left),
-                         Math.round(top),
-                         Math.round(left + (rect.width() * scale)),
-                         Math.round(top + (rect.height() * scale)));
-    }
-
-    /** Returns the nearest integer rect of the given rect. */
-    public static Rect round(RectF rect) {
-        Rect r = new Rect();
-        round(rect, r);
-        return r;
-    }
-
-    public static void round(RectF rect, Rect dest) {
-        dest.set(Math.round(rect.left), Math.round(rect.top),
-                 Math.round(rect.right), Math.round(rect.bottom));
-    }
-
-    public static Rect roundIn(RectF rect) {
-        return new Rect((int)Math.ceil(rect.left), (int)Math.ceil(rect.top),
-                        (int)Math.floor(rect.right), (int)Math.floor(rect.bottom));
-    }
-
-    public static IntSize getSize(Rect rect) {
-        return new IntSize(rect.width(), rect.height());
-    }
-
-    public static Point getOrigin(Rect rect) {
-        return new Point(rect.left, rect.top);
-    }
-
-    public static PointF getOrigin(RectF rect) {
-        return new PointF(rect.left, rect.top);
-    }
-
-    public static boolean fuzzyEquals(RectF a, RectF b) {
-        if (a == null && b == null)
-            return true;
-        else if ((a == null && b != null) || (a != null && b == null))
-            return false;
-        else
-            return FloatUtils.fuzzyEquals(a.top, b.top)
-                && FloatUtils.fuzzyEquals(a.left, b.left)
-                && FloatUtils.fuzzyEquals(a.right, b.right)
-                && FloatUtils.fuzzyEquals(a.bottom, b.bottom);
-    }
-}
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/FloatUtils.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/FloatUtils.java
@@ -1,43 +1,16 @@
 /* -*- 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.util;
 
-import android.graphics.PointF;
-
 import java.lang.IllegalArgumentException;
 
 public final class FloatUtils {
     private FloatUtils() {}
 
     public static boolean fuzzyEquals(float a, float b) {
         return (Math.abs(a - b) < 1e-6);
     }
-
-    public static boolean fuzzyEquals(PointF a, PointF b) {
-        return fuzzyEquals(a.x, b.x) && fuzzyEquals(a.y, b.y);
-    }
-
-    /*
-     * Returns the value that represents a linear transition between `from` and `to` at time `t`,
-     * which is on the scale [0, 1). Thus with t = 0.0f, this returns `from`; with t = 1.0f, this
-     * returns `to`; with t = 0.5f, this returns the value halfway from `from` to `to`.
-     */
-    public static float interpolate(float from, float to, float t) {
-        return from + (to - from) * t;
-    }
-
-    /**
-     * Returns 'value', clamped so that it isn't any lower than 'low', and it
-     * isn't any higher than 'high'.
-     */
-    public static float clamp(float value, float low, float high) {
-        if (high < low) {
-          throw new IllegalArgumentException(
-              "clamp called with invalid parameters (" + high + " < " + low + ")" );
-        }
-        return Math.max(low, Math.min(high, value));
-    }
 }
--- a/mobile/android/tests/background/junit4/src/org/mozilla/gecko/util/TestFloatUtils.java
+++ b/mobile/android/tests/background/junit4/src/org/mozilla/gecko/util/TestFloatUtils.java
@@ -46,31 +46,9 @@ public class TestFloatUtils {
     public void testEqualSuccessIfPromoted() {
         assertTrue(FloatUtils.fuzzyEquals(5, 5));
     }
 
     @Test
     public void testEqualSuccessIfUnPromoted() {
         assertTrue(FloatUtils.fuzzyEquals(5.6f, 5.6f));
     }
-
-    @Test
-    public void testClampSuccess() {
-        assertEquals(3, FloatUtils.clamp(3, 1, 5), 0);
-    }
-
-    @Test(expected = IllegalArgumentException.class)
-    public void testClampFail() {
-        FloatUtils.clamp(3, 5, 1);
-    }
-
-    @Test
-    public void testInterpolateSuccess() {
-        assertEquals(4f ,FloatUtils.interpolate(1, 2, 3), 0f);
-    }
-
-    @Test
-    public void testInterpolateFail() {
-        assertNotEquals(3f ,FloatUtils.interpolate(1, 2, 3), 0f);
-    }
-
-
 }
--- a/widget/android/GeneratedJNIWrappers.cpp
+++ b/widget/android/GeneratedJNIWrappers.cpp
@@ -1164,27 +1164,16 @@ auto GeckoSurfaceTexture::ReleaseTexImag
 constexpr char GeckoSurfaceTexture::UpdateTexImage_t::name[];
 constexpr char GeckoSurfaceTexture::UpdateTexImage_t::signature[];
 
 auto GeckoSurfaceTexture::UpdateTexImage() const -> void
 {
     return mozilla::jni::Method<UpdateTexImage_t>::Call(GeckoSurfaceTexture::mCtx, nullptr);
 }
 
-const char ImmutableViewportMetrics::name[] =
-        "org/mozilla/gecko/gfx/ImmutableViewportMetrics";
-
-constexpr char ImmutableViewportMetrics::New_t::name[];
-constexpr char ImmutableViewportMetrics::New_t::signature[];
-
-auto ImmutableViewportMetrics::New(float a0, float a1, float a2, float a3, float a4, float a5, float a6, float a7, float a8, float a9, int32_t a10, int32_t a11, float a12) -> ImmutableViewportMetrics::LocalRef
-{
-    return mozilla::jni::Constructor<New_t>::Call(ImmutableViewportMetrics::Context(), nullptr, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
-}
-
 const char LayerView::name[] =
         "org/mozilla/gecko/gfx/LayerView";
 
 constexpr char LayerView::GetCompositor_t::name[];
 constexpr char LayerView::GetCompositor_t::signature[];
 
 auto LayerView::GetCompositor() const -> mozilla::jni::Object::LocalRef
 {
--- a/widget/android/GeneratedJNIWrappers.h
+++ b/widget/android/GeneratedJNIWrappers.h
@@ -3599,60 +3599,16 @@ public:
     auto UpdateTexImage() const -> void;
 
     static const mozilla::jni::CallingThread callingThread =
             mozilla::jni::CallingThread::ANY;
 
     template<class Impl> class Natives;
 };
 
-class ImmutableViewportMetrics : public mozilla::jni::ObjectBase<ImmutableViewportMetrics>
-{
-public:
-    static const char name[];
-
-    explicit ImmutableViewportMetrics(const Context& ctx) : ObjectBase<ImmutableViewportMetrics>(ctx) {}
-
-    struct New_t {
-        typedef ImmutableViewportMetrics Owner;
-        typedef ImmutableViewportMetrics::LocalRef ReturnType;
-        typedef ImmutableViewportMetrics::Param SetterType;
-        typedef mozilla::jni::Args<
-                float,
-                float,
-                float,
-                float,
-                float,
-                float,
-                float,
-                float,
-                float,
-                float,
-                int32_t,
-                int32_t,
-                float> Args;
-        static constexpr char name[] = "<init>";
-        static constexpr char signature[] =
-                "(FFFFFFFFFFIIF)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, float, float, float, float, float, int32_t, int32_t, float) -> ImmutableViewportMetrics::LocalRef;
-
-    static const mozilla::jni::CallingThread callingThread =
-            mozilla::jni::CallingThread::GECKO;
-
-};
-
 class LayerView : public mozilla::jni::ObjectBase<LayerView>
 {
 public:
     static const char name[];
 
     explicit LayerView(const Context& ctx) : ObjectBase<LayerView>(ctx) {}
 
     class Compositor;