Bug 809199 - Update createViewportEvent to take an ImmutableViewportMetrics. r=Cwiiis

This commit is contained in:
Kartikaya Gupta 2012-11-07 11:47:08 -05:00
parent 7d92cc7bef
commit d03b60194c
2 changed files with 7 additions and 8 deletions

View File

@ -6,7 +6,7 @@
package org.mozilla.gecko;
import org.mozilla.gecko.gfx.DisplayPortMetrics;
import org.mozilla.gecko.gfx.ViewportMetrics;
import org.mozilla.gecko.gfx.ImmutableViewportMetrics;
import android.content.res.Resources;
import android.graphics.Point;
@ -527,14 +527,13 @@ public class GeckoEvent {
return event;
}
public static GeckoEvent createViewportEvent(ViewportMetrics viewport, DisplayPortMetrics displayPort) {
public static GeckoEvent createViewportEvent(ImmutableViewportMetrics metrics, DisplayPortMetrics displayPort) {
GeckoEvent event = new GeckoEvent(VIEWPORT);
event.mCharacters = "Viewport:Change";
PointF origin = viewport.getOrigin();
StringBuffer sb = new StringBuffer(256);
sb.append("{ \"x\" : ").append(origin.x)
.append(", \"y\" : ").append(origin.y)
.append(", \"zoom\" : ").append(viewport.getZoomFactor())
sb.append("{ \"x\" : ").append(metrics.viewportRectLeft)
.append(", \"y\" : ").append(metrics.viewportRectTop)
.append(", \"zoom\" : ").append(metrics.zoomFactor)
.append(", \"displayPort\" :").append(displayPort.toJSON())
.append('}');
event.mCharactersExtra = sb.toString();

View File

@ -268,14 +268,14 @@ public class GeckoLayerClient
private void adjustViewport(DisplayPortMetrics displayPort) {
ImmutableViewportMetrics metrics = getViewportMetrics();
ViewportMetrics clampedMetrics = new ViewportMetrics(metrics.clamp());
ImmutableViewportMetrics clampedMetrics = metrics.clamp();
if (displayPort == null) {
displayPort = DisplayPortCalculator.calculate(metrics, mPanZoomController.getVelocityVector());
}
mDisplayPort = displayPort;
mGeckoViewport = clampedMetrics;
mGeckoViewport = new ViewportMetrics(clampedMetrics);
if (mRecordDrawTimes) {
mDrawTimingQueue.add(displayPort);