Bug 1307522 - Remove a bunch of unnecessary methods from the PanZoomTarget interface now that JPZ is gone. r=snorp
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 04 Oct 2016 14:41:15 -0400
changeset 421221 d1ea0a1e5efb456ae171ad0b672cec080024f8a3
parent 421220 ff4d5455a1b912ce9daffc26e878faefb736b7b9
child 421222 d4ff44952f725161d76fa7e7be32b3be153652fe
push id31424
push userbmo:afarre@mozilla.com
push dateWed, 05 Oct 2016 16:04:50 +0000
reviewerssnorp
bugs1307522
milestone52.0a1
Bug 1307522 - Remove a bunch of unnecessary methods from the PanZoomTarget interface now that JPZ is gone. r=snorp MozReview-Commit-ID: CPIDkGX3jhr
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/LayerView.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/PanZoomTarget.java
--- 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
@@ -262,17 +262,17 @@ class GeckoLayerClient implements LayerV
         if (mViewportMetrics.getCssPageRect().equals(cssRect))
             return;
 
         mViewportMetrics = mViewportMetrics.setPageRect(rect, cssRect);
 
         // Page size is owned by the layer client, so no need to notify it of
         // this change.
 
-        post(new Runnable() {
+        mView.post(new Runnable() {
             @Override
             public void run() {
                 mView.requestRender();
             }
         });
     }
 
     /**
@@ -313,17 +313,17 @@ class GeckoLayerClient implements LayerV
             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 (i.e. mViewportMetrics).
             // Usually this information is updated via handleViewportMessage
             // while we remain on the same document.
-            setViewportMetrics(newMetrics);
+            setViewportMetrics(newMetrics, true);
 
             // 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);
             }
         }
 
@@ -636,47 +636,20 @@ class GeckoLayerClient implements LayerV
 
     /** Implementation of LayerView.Listener */
     @Override
     public void surfaceChanged(int width, int height) {
         IntSize viewportSize = mToolbarAnimator.getViewportSize();
         setViewportSize(viewportSize.width, viewportSize.height, null);
     }
 
-    /** Implementation of PanZoomTarget */
-    @Override
-    public ImmutableViewportMetrics getViewportMetrics() {
+    ImmutableViewportMetrics getViewportMetrics() {
         return mViewportMetrics;
     }
 
-    /** Implementation of PanZoomTarget */
-    @Override
-    public FullScreenState getFullScreenState() {
-        return mView.getFullScreenState();
-    }
-
-    /** Implementation of PanZoomTarget */
-    @Override
-    public PointF getVisibleEndOfLayerView() {
-        return mToolbarAnimator.getVisibleEndOfLayerView();
-    }
-
-    /** Implementation of PanZoomTarget */
-    @Override
-    public void setAnimationTarget(ImmutableViewportMetrics metrics) {
-    }
-
-    /** Implementation of PanZoomTarget
-     * You must hold the monitor while calling this.
-     */
-    @Override
-    public void setViewportMetrics(ImmutableViewportMetrics metrics) {
-        setViewportMetrics(metrics, true);
-    }
-
     /*
      * You must hold the monitor while calling this.
      */
     private void setViewportMetrics(ImmutableViewportMetrics metrics, boolean notifyGecko) {
         // This class owns the viewport size and the fixed layer margins; don't let other pieces
         // of code clobber either of them. The only place the viewport size should ever be
         // updated is in GeckoLayerClient.setViewportSize, and the only place the margins should
         // ever be updated is in GeckoLayerClient.setFixedLayerMargins; both of these assign to
@@ -707,71 +680,34 @@ class GeckoLayerClient implements LayerV
     void forceViewportMetrics(ImmutableViewportMetrics metrics, boolean notifyGecko, boolean forceRedraw) {
         if (forceRedraw) {
             mForceRedraw = true;
         }
         mViewportMetrics = metrics;
         viewportMetricsChanged(notifyGecko);
     }
 
-    /** Implementation of PanZoomTarget
-     * Scroll the viewport by a certain amount. This will take viewport margins
-     * and margin animation into account. If margins are currently animating,
-     * this will just go ahead and modify the viewport origin, otherwise the
-     * delta will be applied to the margins and the remainder will be applied to
-     * the viewport origin.
-     *
-     * You must hold the monitor while calling this.
-     */
-    @Override
-    public void scrollBy(float dx, float dy) {
-        // Set mViewportMetrics manually so the margin changes take.
-        mViewportMetrics = mViewportMetrics.offsetViewportBy(dx, dy);
-        viewportMetricsChanged(true);
-    }
-
     /** Implementation of PanZoomTarget */
     @Override
     public void panZoomStopped() {
         mToolbarAnimator.onPanZoomStopped();
     }
 
-    /** 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);
-    }
-
-    /** Implementation of PanZoomTarget */
-    @Override
-    public void removeRenderTask(RenderTask task) {
-        mView.removeRenderTask(task);
-    }
-
-    /** Implementation of PanZoomTarget */
-    @Override
-    public Object getLock() {
+    Object getLock() {
         return this;
     }
 
-    /** Implementation of PanZoomTarget
+    /**
      * Converts a point from layer view coordinates to layer coordinates. In other words, given a
      * point measured in pixels from the top left corner of the layer view, returns the point in
      * pixels measured from the last scroll position we sent to Gecko, in CSS pixels. Assuming the
      * events being sent to Gecko are processed in FIFO order, this calculation should always be
      * correct.
      */
-    @Override
-    public PointF convertViewPointToLayerPoint(PointF viewPoint) {
+    PointF convertViewPointToLayerPoint(PointF viewPoint) {
         if (!mGeckoIsReady) {
             return null;
         }
 
         ImmutableViewportMetrics viewportMetrics = mViewportMetrics;
         PointF origin = viewportMetrics.getOrigin();
         float zoom = viewportMetrics.zoomFactor;
         ImmutableViewportMetrics geckoViewport = mViewportMetrics;
@@ -785,18 +721,17 @@ class GeckoLayerClient implements LayerV
         // the current Gecko coordinate in CSS pixels.
         PointF layerPoint = new PointF(
                 ((viewPoint.x + origin.x) / zoom) - (geckoOrigin.x / geckoZoom),
                 ((viewPoint.y + origin.y) / zoom) - (geckoOrigin.y / geckoZoom));
 
         return layerPoint;
     }
 
-    @Override
-    public Matrix getMatrixForLayerRectToViewRect() {
+    Matrix getMatrixForLayerRectToViewRect() {
         if (!mGeckoIsReady) {
             return null;
         }
 
         ImmutableViewportMetrics viewportMetrics = mViewportMetrics;
         PointF origin = viewportMetrics.getOrigin();
         float zoom = viewportMetrics.zoomFactor;
         ImmutableViewportMetrics geckoViewport = mViewportMetrics;
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/LayerView.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/LayerView.java
@@ -671,20 +671,16 @@ public class LayerView extends FrameLayo
     public void setFullScreenState(FullScreenState state) {
         mFullScreenState = state;
     }
 
     public boolean isFullScreen() {
         return mFullScreenState != FullScreenState.NONE;
     }
 
-    public FullScreenState getFullScreenState() {
-        return mFullScreenState;
-    }
-
     public void setMaxTranslation(float aMaxTranslation) {
         mToolbarAnimator.setMaxTranslation(aMaxTranslation);
     }
 
     public void setSurfaceTranslation(float translation) {
         setTranslationY(translation);
     }
 
--- 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
@@ -4,26 +4,12 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 package org.mozilla.gecko.gfx;
 
 import android.graphics.Matrix;
 import android.graphics.PointF;
 
 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();
-
     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();
     public void setScrollingRootContent(boolean isRootContent);
 }