Bug 735612 - Add missing synchronization around viewport manipulation. r=Cwiiis

This commit is contained in:
Kartikaya Gupta 2012-03-15 10:40:55 -04:00
Родитель deb4135b71
Коммит b93a9723c8
1 изменённых файлов: 12 добавлений и 8 удалений

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

@ -232,8 +232,10 @@ public class PanZoomController
case NOTHING:
// Don't do animations here; they're distracting and can cause flashes on page
// transitions.
mController.setViewportMetrics(getValidViewportMetrics());
mController.notifyLayerClientOfGeometryChange();
synchronized (mController) {
mController.setViewportMetrics(getValidViewportMetrics());
mController.notifyLayerClientOfGeometryChange();
}
break;
}
}
@ -241,12 +243,14 @@ public class PanZoomController
/** This must be called on the UI thread. */
public void pageSizeUpdated() {
if (mState == PanZoomState.NOTHING) {
ViewportMetrics validated = getValidViewportMetrics();
if (! (new ViewportMetrics(mController.getViewportMetrics())).fuzzyEquals(validated)) {
// page size changed such that we are now in overscroll. snap to the
// the nearest valid viewport
mController.setViewportMetrics(validated);
mController.notifyLayerClientOfGeometryChange();
synchronized (mController) {
ViewportMetrics validated = getValidViewportMetrics();
if (! (new ViewportMetrics(mController.getViewportMetrics())).fuzzyEquals(validated)) {
// page size changed such that we are now in overscroll. snap to the
// the nearest valid viewport
mController.setViewportMetrics(validated);
mController.notifyLayerClientOfGeometryChange();
}
}
}
}