mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 709817 - (Cleanup) Replace geometryChanged() with abortAnimation() and remove dead calls. r=pcwalton
Since the geometryChanged function does nothing if the parameter passed in is false, better to rename the function to be more indicative of what it actually does, and remove all the resulting dead code.
This commit is contained in:
parent
faf9f73950
commit
6a504879ae
@ -133,7 +133,6 @@ public class GeckoSoftwareLayerClient extends LayerClient implements GeckoEventL
|
||||
layerController.setRoot(mTileLayer);
|
||||
if (mGeckoViewport != null) {
|
||||
layerController.setViewportMetrics(mGeckoViewport);
|
||||
layerController.notifyPanZoomControllerOfGeometryChange(false);
|
||||
}
|
||||
|
||||
GeckoAppShell.registerGeckoEventListener("Viewport:Update", this);
|
||||
@ -171,7 +170,7 @@ public class GeckoSoftwareLayerClient extends LayerClient implements GeckoEventL
|
||||
} else {
|
||||
Log.d(LOGTAG, "Received viewport update from gecko");
|
||||
controller.setViewportMetrics(mGeckoViewport);
|
||||
controller.notifyPanZoomControllerOfGeometryChange(true);
|
||||
controller.abortPanZoomAnimation();
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
|
@ -174,7 +174,7 @@ public class LayerController {
|
||||
mLayerClient.viewportSizeChanged();
|
||||
|
||||
notifyLayerClientOfGeometryChange();
|
||||
mPanZoomController.geometryChanged(true);
|
||||
mPanZoomController.abortAnimation();
|
||||
mView.requestRender();
|
||||
}
|
||||
|
||||
@ -183,7 +183,6 @@ public class LayerController {
|
||||
mViewportMetrics.setOrigin(point);
|
||||
Log.d(LOGTAG, "scrollTo: " + mViewportMetrics);
|
||||
notifyLayerClientOfGeometryChange();
|
||||
mPanZoomController.geometryChanged(false);
|
||||
GeckoApp.mAppContext.repositionPluginViews(false);
|
||||
mView.requestRender();
|
||||
}
|
||||
@ -196,7 +195,6 @@ public class LayerController {
|
||||
Log.d(LOGTAG, "scrollBy: " + mViewportMetrics);
|
||||
|
||||
notifyLayerClientOfGeometryChange();
|
||||
mPanZoomController.geometryChanged(false);
|
||||
GeckoApp.mAppContext.repositionPluginViews(false);
|
||||
mView.requestRender();
|
||||
}
|
||||
@ -206,7 +204,6 @@ public class LayerController {
|
||||
mViewportMetrics.setViewport(viewport);
|
||||
Log.d(LOGTAG, "setViewport: " + mViewportMetrics);
|
||||
notifyLayerClientOfGeometryChange();
|
||||
mPanZoomController.geometryChanged(false);
|
||||
GeckoApp.mAppContext.repositionPluginViews(false);
|
||||
mView.requestRender();
|
||||
}
|
||||
@ -221,7 +218,6 @@ public class LayerController {
|
||||
|
||||
// Page size is owned by the LayerClient, so no need to notify it of
|
||||
// this change.
|
||||
mPanZoomController.geometryChanged(false);
|
||||
mView.requestRender();
|
||||
}
|
||||
|
||||
@ -283,10 +279,10 @@ public class LayerController {
|
||||
mLayerClient.geometryChanged();
|
||||
}
|
||||
|
||||
/** Informs the pan/zoom controller that the viewport metrics changed. */
|
||||
public void notifyPanZoomControllerOfGeometryChange(boolean abortAnimation) {
|
||||
/** Aborts any pan/zoom animation that is currently in progress. */
|
||||
public void abortPanZoomAnimation() {
|
||||
if (mPanZoomController != null)
|
||||
mPanZoomController.geometryChanged(abortAnimation);
|
||||
mPanZoomController.abortAnimation();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -153,7 +153,6 @@ public class PlaceholderLayerClient extends LayerClient {
|
||||
if (mViewportUnknown)
|
||||
mViewport.setViewport(layerController.getViewport());
|
||||
layerController.setViewportMetrics(mViewport);
|
||||
layerController.notifyPanZoomControllerOfGeometryChange(false);
|
||||
|
||||
BufferedCairoImage image = new BufferedCairoImage(mBuffer, mWidth, mHeight, mFormat);
|
||||
SingleTileLayer tileLayer = new SingleTileLayer(image);
|
||||
|
@ -248,25 +248,23 @@ public class PanZoomController
|
||||
}
|
||||
}
|
||||
|
||||
public void geometryChanged(boolean abortAnimation) {
|
||||
if (abortAnimation) {
|
||||
// this happens when gecko changes the viewport on us or if the device is rotated.
|
||||
// if that's the case, abort any animation in progress and re-zoom so that the page
|
||||
// snaps to edges. for other cases (where the user's finger(s) are down) don't do
|
||||
// anything special.
|
||||
switch (mState) {
|
||||
case FLING:
|
||||
mX.velocity = mY.velocity = 0.0f;
|
||||
mState = PanZoomState.NOTHING;
|
||||
// fall through
|
||||
case ANIMATED_ZOOM:
|
||||
// the zoom that's in progress likely makes no sense any more (such as if
|
||||
// the screen orientation changed) so abort it and start a new one to
|
||||
// ensure the viewport doesn't contain out-of-bounds areas
|
||||
case NOTHING:
|
||||
bounce();
|
||||
break;
|
||||
}
|
||||
public void abortAnimation() {
|
||||
// this happens when gecko changes the viewport on us or if the device is rotated.
|
||||
// if that's the case, abort any animation in progress and re-zoom so that the page
|
||||
// snaps to edges. for other cases (where the user's finger(s) are down) don't do
|
||||
// anything special.
|
||||
switch (mState) {
|
||||
case FLING:
|
||||
mX.velocity = mY.velocity = 0.0f;
|
||||
mState = PanZoomState.NOTHING;
|
||||
// fall through
|
||||
case ANIMATED_ZOOM:
|
||||
// the zoom that's in progress likely makes no sense any more (such as if
|
||||
// the screen orientation changed) so abort it and start a new one to
|
||||
// ensure the viewport doesn't contain out-of-bounds areas
|
||||
case NOTHING:
|
||||
bounce();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user