Bug 701594 - Part 4: Make LayerController.setViewportMetrics() not automatically assume it was called by the layer client. r=kats

This commit is contained in:
Patrick Walton 2011-12-07 10:48:12 -08:00
parent 4e750df483
commit bd59295e9c
3 changed files with 17 additions and 5 deletions

View File

@ -125,8 +125,11 @@ public class GeckoSoftwareLayerClient extends LayerClient implements GeckoEventL
super.setLayerController(layerController);
layerController.setRoot(mTileLayer);
if (mGeckoViewport != null)
if (mGeckoViewport != null) {
layerController.setViewportMetrics(mGeckoViewport);
layerController.notifyPanZoomControllerOfGeometryChange(false);
}
geometryChanged();
GeckoAppShell.registerGeckoEventListener("Viewport:Update", this);
GeckoAppShell.registerGeckoEventListener("Viewport:UpdateLater", this);
@ -166,6 +169,7 @@ public class GeckoSoftwareLayerClient extends LayerClient implements GeckoEventL
controller.setPageSize(mGeckoViewport.getPageSize());
} else {
controller.setViewportMetrics(mGeckoViewport);
controller.notifyPanZoomControllerOfGeometryChange(true);
}
}
});

View File

@ -212,12 +212,13 @@ public class LayerController {
mView.requestRender();
}
/**
* 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.
*/
public void setViewportMetrics(ViewportMetrics viewport) {
mViewportMetrics = new ViewportMetrics(viewport);
// We assume this was called by the LayerClient (as it includes page
// size), so no need to notify it of this change.
mPanZoomController.geometryChanged(true);
GeckoApp.mAppContext.repositionPluginViews(false);
mView.requestRender();
}
@ -256,6 +257,12 @@ public class LayerController {
mLayerClient.geometryChanged();
}
/** Informs the pan/zoom controller that the viewport metrics changed. */
public void notifyPanZoomControllerOfGeometryChange(boolean abortFling) {
if (mPanZoomController != null)
mPanZoomController.geometryChanged(abortFling);
}
/**
* Returns true if this controller is fine with performing a redraw operation or false if it
* would prefer that the action didn't take place.

View File

@ -153,6 +153,7 @@ 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);