Bug 886576 - Fix scrolling cancelling locked dynamic toolbar animations. r=kats

Move the margin animation-cancelling call into the margins-pinned check block
in LayerMarginsAnimator to make sure margin animations aren't cancelled by
scrolling when margins are locked.
This commit is contained in:
Chris Lord 2013-07-19 17:39:44 +01:00
parent 2da4132fa4
commit 76305364f5
2 changed files with 7 additions and 7 deletions

View File

@ -1209,8 +1209,8 @@ abstract public class BrowserApp extends GeckoApp
// toolbar.
if (mLayerView != null && isDynamicToolbarEnabled()) {
if (width > 0 && height > 0) {
mLayerView.getLayerMarginsAnimator().showMargins(false);
mLayerView.getLayerMarginsAnimator().setMarginsPinned(true);
mLayerView.getLayerMarginsAnimator().showMargins(false);
} else {
mLayerView.getLayerMarginsAnimator().setMarginsPinned(false);
}

View File

@ -226,17 +226,17 @@ public class LayerMarginsAnimator implements TouchEventInterceptor {
* viewport origin and returns the modified metrics.
*/
ImmutableViewportMetrics scrollBy(ImmutableViewportMetrics aMetrics, float aDx, float aDy) {
// Make sure to cancel any margin animations when scrolling begins
if (mAnimationTimer != null) {
mAnimationTimer.cancel();
mAnimationTimer = null;
}
float[] newMarginsX = { aMetrics.marginLeft, aMetrics.marginRight };
float[] newMarginsY = { aMetrics.marginTop, aMetrics.marginBottom };
// Only alter margins if the toolbar isn't pinned
if (!mMarginsPinned) {
// Make sure to cancel any margin animations when margin-scrolling begins
if (mAnimationTimer != null) {
mAnimationTimer.cancel();
mAnimationTimer = null;
}
// Reset the touch travel when changing direction
if ((aDx >= 0) != (mTouchTravelDistance.x >= 0)) {
mTouchTravelDistance.x = 0;