Bug 813311 - Hide Axis so that it is not unnecessarily exposed to the world. r=Cwiiis
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 20 Nov 2012 13:38:47 -0500
changeset 113802 fae73eb102d5bd405582d77704bf44a895697d73
parent 113801 3a2e859e77d2d581bc133903c92834057ac60389
child 113803 fb729e54421e96f8424704a4930c5bafceefafdd
push id23890
push userryanvm@gmail.com
push dateWed, 21 Nov 2012 02:43:32 +0000
treeherdermozilla-central@4f19e7fd8bea [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersCwiiis
bugs813311
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 813311 - Hide Axis so that it is not unnecessarily exposed to the world. r=Cwiiis
mobile/android/base/gfx/GeckoLayerClient.java
mobile/android/base/ui/Axis.java
mobile/android/base/ui/PanZoomController.java
--- a/mobile/android/base/gfx/GeckoLayerClient.java
+++ b/mobile/android/base/gfx/GeckoLayerClient.java
@@ -8,17 +8,16 @@ package org.mozilla.gecko.gfx;
 import org.mozilla.gecko.BrowserApp;
 import org.mozilla.gecko.GeckoAppShell;
 import org.mozilla.gecko.GeckoEvent;
 import org.mozilla.gecko.GeckoApp;
 import org.mozilla.gecko.ScreenshotHandler;
 import org.mozilla.gecko.Tab;
 import org.mozilla.gecko.Tabs;
 import org.mozilla.gecko.ZoomConstraints;
-import org.mozilla.gecko.ui.Axis;
 import org.mozilla.gecko.ui.PanZoomController;
 import org.mozilla.gecko.ui.PanZoomTarget;
 import org.mozilla.gecko.util.EventDispatcher;
 import org.mozilla.gecko.util.FloatUtils;
 import org.mozilla.gecko.util.GeckoEventResponder;
 
 import org.json.JSONException;
 import org.json.JSONObject;
@@ -686,22 +685,18 @@ public class GeckoLayerClient
     }
 
     private void setShadowVisibility() {
         GeckoApp.mAppContext.mMainHandler.post(new Runnable() {
             public void run() {
                 if (BrowserApp.mBrowserToolbar == null) {
                     return;
                 }
-                Axis.Overscroll overscroll = mPanZoomController.getOverscrollY();
-                if (overscroll == Axis.Overscroll.PLUS || overscroll == Axis.Overscroll.NONE) {
-                    BrowserApp.mBrowserToolbar.setShadowVisibility(true);
-                } else {
-                    BrowserApp.mBrowserToolbar.setShadowVisibility(false);
-                }
+                ImmutableViewportMetrics m = mViewportMetrics;
+                BrowserApp.mBrowserToolbar.setShadowVisibility(m.viewportRectTop >= m.pageRectTop);
             }
         });
     }
 
     /** Implementation of PanZoomTarget */
     public void setForceRedraw() {
         mForceRedraw = true;
         if (mGeckoIsReady) {
--- a/mobile/android/base/ui/Axis.java
+++ b/mobile/android/base/ui/Axis.java
@@ -17,17 +17,17 @@ import java.util.HashMap;
 import java.util.Map;
 
 /**
  * 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.
  */
-public abstract class 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";
@@ -112,17 +112,17 @@ public abstract class Axis {
     }
 
     private enum FlingStates {
         STOPPED,
         PANNING,
         FLINGING,
     }
 
-    public enum Overscroll {
+    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;
 
@@ -198,17 +198,17 @@ public abstract class Axis {
 
         mTouchPos = pos;
     }
 
     boolean overscrolled() {
         return getOverscroll() != Overscroll.NONE;
     }
 
-    public Overscroll getOverscroll() {
+    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;
--- a/mobile/android/base/ui/PanZoomController.java
+++ b/mobile/android/base/ui/PanZoomController.java
@@ -1056,13 +1056,9 @@ public class PanZoomController
     public void setOverScrollMode(int overscrollMode) {
         mX.setOverScrollMode(overscrollMode);
         mY.setOverScrollMode(overscrollMode);
     }
 
     public int getOverScrollMode() {
         return mX.getOverScrollMode();
     }
-
-    public Axis.Overscroll getOverscrollY() {
-        return mY.getOverscroll();
-    }
 }