mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
merge fx-team to m-c
This commit is contained in:
commit
8f3a02a357
@ -48,6 +48,7 @@ import org.mozilla.gecko.gfx.LayerController;
|
||||
import org.mozilla.gecko.gfx.RectUtils;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONStringer;
|
||||
import android.util.Log;
|
||||
|
||||
/**
|
||||
@ -55,6 +56,8 @@ import android.util.Log;
|
||||
* the page viewport for the Gecko layer client to use.
|
||||
*/
|
||||
public class ViewportMetrics {
|
||||
private static final String LOGTAG = "GeckoViewportMetrics";
|
||||
|
||||
private FloatSize mPageSize;
|
||||
private RectF mViewportRect;
|
||||
private PointF mViewportOffset;
|
||||
@ -232,16 +235,22 @@ public class ViewportMetrics {
|
||||
}
|
||||
|
||||
public String toJSON() {
|
||||
return "{ \"x\" : " + mViewportRect.left +
|
||||
", \"y\" : " + mViewportRect.top +
|
||||
", \"width\" : " + mViewportRect.width() +
|
||||
", \"height\" : " + mViewportRect.height() +
|
||||
", \"pageWidth\" : " + mPageSize.width +
|
||||
", \"pageHeight\" : " + mPageSize.height +
|
||||
", \"offsetX\" : " + mViewportOffset.x +
|
||||
", \"offsetY\" : " + mViewportOffset.y +
|
||||
", \"zoom\" : " + mZoomFactor +
|
||||
" }";
|
||||
try {
|
||||
return new JSONStringer().object()
|
||||
.key("x").value(mViewportRect.left)
|
||||
.key("y").value(mViewportRect.top)
|
||||
.key("width").value(mViewportRect.width())
|
||||
.key("height").value(mViewportRect.height())
|
||||
.key("pageWidth").value(mPageSize.width)
|
||||
.key("pageHeight").value(mPageSize.height)
|
||||
.key("offsetX").value(mViewportOffset.x)
|
||||
.key("offsetY").value(mViewportOffset.y)
|
||||
.key("zoom").value(mZoomFactor)
|
||||
.endObject().toString();
|
||||
} catch (JSONException je) {
|
||||
Log.e(LOGTAG, "Error serializing viewportmetrics", je);
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -811,11 +811,11 @@ public class PanZoomController
|
||||
RectF viewport = viewportMetrics.getViewport();
|
||||
|
||||
float minZoomFactor = 0.0f;
|
||||
if (viewport.width() > pageSize.width) {
|
||||
if (viewport.width() > pageSize.width && pageSize.width > 0) {
|
||||
float scaleFactor = viewport.width() / pageSize.width;
|
||||
minZoomFactor = (float)Math.max(minZoomFactor, zoomFactor * scaleFactor);
|
||||
}
|
||||
if (viewport.height() > pageSize.height) {
|
||||
if (viewport.height() > pageSize.height && pageSize.height > 0) {
|
||||
float scaleFactor = viewport.height() / pageSize.height;
|
||||
minZoomFactor = (float)Math.max(minZoomFactor, zoomFactor * scaleFactor);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user