Bug 1180295 - Store the viewport width and height as integers instead of floats in ImmutableViewportMetrics. r=rbarker
This commit is contained in:
@@ -1602,7 +1602,7 @@ public class BrowserApp extends GeckoApp
|
|||||||
|
|
||||||
boolean shortPage = metrics.getPageHeight() < metrics.getHeight();
|
boolean shortPage = metrics.getPageHeight() < metrics.getHeight();
|
||||||
boolean toolbarMostlyVisible = toolbarTranslation < (mToolbarHeight / 2);
|
boolean toolbarMostlyVisible = toolbarTranslation < (mToolbarHeight / 2);
|
||||||
boolean atBottomOfLongPage = (metrics.pageRectBottom == metrics.viewportRectBottom)
|
boolean atBottomOfLongPage = (metrics.pageRectBottom == metrics.viewportRectBottom())
|
||||||
&& (metrics.pageRectBottom > 2 * metrics.getHeight());
|
&& (metrics.pageRectBottom > 2 * metrics.getHeight());
|
||||||
Log.v(LOGTAG, "On pan/zoom stopped, short page: " + shortPage
|
Log.v(LOGTAG, "On pan/zoom stopped, short page: " + shortPage
|
||||||
+ "; toolbarMostlyVisible: " + toolbarMostlyVisible
|
+ "; toolbarMostlyVisible: " + toolbarMostlyVisible
|
||||||
|
|||||||
@@ -181,8 +181,8 @@ final class DisplayPortCalculator {
|
|||||||
private static DisplayPortMetrics getTileAlignedDisplayPortMetrics(RectF margins, float zoom, ImmutableViewportMetrics metrics) {
|
private static DisplayPortMetrics getTileAlignedDisplayPortMetrics(RectF margins, float zoom, ImmutableViewportMetrics metrics) {
|
||||||
float left = metrics.viewportRectLeft - margins.left;
|
float left = metrics.viewportRectLeft - margins.left;
|
||||||
float top = metrics.viewportRectTop - margins.top;
|
float top = metrics.viewportRectTop - margins.top;
|
||||||
float right = metrics.viewportRectRight + margins.right;
|
float right = metrics.viewportRectRight() + margins.right;
|
||||||
float bottom = metrics.viewportRectBottom + margins.bottom;
|
float bottom = metrics.viewportRectBottom() + margins.bottom;
|
||||||
left = (float) Math.max(metrics.pageRectLeft, TILE_SIZE * Math.floor(left / TILE_SIZE));
|
left = (float) Math.max(metrics.pageRectLeft, TILE_SIZE * Math.floor(left / TILE_SIZE));
|
||||||
top = (float) Math.max(metrics.pageRectTop, TILE_SIZE * Math.floor(top / TILE_SIZE));
|
top = (float) Math.max(metrics.pageRectTop, TILE_SIZE * Math.floor(top / TILE_SIZE));
|
||||||
right = (float) Math.min(metrics.pageRectRight, TILE_SIZE * Math.ceil(right / TILE_SIZE));
|
right = (float) Math.min(metrics.pageRectRight, TILE_SIZE * Math.ceil(right / TILE_SIZE));
|
||||||
@@ -201,9 +201,9 @@ final class DisplayPortCalculator {
|
|||||||
// and rightOverflow can be greater than zero, and at most one of topOverflow and bottomOverflow
|
// and rightOverflow can be greater than zero, and at most one of topOverflow and bottomOverflow
|
||||||
// can be greater than zero, because of the assumption described in the method javadoc.
|
// can be greater than zero, because of the assumption described in the method javadoc.
|
||||||
float leftOverflow = metrics.pageRectLeft - (metrics.viewportRectLeft - margins.left);
|
float leftOverflow = metrics.pageRectLeft - (metrics.viewportRectLeft - margins.left);
|
||||||
float rightOverflow = (metrics.viewportRectRight + margins.right) - metrics.pageRectRight;
|
float rightOverflow = (metrics.viewportRectRight() + margins.right) - metrics.pageRectRight;
|
||||||
float topOverflow = metrics.pageRectTop - (metrics.viewportRectTop - margins.top);
|
float topOverflow = metrics.pageRectTop - (metrics.viewportRectTop - margins.top);
|
||||||
float bottomOverflow = (metrics.viewportRectBottom + margins.bottom) - metrics.pageRectBottom;
|
float bottomOverflow = (metrics.viewportRectBottom() + margins.bottom) - metrics.pageRectBottom;
|
||||||
|
|
||||||
// if the margins overflow the page bounds, shift them to other side on the same axis
|
// if the margins overflow the page bounds, shift them to other side on the same axis
|
||||||
if (leftOverflow > 0) {
|
if (leftOverflow > 0) {
|
||||||
@@ -246,8 +246,8 @@ final class DisplayPortCalculator {
|
|||||||
public DisplayPortMetrics calculate(ImmutableViewportMetrics metrics, PointF velocity) {
|
public DisplayPortMetrics calculate(ImmutableViewportMetrics metrics, PointF velocity) {
|
||||||
return new DisplayPortMetrics(metrics.viewportRectLeft,
|
return new DisplayPortMetrics(metrics.viewportRectLeft,
|
||||||
metrics.viewportRectTop,
|
metrics.viewportRectTop,
|
||||||
metrics.viewportRectRight,
|
metrics.viewportRectRight(),
|
||||||
metrics.viewportRectBottom,
|
metrics.viewportRectBottom(),
|
||||||
metrics.zoomFactor);
|
metrics.zoomFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,8 +445,8 @@ final class DisplayPortCalculator {
|
|||||||
RectF adjustedViewport = new RectF(
|
RectF adjustedViewport = new RectF(
|
||||||
metrics.viewportRectLeft - dangerMargins.left,
|
metrics.viewportRectLeft - dangerMargins.left,
|
||||||
metrics.viewportRectTop - dangerMargins.top,
|
metrics.viewportRectTop - dangerMargins.top,
|
||||||
metrics.viewportRectRight + dangerMargins.right,
|
metrics.viewportRectRight() + dangerMargins.right,
|
||||||
metrics.viewportRectBottom + dangerMargins.bottom);
|
metrics.viewportRectBottom() + dangerMargins.bottom);
|
||||||
return !displayPort.contains(adjustedViewport);
|
return !displayPort.contains(adjustedViewport);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -588,8 +588,8 @@ final class DisplayPortCalculator {
|
|||||||
DisplayPortMetrics dpMetrics = new DisplayPortMetrics(
|
DisplayPortMetrics dpMetrics = new DisplayPortMetrics(
|
||||||
metrics.viewportRectLeft - margins.left,
|
metrics.viewportRectLeft - margins.left,
|
||||||
metrics.viewportRectTop - margins.top,
|
metrics.viewportRectTop - margins.top,
|
||||||
metrics.viewportRectRight + margins.right,
|
metrics.viewportRectRight() + margins.right,
|
||||||
metrics.viewportRectBottom + margins.bottom,
|
metrics.viewportRectBottom() + margins.bottom,
|
||||||
displayResolution);
|
displayResolution);
|
||||||
return dpMetrics;
|
return dpMetrics;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -408,7 +408,7 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
|||||||
default:
|
default:
|
||||||
case UPDATE:
|
case UPDATE:
|
||||||
// Keep the old viewport size
|
// Keep the old viewport size
|
||||||
newMetrics = messageMetrics.setViewportSize(oldMetrics.getWidth(), oldMetrics.getHeight());
|
newMetrics = messageMetrics.setViewportSize(oldMetrics.viewportRectWidth, oldMetrics.viewportRectHeight);
|
||||||
if (!oldMetrics.fuzzyEquals(newMetrics)) {
|
if (!oldMetrics.fuzzyEquals(newMetrics)) {
|
||||||
abortPanZoomAnimation();
|
abortPanZoomAnimation();
|
||||||
}
|
}
|
||||||
@@ -547,8 +547,8 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
|||||||
// the page fall outside of the display-port.
|
// the page fall outside of the display-port.
|
||||||
if (Math.max(viewportMetrics.viewportRectLeft, viewportMetrics.pageRectLeft) + 1 < x ||
|
if (Math.max(viewportMetrics.viewportRectLeft, viewportMetrics.pageRectLeft) + 1 < x ||
|
||||||
Math.max(viewportMetrics.viewportRectTop, viewportMetrics.pageRectTop) + 1 < y ||
|
Math.max(viewportMetrics.viewportRectTop, viewportMetrics.pageRectTop) + 1 < y ||
|
||||||
Math.min(viewportMetrics.viewportRectRight, viewportMetrics.pageRectRight) - 1 > x + width ||
|
Math.min(viewportMetrics.viewportRectRight(), viewportMetrics.pageRectRight) - 1 > x + width ||
|
||||||
Math.min(viewportMetrics.viewportRectBottom, viewportMetrics.pageRectBottom) - 1 > y + height) {
|
Math.min(viewportMetrics.viewportRectBottom(), viewportMetrics.pageRectBottom) - 1 > y + height) {
|
||||||
Log.d(LOGTAG, "Aborting update due to viewport not in display-port");
|
Log.d(LOGTAG, "Aborting update due to viewport not in display-port");
|
||||||
mProgressiveUpdateData.abort = true;
|
mProgressiveUpdateData.abort = true;
|
||||||
|
|
||||||
@@ -850,7 +850,7 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
|||||||
// updated is in GeckoLayerClient.setViewportSize, and the only place the margins should
|
// updated is in GeckoLayerClient.setViewportSize, and the only place the margins should
|
||||||
// ever be updated is in GeckoLayerClient.setFixedLayerMargins; both of these assign to
|
// ever be updated is in GeckoLayerClient.setFixedLayerMargins; both of these assign to
|
||||||
// mViewportMetrics directly.
|
// mViewportMetrics directly.
|
||||||
metrics = metrics.setViewportSize(mViewportMetrics.getWidth(), mViewportMetrics.getHeight());
|
metrics = metrics.setViewportSize(mViewportMetrics.viewportRectWidth, mViewportMetrics.viewportRectHeight);
|
||||||
metrics = metrics.setMarginsFrom(mViewportMetrics);
|
metrics = metrics.setMarginsFrom(mViewportMetrics);
|
||||||
mViewportMetrics = metrics;
|
mViewportMetrics = metrics;
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,9 @@ public class ImmutableViewportMetrics {
|
|||||||
public final float cssPageRectBottom;
|
public final float cssPageRectBottom;
|
||||||
public final float viewportRectLeft;
|
public final float viewportRectLeft;
|
||||||
public final float viewportRectTop;
|
public final float viewportRectTop;
|
||||||
public final float viewportRectRight;
|
public final int viewportRectWidth;
|
||||||
public final float viewportRectBottom;
|
public final int viewportRectHeight;
|
||||||
|
|
||||||
public final float marginLeft;
|
public final float marginLeft;
|
||||||
public final float marginTop;
|
public final float marginTop;
|
||||||
public final float marginRight;
|
public final float marginRight;
|
||||||
@@ -43,8 +44,10 @@ public class ImmutableViewportMetrics {
|
|||||||
public ImmutableViewportMetrics(DisplayMetrics metrics) {
|
public ImmutableViewportMetrics(DisplayMetrics metrics) {
|
||||||
viewportRectLeft = pageRectLeft = cssPageRectLeft = 0;
|
viewportRectLeft = pageRectLeft = cssPageRectLeft = 0;
|
||||||
viewportRectTop = pageRectTop = cssPageRectTop = 0;
|
viewportRectTop = pageRectTop = cssPageRectTop = 0;
|
||||||
viewportRectRight = pageRectRight = cssPageRectRight = metrics.widthPixels;
|
viewportRectWidth = metrics.widthPixels;
|
||||||
viewportRectBottom = pageRectBottom = cssPageRectBottom = metrics.heightPixels;
|
viewportRectHeight = metrics.heightPixels;
|
||||||
|
pageRectRight = cssPageRectRight = metrics.widthPixels;
|
||||||
|
pageRectBottom = cssPageRectBottom = metrics.heightPixels;
|
||||||
marginLeft = marginTop = marginRight = marginBottom = 0;
|
marginLeft = marginTop = marginRight = marginBottom = 0;
|
||||||
zoomFactor = 1.0f;
|
zoomFactor = 1.0f;
|
||||||
isRTL = false;
|
isRTL = false;
|
||||||
@@ -57,21 +60,21 @@ public class ImmutableViewportMetrics {
|
|||||||
public ImmutableViewportMetrics(float aPageRectLeft, float aPageRectTop,
|
public ImmutableViewportMetrics(float aPageRectLeft, float aPageRectTop,
|
||||||
float aPageRectRight, float aPageRectBottom, float aCssPageRectLeft,
|
float aPageRectRight, float aPageRectBottom, float aCssPageRectLeft,
|
||||||
float aCssPageRectTop, float aCssPageRectRight, float aCssPageRectBottom,
|
float aCssPageRectTop, float aCssPageRectRight, float aCssPageRectBottom,
|
||||||
float aViewportRectLeft, float aViewportRectTop, float aViewportRectRight,
|
float aViewportRectLeft, float aViewportRectTop, int aViewportRectWidth,
|
||||||
float aViewportRectBottom, float aZoomFactor)
|
int aViewportRectHeight, float aZoomFactor)
|
||||||
{
|
{
|
||||||
this(aPageRectLeft, aPageRectTop,
|
this(aPageRectLeft, aPageRectTop,
|
||||||
aPageRectRight, aPageRectBottom, aCssPageRectLeft,
|
aPageRectRight, aPageRectBottom, aCssPageRectLeft,
|
||||||
aCssPageRectTop, aCssPageRectRight, aCssPageRectBottom,
|
aCssPageRectTop, aCssPageRectRight, aCssPageRectBottom,
|
||||||
aViewportRectLeft, aViewportRectTop, aViewportRectRight,
|
aViewportRectLeft, aViewportRectTop, aViewportRectWidth,
|
||||||
aViewportRectBottom, 0.0f, 0.0f, 0.0f, 0.0f, aZoomFactor, false);
|
aViewportRectHeight, 0.0f, 0.0f, 0.0f, 0.0f, aZoomFactor, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ImmutableViewportMetrics(float aPageRectLeft, float aPageRectTop,
|
private ImmutableViewportMetrics(float aPageRectLeft, float aPageRectTop,
|
||||||
float aPageRectRight, float aPageRectBottom, float aCssPageRectLeft,
|
float aPageRectRight, float aPageRectBottom, float aCssPageRectLeft,
|
||||||
float aCssPageRectTop, float aCssPageRectRight, float aCssPageRectBottom,
|
float aCssPageRectTop, float aCssPageRectRight, float aCssPageRectBottom,
|
||||||
float aViewportRectLeft, float aViewportRectTop, float aViewportRectRight,
|
float aViewportRectLeft, float aViewportRectTop, int aViewportRectWidth,
|
||||||
float aViewportRectBottom, float aMarginLeft,
|
int aViewportRectHeight, float aMarginLeft,
|
||||||
float aMarginTop, float aMarginRight,
|
float aMarginTop, float aMarginRight,
|
||||||
float aMarginBottom, float aZoomFactor, boolean aIsRTL)
|
float aMarginBottom, float aZoomFactor, boolean aIsRTL)
|
||||||
{
|
{
|
||||||
@@ -85,8 +88,8 @@ public class ImmutableViewportMetrics {
|
|||||||
cssPageRectBottom = aCssPageRectBottom;
|
cssPageRectBottom = aCssPageRectBottom;
|
||||||
viewportRectLeft = aViewportRectLeft;
|
viewportRectLeft = aViewportRectLeft;
|
||||||
viewportRectTop = aViewportRectTop;
|
viewportRectTop = aViewportRectTop;
|
||||||
viewportRectRight = aViewportRectRight;
|
viewportRectWidth = aViewportRectWidth;
|
||||||
viewportRectBottom = aViewportRectBottom;
|
viewportRectHeight = aViewportRectHeight;
|
||||||
marginLeft = aMarginLeft;
|
marginLeft = aMarginLeft;
|
||||||
marginTop = aMarginTop;
|
marginTop = aMarginTop;
|
||||||
marginRight = aMarginRight;
|
marginRight = aMarginRight;
|
||||||
@@ -96,19 +99,27 @@ public class ImmutableViewportMetrics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public float getWidth() {
|
public float getWidth() {
|
||||||
return viewportRectRight - viewportRectLeft;
|
return viewportRectWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getHeight() {
|
public float getHeight() {
|
||||||
return viewportRectBottom - viewportRectTop;
|
return viewportRectHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float viewportRectRight() {
|
||||||
|
return viewportRectLeft + viewportRectWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float viewportRectBottom() {
|
||||||
|
return viewportRectTop + viewportRectHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getWidthWithoutMargins() {
|
public float getWidthWithoutMargins() {
|
||||||
return viewportRectRight - viewportRectLeft - marginLeft - marginRight;
|
return viewportRectWidth - marginLeft - marginRight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getHeightWithoutMargins() {
|
public float getHeightWithoutMargins() {
|
||||||
return viewportRectBottom - viewportRectTop - marginTop - marginBottom;
|
return viewportRectHeight - marginTop - marginBottom;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PointF getOrigin() {
|
public PointF getOrigin() {
|
||||||
@@ -123,14 +134,14 @@ public class ImmutableViewportMetrics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FloatSize getSize() {
|
public FloatSize getSize() {
|
||||||
return new FloatSize(viewportRectRight - viewportRectLeft, viewportRectBottom - viewportRectTop);
|
return new FloatSize(viewportRectWidth, viewportRectHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RectF getViewport() {
|
public RectF getViewport() {
|
||||||
return new RectF(viewportRectLeft,
|
return new RectF(viewportRectLeft,
|
||||||
viewportRectTop,
|
viewportRectTop,
|
||||||
viewportRectRight,
|
viewportRectRight(),
|
||||||
viewportRectBottom);
|
viewportRectBottom());
|
||||||
}
|
}
|
||||||
|
|
||||||
public RectF getCssViewport() {
|
public RectF getCssViewport() {
|
||||||
@@ -164,8 +175,8 @@ public class ImmutableViewportMetrics {
|
|||||||
public RectF getOverscroll() {
|
public RectF getOverscroll() {
|
||||||
return new RectF(Math.max(0, pageRectLeft - viewportRectLeft),
|
return new RectF(Math.max(0, pageRectLeft - viewportRectLeft),
|
||||||
Math.max(0, pageRectTop - viewportRectTop),
|
Math.max(0, pageRectTop - viewportRectTop),
|
||||||
Math.max(0, viewportRectRight - pageRectRight),
|
Math.max(0, viewportRectRight() - pageRectRight),
|
||||||
Math.max(0, viewportRectBottom - pageRectBottom));
|
Math.max(0, viewportRectBottom() - pageRectBottom));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -185,8 +196,8 @@ public class ImmutableViewportMetrics {
|
|||||||
FloatUtils.interpolate(cssPageRectBottom, to.cssPageRectBottom, t),
|
FloatUtils.interpolate(cssPageRectBottom, to.cssPageRectBottom, t),
|
||||||
FloatUtils.interpolate(viewportRectLeft, to.viewportRectLeft, t),
|
FloatUtils.interpolate(viewportRectLeft, to.viewportRectLeft, t),
|
||||||
FloatUtils.interpolate(viewportRectTop, to.viewportRectTop, t),
|
FloatUtils.interpolate(viewportRectTop, to.viewportRectTop, t),
|
||||||
FloatUtils.interpolate(viewportRectRight, to.viewportRectRight, t),
|
(int)FloatUtils.interpolate(viewportRectWidth, to.viewportRectWidth, t),
|
||||||
FloatUtils.interpolate(viewportRectBottom, to.viewportRectBottom, t),
|
(int)FloatUtils.interpolate(viewportRectHeight, to.viewportRectHeight, t),
|
||||||
FloatUtils.interpolate(marginLeft, to.marginLeft, t),
|
FloatUtils.interpolate(marginLeft, to.marginLeft, t),
|
||||||
FloatUtils.interpolate(marginTop, to.marginTop, t),
|
FloatUtils.interpolate(marginTop, to.marginTop, t),
|
||||||
FloatUtils.interpolate(marginRight, to.marginRight, t),
|
FloatUtils.interpolate(marginRight, to.marginRight, t),
|
||||||
@@ -195,15 +206,15 @@ public class ImmutableViewportMetrics {
|
|||||||
t >= 0.5 ? to.isRTL : isRTL);
|
t >= 0.5 ? to.isRTL : isRTL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImmutableViewportMetrics setViewportSize(float width, float height) {
|
public ImmutableViewportMetrics setViewportSize(int width, int height) {
|
||||||
if (FloatUtils.fuzzyEquals(width, getWidth()) && FloatUtils.fuzzyEquals(height, getHeight())) {
|
if (width == viewportRectWidth && height == viewportRectHeight) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ImmutableViewportMetrics(
|
return new ImmutableViewportMetrics(
|
||||||
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
||||||
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
||||||
viewportRectLeft, viewportRectTop, viewportRectLeft + width, viewportRectTop + height,
|
viewportRectLeft, viewportRectTop, width, height,
|
||||||
marginLeft, marginTop, marginRight, marginBottom,
|
marginLeft, marginTop, marginRight, marginBottom,
|
||||||
zoomFactor, isRTL);
|
zoomFactor, isRTL);
|
||||||
}
|
}
|
||||||
@@ -212,7 +223,7 @@ public class ImmutableViewportMetrics {
|
|||||||
return new ImmutableViewportMetrics(
|
return new ImmutableViewportMetrics(
|
||||||
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
||||||
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
||||||
newOriginX, newOriginY, newOriginX + getWidth(), newOriginY + getHeight(),
|
newOriginX, newOriginY, viewportRectWidth, viewportRectHeight,
|
||||||
marginLeft, marginTop, marginRight, marginBottom,
|
marginLeft, marginTop, marginRight, marginBottom,
|
||||||
zoomFactor, isRTL);
|
zoomFactor, isRTL);
|
||||||
}
|
}
|
||||||
@@ -221,7 +232,7 @@ public class ImmutableViewportMetrics {
|
|||||||
return new ImmutableViewportMetrics(
|
return new ImmutableViewportMetrics(
|
||||||
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
||||||
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
||||||
viewportRectLeft, viewportRectTop, viewportRectRight, viewportRectBottom,
|
viewportRectLeft, viewportRectTop, viewportRectWidth, viewportRectHeight,
|
||||||
marginLeft, marginTop, marginRight, marginBottom,
|
marginLeft, marginTop, marginRight, marginBottom,
|
||||||
newZoomFactor, isRTL);
|
newZoomFactor, isRTL);
|
||||||
}
|
}
|
||||||
@@ -245,7 +256,7 @@ public class ImmutableViewportMetrics {
|
|||||||
return new ImmutableViewportMetrics(
|
return new ImmutableViewportMetrics(
|
||||||
pageRect.left, pageRect.top, pageRect.right, pageRect.bottom,
|
pageRect.left, pageRect.top, pageRect.right, pageRect.bottom,
|
||||||
cssPageRect.left, cssPageRect.top, cssPageRect.right, cssPageRect.bottom,
|
cssPageRect.left, cssPageRect.top, cssPageRect.right, cssPageRect.bottom,
|
||||||
viewportRectLeft, viewportRectTop, viewportRectRight, viewportRectBottom,
|
viewportRectLeft, viewportRectTop, viewportRectWidth, viewportRectHeight,
|
||||||
marginLeft, marginTop, marginRight, marginBottom,
|
marginLeft, marginTop, marginRight, marginBottom,
|
||||||
zoomFactor, isRTL);
|
zoomFactor, isRTL);
|
||||||
}
|
}
|
||||||
@@ -261,7 +272,7 @@ public class ImmutableViewportMetrics {
|
|||||||
return new ImmutableViewportMetrics(
|
return new ImmutableViewportMetrics(
|
||||||
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
||||||
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
||||||
viewportRectLeft, viewportRectTop, viewportRectRight, viewportRectBottom,
|
viewportRectLeft, viewportRectTop, viewportRectWidth, viewportRectHeight,
|
||||||
left, top, right, bottom, zoomFactor, isRTL);
|
left, top, right, bottom, zoomFactor, isRTL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,7 +291,7 @@ public class ImmutableViewportMetrics {
|
|||||||
return new ImmutableViewportMetrics(
|
return new ImmutableViewportMetrics(
|
||||||
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
||||||
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
||||||
viewportRectLeft, viewportRectTop, viewportRectRight, viewportRectBottom,
|
viewportRectLeft, viewportRectTop, viewportRectWidth, viewportRectHeight,
|
||||||
marginLeft, marginTop, marginRight, marginBottom, zoomFactor, aIsRTL);
|
marginLeft, marginTop, marginRight, marginBottom, zoomFactor, aIsRTL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,7 +315,7 @@ public class ImmutableViewportMetrics {
|
|||||||
return new ImmutableViewportMetrics(
|
return new ImmutableViewportMetrics(
|
||||||
newPageRectLeft, newPageRectTop, newPageRectRight, newPageRectBottom,
|
newPageRectLeft, newPageRectTop, newPageRectRight, newPageRectBottom,
|
||||||
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
||||||
origin.x, origin.y, origin.x + getWidth(), origin.y + getHeight(),
|
origin.x, origin.y, viewportRectWidth, viewportRectHeight,
|
||||||
marginLeft, marginTop, marginRight, marginBottom,
|
marginLeft, marginTop, marginRight, marginBottom,
|
||||||
newZoomFactor, isRTL);
|
newZoomFactor, isRTL);
|
||||||
}
|
}
|
||||||
@@ -326,10 +337,12 @@ public class ImmutableViewportMetrics {
|
|||||||
if (newViewport.top < pageRectTop)
|
if (newViewport.top < pageRectTop)
|
||||||
newViewport.offset(0, pageRectTop - newViewport.top);
|
newViewport.offset(0, pageRectTop - newViewport.top);
|
||||||
|
|
||||||
|
// Note that since newViewport is only translated around, the viewport's
|
||||||
|
// width and height are unchanged.
|
||||||
return new ImmutableViewportMetrics(
|
return new ImmutableViewportMetrics(
|
||||||
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
pageRectLeft, pageRectTop, pageRectRight, pageRectBottom,
|
||||||
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
cssPageRectLeft, cssPageRectTop, cssPageRectRight, cssPageRectBottom,
|
||||||
newViewport.left, newViewport.top, newViewport.right, newViewport.bottom,
|
newViewport.left, newViewport.top, viewportRectWidth, viewportRectHeight,
|
||||||
marginLeft, marginTop, marginRight, marginBottom,
|
marginLeft, marginTop, marginRight, marginBottom,
|
||||||
zoomFactor, isRTL);
|
zoomFactor, isRTL);
|
||||||
}
|
}
|
||||||
@@ -356,15 +369,15 @@ public class ImmutableViewportMetrics {
|
|||||||
&& FloatUtils.fuzzyEquals(cssPageRectBottom, other.cssPageRectBottom)
|
&& FloatUtils.fuzzyEquals(cssPageRectBottom, other.cssPageRectBottom)
|
||||||
&& FloatUtils.fuzzyEquals(viewportRectLeft, other.viewportRectLeft)
|
&& FloatUtils.fuzzyEquals(viewportRectLeft, other.viewportRectLeft)
|
||||||
&& FloatUtils.fuzzyEquals(viewportRectTop, other.viewportRectTop)
|
&& FloatUtils.fuzzyEquals(viewportRectTop, other.viewportRectTop)
|
||||||
&& FloatUtils.fuzzyEquals(viewportRectRight, other.viewportRectRight)
|
&& viewportRectWidth == other.viewportRectWidth
|
||||||
&& FloatUtils.fuzzyEquals(viewportRectBottom, other.viewportRectBottom)
|
&& viewportRectHeight == other.viewportRectHeight
|
||||||
&& FloatUtils.fuzzyEquals(zoomFactor, other.zoomFactor);
|
&& FloatUtils.fuzzyEquals(zoomFactor, other.zoomFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "ImmutableViewportMetrics v=(" + viewportRectLeft + "," + viewportRectTop + ","
|
return "ImmutableViewportMetrics v=(" + viewportRectLeft + "," + viewportRectTop + ","
|
||||||
+ viewportRectRight + "," + viewportRectBottom + ") p=(" + pageRectLeft + ","
|
+ viewportRectWidth + "x" + viewportRectHeight + ") p=(" + pageRectLeft + ","
|
||||||
+ pageRectTop + "," + pageRectRight + "," + pageRectBottom + ") c=("
|
+ pageRectTop + "," + pageRectRight + "," + pageRectBottom + ") c=("
|
||||||
+ cssPageRectLeft + "," + cssPageRectTop + "," + cssPageRectRight + ","
|
+ cssPageRectLeft + "," + cssPageRectTop + "," + cssPageRectRight + ","
|
||||||
+ cssPageRectBottom + ") m=(" + marginLeft + ","
|
+ cssPageRectBottom + ") m=(" + marginLeft + ","
|
||||||
|
|||||||
@@ -233,7 +233,7 @@ public class LayerMarginsAnimator {
|
|||||||
aDx = scrollMargin(newMarginsX, aDx,
|
aDx = scrollMargin(newMarginsX, aDx,
|
||||||
overscroll.left, overscroll.right,
|
overscroll.left, overscroll.right,
|
||||||
mTouchTravelDistance.x,
|
mTouchTravelDistance.x,
|
||||||
aMetrics.viewportRectLeft, aMetrics.viewportRectRight,
|
aMetrics.viewportRectLeft, aMetrics.viewportRectRight(),
|
||||||
aMetrics.pageRectLeft, aMetrics.pageRectRight,
|
aMetrics.pageRectLeft, aMetrics.pageRectRight,
|
||||||
mMaxMargins.left, mMaxMargins.right,
|
mMaxMargins.left, mMaxMargins.right,
|
||||||
aMetrics.isRTL);
|
aMetrics.isRTL);
|
||||||
@@ -242,7 +242,7 @@ public class LayerMarginsAnimator {
|
|||||||
aDy = scrollMargin(newMarginsY, aDy,
|
aDy = scrollMargin(newMarginsY, aDy,
|
||||||
overscroll.top, overscroll.bottom,
|
overscroll.top, overscroll.bottom,
|
||||||
mTouchTravelDistance.y,
|
mTouchTravelDistance.y,
|
||||||
aMetrics.viewportRectTop, aMetrics.viewportRectBottom,
|
aMetrics.viewportRectTop, aMetrics.viewportRectBottom(),
|
||||||
aMetrics.pageRectTop, aMetrics.pageRectBottom,
|
aMetrics.pageRectTop, aMetrics.pageRectBottom,
|
||||||
mMaxMargins.top, mMaxMargins.bottom,
|
mMaxMargins.top, mMaxMargins.bottom,
|
||||||
false);
|
false);
|
||||||
|
|||||||
@@ -1888,7 +1888,8 @@ AndroidBridge::GetDisplayPort(bool aPageSizeUpdate, bool aIsBrowserContentDispla
|
|||||||
JNIEnv* const env = jni::GetGeckoThreadEnv();
|
JNIEnv* const env = jni::GetGeckoThreadEnv();
|
||||||
AutoLocalJNIFrame jniFrame(env, 1);
|
AutoLocalJNIFrame jniFrame(env, 1);
|
||||||
|
|
||||||
float x, y, width, height,
|
int width, height;
|
||||||
|
float x, y,
|
||||||
pageLeft, pageTop, pageRight, pageBottom,
|
pageLeft, pageTop, pageRight, pageBottom,
|
||||||
cssPageLeft, cssPageTop, cssPageRight, cssPageBottom,
|
cssPageLeft, cssPageTop, cssPageRight, cssPageBottom,
|
||||||
zoom;
|
zoom;
|
||||||
@@ -1909,7 +1910,7 @@ AndroidBridge::GetDisplayPort(bool aPageSizeUpdate, bool aIsBrowserContentDispla
|
|||||||
auto jmetrics = ImmutableViewportMetrics::New(
|
auto jmetrics = ImmutableViewportMetrics::New(
|
||||||
pageLeft, pageTop, pageRight, pageBottom,
|
pageLeft, pageTop, pageRight, pageBottom,
|
||||||
cssPageLeft, cssPageTop, cssPageRight, cssPageBottom,
|
cssPageLeft, cssPageTop, cssPageRight, cssPageBottom,
|
||||||
x, y, x + width, y + height,
|
x, y, width, height,
|
||||||
zoom);
|
zoom);
|
||||||
|
|
||||||
DisplayPortMetrics::LocalRef displayPortMetrics = mLayerClient->GetDisplayPort(
|
DisplayPortMetrics::LocalRef displayPortMetrics = mLayerClient->GetDisplayPort(
|
||||||
|
|||||||
@@ -1137,7 +1137,7 @@ constexpr char ImmutableViewportMetrics::name[];
|
|||||||
constexpr char ImmutableViewportMetrics::New_t::name[];
|
constexpr char ImmutableViewportMetrics::New_t::name[];
|
||||||
constexpr char ImmutableViewportMetrics::New_t::signature[];
|
constexpr char ImmutableViewportMetrics::New_t::signature[];
|
||||||
|
|
||||||
auto ImmutableViewportMetrics::New(float a0, float a1, float a2, float a3, float a4, float a5, float a6, float a7, float a8, float a9, float a10, float a11, float a12) -> ImmutableViewportMetrics::LocalRef
|
auto ImmutableViewportMetrics::New(float a0, float a1, float a2, float a3, float a4, float a5, float a6, float a7, float a8, float a9, int32_t a10, int32_t a11, float a12) -> ImmutableViewportMetrics::LocalRef
|
||||||
{
|
{
|
||||||
return mozilla::jni::Constructor<New_t>::Call(nullptr, nullptr, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
|
return mozilla::jni::Constructor<New_t>::Call(nullptr, nullptr, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2739,19 +2739,19 @@ public:
|
|||||||
float,
|
float,
|
||||||
float,
|
float,
|
||||||
float,
|
float,
|
||||||
float,
|
int32_t,
|
||||||
float,
|
int32_t,
|
||||||
float> Args;
|
float> Args;
|
||||||
static constexpr char name[] = "<init>";
|
static constexpr char name[] = "<init>";
|
||||||
static constexpr char signature[] =
|
static constexpr char signature[] =
|
||||||
"(FFFFFFFFFFFFF)V";
|
"(FFFFFFFFFFIIF)V";
|
||||||
static const bool isStatic = false;
|
static const bool isStatic = false;
|
||||||
static const bool isMultithreaded = true;
|
static const bool isMultithreaded = true;
|
||||||
static const mozilla::jni::ExceptionMode exceptionMode =
|
static const mozilla::jni::ExceptionMode exceptionMode =
|
||||||
mozilla::jni::ExceptionMode::ABORT;
|
mozilla::jni::ExceptionMode::ABORT;
|
||||||
};
|
};
|
||||||
|
|
||||||
static auto New(float, float, float, float, float, float, float, float, float, float, float, float, float) -> ImmutableViewportMetrics::LocalRef;
|
static auto New(float, float, float, float, float, float, float, float, float, float, int32_t, int32_t, float) -> ImmutableViewportMetrics::LocalRef;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -38,12 +38,12 @@ interface nsIAndroidBrowserApp : nsISupports {
|
|||||||
nsIUITelemetryObserver getUITelemetryObserver();
|
nsIUITelemetryObserver getUITelemetryObserver();
|
||||||
};
|
};
|
||||||
|
|
||||||
[scriptable, uuid(59cfcb35-69b7-47b2-8155-32b193272666)]
|
[scriptable, uuid(92ae801d-da9c-4a24-b2b6-344c4af7008b)]
|
||||||
interface nsIAndroidViewport : nsISupports {
|
interface nsIAndroidViewport : nsISupports {
|
||||||
readonly attribute float x;
|
readonly attribute float x;
|
||||||
readonly attribute float y;
|
readonly attribute float y;
|
||||||
readonly attribute float width;
|
readonly attribute int32_t width;
|
||||||
readonly attribute float height;
|
readonly attribute int32_t height;
|
||||||
readonly attribute float pageLeft;
|
readonly attribute float pageLeft;
|
||||||
readonly attribute float pageTop;
|
readonly attribute float pageTop;
|
||||||
readonly attribute float pageRight;
|
readonly attribute float pageRight;
|
||||||
|
|||||||
Reference in New Issue
Block a user