Bug 892246 - Allow subdocument scrolling to reveal margins. r=kats

This adds a notification callback to PanZoomTarget that the PanZoomController
can call to notify GeckoLayerClient that a subdocument is being scrolled. This
allows GeckoLayerClient to call LayerMarginsAnimator and alter the margins
accordingly, stopping a page from trapping the toolbar on/off the screen with
a screen-covering subframe.
This commit is contained in:
Chris Lord 2013-07-15 17:03:24 +01:00
Родитель 6d53b0b827
Коммит 4a19924c66
3 изменённых файлов: 21 добавлений и 1 удалений

Просмотреть файл

@ -854,6 +854,21 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
viewportMetricsChanged(true); viewportMetricsChanged(true);
} }
/** Implementation of PanZoomTarget
* Notification that a subdocument has been scrolled by a certain amount.
* This is used here to make sure that the margins are still accessible
* during subdocument scrolling.
*
* You must hold the monitor while calling this.
*/
@Override
public void onSubdocumentScrollBy(float dx, float dy) {
ImmutableViewportMetrics newMarginsMetrics =
mMarginsAnimator.scrollBy(mViewportMetrics, dx, dy);
mViewportMetrics = mViewportMetrics.setMarginsFrom(newMarginsMetrics);
viewportMetricsChanged(true);
}
/** Implementation of PanZoomTarget */ /** Implementation of PanZoomTarget */
@Override @Override
public void panZoomStopped() { public void panZoomStopped() {

Просмотреть файл

@ -806,7 +806,11 @@ class JavaPanZoomController
if (FloatUtils.fuzzyEquals(displacement.x, 0.0f) && FloatUtils.fuzzyEquals(displacement.y, 0.0f)) { if (FloatUtils.fuzzyEquals(displacement.x, 0.0f) && FloatUtils.fuzzyEquals(displacement.y, 0.0f)) {
return; return;
} }
if (! mSubscroller.scrollBy(displacement)) { if (mSubscroller.scrollBy(displacement)) {
synchronized (mTarget.getLock()) {
mTarget.onSubdocumentScrollBy(displacement.x, displacement.y);
}
} else {
synchronized (mTarget.getLock()) { synchronized (mTarget.getLock()) {
scrollBy(displacement.x, displacement.y); scrollBy(displacement.x, displacement.y);
} }

Просмотреть файл

@ -17,6 +17,7 @@ public interface PanZoomTarget {
public void setAnimationTarget(ImmutableViewportMetrics viewport); public void setAnimationTarget(ImmutableViewportMetrics viewport);
public void setViewportMetrics(ImmutableViewportMetrics viewport); public void setViewportMetrics(ImmutableViewportMetrics viewport);
public void scrollBy(float dx, float dy); public void scrollBy(float dx, float dy);
public void onSubdocumentScrollBy(float dx, float dy);
public void panZoomStopped(); public void panZoomStopped();
/** This triggers an (asynchronous) viewport update/redraw. */ /** This triggers an (asynchronous) viewport update/redraw. */
public void forceRedraw(DisplayPortMetrics displayPort); public void forceRedraw(DisplayPortMetrics displayPort);