From 9637f916547b7b0b761e39adc77047076e7a3f74 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Wed, 1 Aug 2012 10:38:30 -0400 Subject: [PATCH] Bug 777075 - Remove notifyLayerClientOfGeometryChange from the PanZoomTarget interface by baking it into setViewportMetrics and setForceRedraw. r=mbrubeck --- mobile/android/base/GeckoAppShell.java | 2 +- mobile/android/base/gfx/LayerController.java | 14 +++++--------- mobile/android/base/ui/PanZoomController.java | 9 --------- mobile/android/base/ui/PanZoomTarget.java | 2 -- 4 files changed, 6 insertions(+), 21 deletions(-) diff --git a/mobile/android/base/GeckoAppShell.java b/mobile/android/base/GeckoAppShell.java index 9a5014c10a8..87e4221ce4a 100644 --- a/mobile/android/base/GeckoAppShell.java +++ b/mobile/android/base/GeckoAppShell.java @@ -543,7 +543,7 @@ public class GeckoAppShell final LayerController layerController = GeckoApp.mAppContext.getLayerController(); LayerView v = layerController.getView(); mInputConnection = v.setInputConnectionHandler(); - layerController.notifyLayerClientOfGeometryChange(); + layerController.setForceRedraw(); } static void sendPendingEventsToGecko() { diff --git a/mobile/android/base/gfx/LayerController.java b/mobile/android/base/gfx/LayerController.java index 1337e97d376..0fbe565a621 100644 --- a/mobile/android/base/gfx/LayerController.java +++ b/mobile/android/base/gfx/LayerController.java @@ -89,6 +89,7 @@ public class LayerController implements PanZoomTarget { public void setForceRedraw() { mForceRedraw = true; + notifyLayerClientOfGeometryChange(); } public Layer getRoot() { return mRootLayer; } @@ -161,14 +162,13 @@ public class LayerController implements PanZoomTarget { } /** - * Sets the entire viewport metrics at once. This function does not notify the layer client or - * the pan/zoom controller, so you will need to call notifyLayerClientOfGeometryChange() or - * notifyPanZoomControllerOfGeometryChange() after calling this. You must hold the monitor - * while calling this. + * Sets the entire viewport metrics at once. + * You must hold the monitor while calling this. */ public void setViewportMetrics(ViewportMetrics viewport) { mViewportMetrics = new ImmutableViewportMetrics(viewport); mView.requestRender(); + notifyLayerClientOfGeometryChange(); } public void setAnimationTarget(ViewportMetrics viewport) { @@ -185,11 +185,7 @@ public class LayerController implements PanZoomTarget { public boolean post(Runnable action) { return mView.post(action); } - /** - * The view as well as the controller itself use this method to notify the layer client that - * the geometry changed. - */ - public void notifyLayerClientOfGeometryChange() { + private void notifyLayerClientOfGeometryChange() { if (mLayerClient != null) mLayerClient.geometryChanged(); } diff --git a/mobile/android/base/ui/PanZoomController.java b/mobile/android/base/ui/PanZoomController.java index 2543d00199b..463a2cf7b0e 100644 --- a/mobile/android/base/ui/PanZoomController.java +++ b/mobile/android/base/ui/PanZoomController.java @@ -283,7 +283,6 @@ public class PanZoomController // transitions. synchronized (mTarget.getLock()) { mTarget.setViewportMetrics(getValidViewportMetrics()); - mTarget.notifyLayerClientOfGeometryChange(); } break; } @@ -321,7 +320,6 @@ public class PanZoomController // page size changed such that we are now in overscroll. snap to the // the nearest valid viewport mTarget.setViewportMetrics(validated); - mTarget.notifyLayerClientOfGeometryChange(); } } } @@ -342,7 +340,6 @@ public class PanZoomController // case this touchstart is just a tap that doesn't end up triggering // a redraw mTarget.setForceRedraw(); - mTarget.notifyLayerClientOfGeometryChange(); // fall through case FLING: case BOUNCE: @@ -548,7 +545,6 @@ public class PanZoomController viewportMetrics.setOrigin(origin); mTarget.setViewportMetrics(viewportMetrics); - mTarget.notifyLayerClientOfGeometryChange(); } private void fling() { @@ -716,7 +712,6 @@ public class PanZoomController float t = ZOOM_ANIMATION_FRAMES[mBounceFrame]; ViewportMetrics newMetrics = mBounceStartMetrics.interpolate(mBounceEndMetrics, t); mTarget.setViewportMetrics(newMetrics); - mTarget.notifyLayerClientOfGeometryChange(); mBounceFrame++; } } @@ -725,7 +720,6 @@ public class PanZoomController private void finishBounce() { synchronized (mTarget.getLock()) { mTarget.setViewportMetrics(mBounceEndMetrics); - mTarget.notifyLayerClientOfGeometryChange(); mBounceFrame = -1; } } @@ -787,7 +781,6 @@ public class PanZoomController // Force a viewport synchronisation mTarget.setForceRedraw(); - mTarget.notifyLayerClientOfGeometryChange(); } /* Returns the nearest viewport metrics with no overscroll visible. */ @@ -974,7 +967,6 @@ public class PanZoomController // Force a viewport synchronisation mTarget.setForceRedraw(); - mTarget.notifyLayerClientOfGeometryChange(); } /** @@ -985,7 +977,6 @@ public class PanZoomController ViewportMetrics viewportMetrics = getMutableMetrics(); viewportMetrics.scaleTo(zoomFactor, focus); mTarget.setViewportMetrics(viewportMetrics); - mTarget.notifyLayerClientOfGeometryChange(); } public boolean getRedrawHint() { diff --git a/mobile/android/base/ui/PanZoomTarget.java b/mobile/android/base/ui/PanZoomTarget.java index 5d239755e79..ac4b6c48e9e 100644 --- a/mobile/android/base/ui/PanZoomTarget.java +++ b/mobile/android/base/ui/PanZoomTarget.java @@ -17,8 +17,6 @@ public interface PanZoomTarget { public void setAnimationTarget(ViewportMetrics viewport); public void setViewportMetrics(ViewportMetrics viewport); - - public void notifyLayerClientOfGeometryChange(); public void setForceRedraw(); public boolean post(Runnable action);