зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1180295 - Ensure we don't scroll past the end of the page. r=rbarker
--HG-- extra : commitid : 1y6f6Li4Zl4
This commit is contained in:
Родитель
9e624195ef
Коммит
5ba8c32366
|
@ -206,6 +206,7 @@ abstract class Axis {
|
|||
protected abstract float getViewportLength();
|
||||
protected abstract float getPageStart();
|
||||
protected abstract float getPageLength();
|
||||
protected abstract float getVisibleEndOfLayerView();
|
||||
|
||||
Axis(SubdocumentScrollHelper subscroller) {
|
||||
mSubscroller = subscroller;
|
||||
|
@ -499,8 +500,8 @@ abstract class Axis {
|
|||
|
||||
if (mDisplacement + getOrigin() < getPageStart()) {
|
||||
mDisplacement = getPageStart() - getOrigin();
|
||||
} else if (mDisplacement + getViewportEnd() > getPageEnd()) {
|
||||
mDisplacement = getPageEnd() - getViewportEnd();
|
||||
} else if (mDisplacement + getOrigin() + getVisibleEndOfLayerView() > getPageEnd()) {
|
||||
mDisplacement = getPageEnd() - getOrigin() - getVisibleEndOfLayerView();
|
||||
}
|
||||
|
||||
// Return the amount of overscroll so that the overscroll controller can draw it for us
|
||||
|
|
|
@ -331,6 +331,11 @@ public class DynamicToolbarAnimator {
|
|||
return true;
|
||||
}
|
||||
|
||||
public PointF getVisibleEndOfLayerView() {
|
||||
return new PointF(mTarget.getView().getWidth(),
|
||||
mTarget.getView().getHeight() - mMaxTranslation + mLayerViewTranslation);
|
||||
}
|
||||
|
||||
private float bottomOfCssViewport(ImmutableViewportMetrics aMetrics) {
|
||||
return aMetrics.getHeight() + mMaxTranslation - mLayerViewTranslation;
|
||||
}
|
||||
|
|
|
@ -746,6 +746,12 @@ class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
|||
return mView.getFullScreenState();
|
||||
}
|
||||
|
||||
/** Implementation of PanZoomTarget */
|
||||
@Override
|
||||
public PointF getVisibleEndOfLayerView() {
|
||||
return mToolbarAnimator.getVisibleEndOfLayerView();
|
||||
}
|
||||
|
||||
/** Implementation of PanZoomTarget */
|
||||
@Override
|
||||
public void setAnimationTarget(ImmutableViewportMetrics metrics) {
|
||||
|
|
|
@ -1103,6 +1103,10 @@ class JavaPanZoomController
|
|||
@Override
|
||||
protected float getPageLength() { return getMetrics().getPageWidthWithMargins(); }
|
||||
@Override
|
||||
protected float getVisibleEndOfLayerView() {
|
||||
return mTarget.getVisibleEndOfLayerView().x;
|
||||
}
|
||||
@Override
|
||||
protected void overscrollFling(final float velocity) {
|
||||
if (mOverscroll != null) {
|
||||
mOverscroll.setVelocity(velocity, Overscroll.Axis.X);
|
||||
|
@ -1127,6 +1131,10 @@ class JavaPanZoomController
|
|||
@Override
|
||||
protected float getPageLength() { return getMetrics().getPageHeightWithMargins(); }
|
||||
@Override
|
||||
protected float getVisibleEndOfLayerView() {
|
||||
return mTarget.getVisibleEndOfLayerView().y;
|
||||
}
|
||||
@Override
|
||||
protected void overscrollFling(final float velocity) {
|
||||
if (mOverscroll != null) {
|
||||
mOverscroll.setVelocity(velocity, Overscroll.Axis.Y);
|
||||
|
|
|
@ -14,6 +14,7 @@ public interface PanZoomTarget {
|
|||
public ImmutableViewportMetrics getViewportMetrics();
|
||||
public ZoomConstraints getZoomConstraints();
|
||||
public FullScreenState getFullScreenState();
|
||||
public PointF getVisibleEndOfLayerView();
|
||||
|
||||
public void setAnimationTarget(ImmutableViewportMetrics viewport);
|
||||
public void setViewportMetrics(ImmutableViewportMetrics viewport);
|
||||
|
|
Загрузка…
Ссылка в новой задаче