[Libreoffice-commits] core.git: Branch 'feature/tiled-editing' - android/experimental

Tomaž Vajngerl tomaz.vajngerl at collabora.co.uk
Fri Jan 16 04:21:32 PST 2015


 android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java |   46 +++-------
 1 file changed, 16 insertions(+), 30 deletions(-)

New commits:
commit fab02dacc38ccfedac3ed2c049d8493367fb8ebf
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
Date:   Fri Jan 16 21:20:22 2015 +0900

    android: cleanup GeckoLayerClient
    
    Change-Id: If9a7c50249c9e44dce1a8e3c02a8b2f568dedfb1

diff --git a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
index 3e70698..1006383 100644
--- a/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
+++ b/android/experimental/LOAndroid3/src/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
@@ -147,10 +147,6 @@ public class GeckoLayerClient implements PanZoomTarget, LayerView.Listener {
         return mView;
     }
 
-    public FloatSize getViewportSize() {
-        return mViewportMetrics.getSize();
-    }
-
     /**
      * The view calls this function to indicate that the viewport changed size. It must hold the
      * monitor while calling it.
@@ -220,7 +216,7 @@ public class GeckoLayerClient implements PanZoomTarget, LayerView.Listener {
         ImmutableViewportMetrics clampedMetrics = metrics.clamp();
 
         if (displayPort == null) {
-            displayPort = DisplayPortCalculator.calculate(metrics, getPanZoomController().getVelocityVector());
+            displayPort = DisplayPortCalculator.calculate(metrics, mPanZoomController.getVelocityVector());
         }
 
         mDisplayPort = displayPort;
@@ -280,7 +276,7 @@ public class GeckoLayerClient implements PanZoomTarget, LayerView.Listener {
         synchronized (this) {
             try {
                 mNewGeckoViewport = viewportMetrics;
-                updateViewport(true);
+                updateViewport();
                 mLowResLayer.invalidate();
                 mRootLayer.invalidate();
             } finally {
@@ -290,12 +286,12 @@ public class GeckoLayerClient implements PanZoomTarget, LayerView.Listener {
         }
     }
 
-    protected void updateViewport(boolean onlyUpdatePageSize) {
+    protected void updateViewport() {
         // save and restore the viewport size stored in java; never let the
         // JS-side viewport dimensions override the java-side ones because
         // java is the One True Source of this information, and allowing JS
         // to override can lead to race conditions where this data gets clobbered.
-        FloatSize viewportSize = getViewportSize();
+        FloatSize viewportSize = mViewportMetrics.getSize();
         mGeckoViewport = mNewGeckoViewport.setViewportSize(viewportSize.width, viewportSize.height);
 
         RectF position = mGeckoViewport.getViewport();
@@ -305,15 +301,10 @@ public class GeckoLayerClient implements PanZoomTarget, LayerView.Listener {
         mLowResLayer.setPosition(RectUtils.round(position));
         mLowResLayer.setResolution(mGeckoViewport.zoomFactor);
 
-        if (onlyUpdatePageSize) {
-            // Don't adjust page size when zooming unless zoom levels are
-            // approximately equal.
-            if (FloatUtils.fuzzyEquals(getViewportMetrics().zoomFactor, mGeckoViewport.zoomFactor)) {
-                setPageRect(mGeckoViewport.getPageRect(), mGeckoViewport.getCssPageRect());
-            }
-        } else {
-            setViewportMetrics(mGeckoViewport);
-            abortPanZoomAnimation();
+        // Don't adjust page size when zooming unless zoom levels are
+        // approximately equal.
+        if (FloatUtils.fuzzyEquals(getViewportMetrics().zoomFactor, mGeckoViewport.zoomFactor)) {
+            setPageRect(mGeckoViewport.getPageRect(), mGeckoViewport.getCssPageRect());
         }
     }
 
@@ -397,14 +388,6 @@ public class GeckoLayerClient implements PanZoomTarget, LayerView.Listener {
         }
     }
 
-    public void forceRender() {
-        post(new Runnable() {
-            public void run() {
-                mView.requestRender();
-            }
-        });
-    }
-
     /** Implementation of PanZoomTarget */
     public boolean post(Runnable action) {
         return mView.post(action);
@@ -446,10 +429,6 @@ public class GeckoLayerClient implements PanZoomTarget, LayerView.Listener {
         return layerPoint;
     }
 
-    public ImmutableViewportMetrics getGeckoViewportMetrics() {
-        return mGeckoViewport;
-    }
-
     public void destroy() {
         mPanZoomController.destroy();
     }
@@ -458,7 +437,6 @@ public class GeckoLayerClient implements PanZoomTarget, LayerView.Listener {
         return mContext;
     }
 
-
     public void zoomTo(RectF rect) {
         if (mPanZoomController instanceof JavaPanZoomController) {
             ((JavaPanZoomController) mPanZoomController).animatedZoomTo(rect);
@@ -469,6 +447,14 @@ public class GeckoLayerClient implements PanZoomTarget, LayerView.Listener {
         zoomTo(new RectF(0, 0, pageWidth, pageHeight));
     }
 
+    public void forceRender() {
+        post(new Runnable() {
+            public void run() {
+                mView.requestRender();
+            }
+        });
+    }
+
     private class AdjustRunnable implements Runnable {
         public void run() {
             mPendingViewportAdjust = false;


More information about the Libreoffice-commits mailing list