Bug 1201076 - Don't clobber the page rect update if one comes in while in the middle of a bounce animation. r=snorp

This commit is contained in:
Kartikaya Gupta 2015-09-28 11:06:37 -04:00
parent 50db7bf6c8
commit 5da7557499
2 changed files with 13 additions and 2 deletions

View File

@ -219,6 +219,17 @@ public class ImmutableViewportMetrics {
zoomFactor, isRTL);
}
public ImmutableViewportMetrics setPageRectFrom(ImmutableViewportMetrics aMetrics) {
if (aMetrics.cssPageRectLeft == cssPageRectLeft &&
aMetrics.cssPageRectTop == cssPageRectTop &&
aMetrics.cssPageRectRight == cssPageRectRight &&
aMetrics.cssPageRectBottom == cssPageRectBottom) {
return this;
}
RectF css = aMetrics.getCssPageRect();
return setPageRect(RectUtils.scale(css, zoomFactor), css);
}
public ImmutableViewportMetrics setIsRTL(boolean aIsRTL) {
if (isRTL == aIsRTL) {
return this;

View File

@ -950,14 +950,14 @@ class JavaPanZoomController
synchronized (mTarget.getLock()) {
float t = easeOut((float)mBounceDuration / BOUNCE_ANIMATION_DURATION);
ImmutableViewportMetrics newMetrics = mBounceStartMetrics.interpolate(mBounceEndMetrics, t);
mTarget.setViewportMetrics(newMetrics);
mTarget.setViewportMetrics(newMetrics.setPageRectFrom(getMetrics()));
}
}
/* Concludes a bounce animation and snaps the viewport into place. */
private void finishBounce() {
synchronized (mTarget.getLock()) {
mTarget.setViewportMetrics(mBounceEndMetrics);
mTarget.setViewportMetrics(mBounceEndMetrics.setPageRectFrom(getMetrics()));
}
}
}