Bug 898877 - Prevent pages from getting stuck without the dynamic toolbar. r=Cwiiis
The problematic scenario is when the page is exactly the height of the screen (with dynamic toolbar not visible). In this case, the scrollable() function in Axis.java returns false on the vertical axis, and so the JavaPanZoomController never does any scrolling. This in turns means that the scrollBy code in LayerMarginsAnimator never gets to run, so you can never drag the toolbar back into being visible. The patch ensures that scrollable() returns true when some or all of the margins are not visible, ensuring that in these scenarios the user can still scroll the toolbar back onto the screen. This patch also adds some comments/asserts to verify the new code is threadsafe.
This commit is contained in:
@@ -1056,6 +1056,12 @@ class JavaPanZoomController
|
||||
protected float getPageStart() { return getMetrics().pageRectLeft; }
|
||||
@Override
|
||||
protected float getPageLength() { return getMetrics().getPageWidthWithMargins(); }
|
||||
@Override
|
||||
protected boolean marginsHidden() {
|
||||
ImmutableViewportMetrics metrics = getMetrics();
|
||||
RectF maxMargins = mTarget.getMaxMargins();
|
||||
return (metrics.marginLeft < maxMargins.left || metrics.marginRight < maxMargins.right);
|
||||
}
|
||||
}
|
||||
|
||||
private class AxisY extends Axis {
|
||||
@@ -1068,6 +1074,12 @@ class JavaPanZoomController
|
||||
protected float getPageStart() { return getMetrics().pageRectTop; }
|
||||
@Override
|
||||
protected float getPageLength() { return getMetrics().getPageHeightWithMargins(); }
|
||||
@Override
|
||||
protected boolean marginsHidden() {
|
||||
ImmutableViewportMetrics metrics = getMetrics();
|
||||
RectF maxMargins = mTarget.getMaxMargins();
|
||||
return (metrics.marginTop < maxMargins.top || metrics.marginBottom < maxMargins.bottom);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user