Bug 705246 - Disable overscroll when panning. r=kats

This commit is contained in:
Wes Johnston 2013-09-23 11:46:50 -07:00
parent 14368e3729
commit 4dc4c594f2
4 changed files with 15 additions and 10 deletions

View File

@ -2555,6 +2555,7 @@ abstract public class GeckoApp
protected void geckoConnected() {
mLayerView.geckoConnected();
mLayerView.setOverScrollMode(View.OVER_SCROLL_NEVER);
}
public void setAccessibilityEnabled(boolean enabled) {

View File

@ -218,10 +218,4 @@ public class WebAppImpl extends GeckoApp {
}
super.onTabChanged(tab, msg, data);
}
@Override
protected void geckoConnected() {
super.geckoConnected();
mLayerView.setOverScrollMode(View.OVER_SCROLL_NEVER);
}
};

View File

@ -144,6 +144,8 @@ abstract class Axis {
protected abstract float getViewportLength();
protected abstract float getPageStart();
protected abstract float getPageLength();
protected abstract float getMarginStart();
protected abstract float getMarginEnd();
protected abstract boolean marginsHidden();
Axis(SubdocumentScrollHelper subscroller) {
@ -377,11 +379,11 @@ abstract class Axis {
// getOverscroll which doesn't take into account any new displacment being applied.
// If we using a subscroller, we don't want to alter the scrolling being done
if (getOverScrollMode() == View.OVER_SCROLL_NEVER && !mSubscroller.scrolling()) {
if (mDisplacement + getOrigin() < getPageStart()) {
mDisplacement = getPageStart() - getOrigin();
if (mDisplacement + getOrigin() < getPageStart() - getMarginStart()) {
mDisplacement = getPageStart() - getMarginStart() - getOrigin();
stopFling();
} else if (mDisplacement + getViewportEnd() > getPageEnd()) {
mDisplacement = getPageEnd() - getViewportEnd();
} else if (mDisplacement + getViewportEnd() > getPageEnd() + getMarginEnd()) {
mDisplacement = getPageEnd() - getMarginEnd() - getViewportEnd();
stopFling();
}
}

View File

@ -1102,6 +1102,10 @@ class JavaPanZoomController
@Override
protected float getPageStart() { return getMetrics().pageRectLeft; }
@Override
protected float getMarginStart() { return mTarget.getMaxMargins().left - getMetrics().marginLeft; }
@Override
protected float getMarginEnd() { return mTarget.getMaxMargins().right - getMetrics().marginRight; }
@Override
protected float getPageLength() { return getMetrics().getPageWidthWithMargins(); }
@Override
protected boolean marginsHidden() {
@ -1122,6 +1126,10 @@ class JavaPanZoomController
@Override
protected float getPageLength() { return getMetrics().getPageHeightWithMargins(); }
@Override
protected float getMarginStart() { return mTarget.getMaxMargins().top - getMetrics().marginTop; }
@Override
protected float getMarginEnd() { return mTarget.getMaxMargins().bottom - getMetrics().marginBottom; }
@Override
protected boolean marginsHidden() {
ImmutableViewportMetrics metrics = getMetrics();
RectF maxMargins = mTarget.getMaxMargins();