Bug 1366365 - Re-clamp APZ's scroll offset if the scrollable rect changes. r=kats

Even if we don't accept the scroll offset from content, we always accept the
new scrollable rect, so to avoid an out-of-bounds scroll offset, we need to
re-clamp it.

MozReview-Commit-ID: 5JbCUYuDPR6

--HG--
extra : rebase_source : 72638713f97b5ab42633580f54b5a4c9dad1a630
This commit is contained in:
Botond Ballo 2017-05-19 17:30:24 -04:00
Родитель 93e7b8f2fd
Коммит 9ca636625a
1 изменённых файлов: 9 добавлений и 0 удалений

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

@ -3529,9 +3529,11 @@ void AsyncPanZoomController::NotifyLayersUpdated(const ScrollMetadata& aScrollMe
mFrameMetrics.SetZoom(aLayerMetrics.GetZoom());
mFrameMetrics.SetDevPixelsPerCSSPixel(aLayerMetrics.GetDevPixelsPerCSSPixel());
}
bool scrollableRectChanged = false;
if (!mFrameMetrics.GetScrollableRect().IsEqualEdges(aLayerMetrics.GetScrollableRect())) {
mFrameMetrics.SetScrollableRect(aLayerMetrics.GetScrollableRect());
needContentRepaint = true;
scrollableRectChanged = true;
}
mFrameMetrics.SetCompositionBounds(aLayerMetrics.GetCompositionBounds());
mFrameMetrics.SetRootCompositionSize(aLayerMetrics.GetRootCompositionSize());
@ -3578,6 +3580,13 @@ void AsyncPanZoomController::NotifyLayersUpdated(const ScrollMetadata& aScrollMe
// Note that even if the CancelAnimation call above requested a repaint
// this is fine because we already have repaint request deduplication.
needContentRepaint = true;
} else if (scrollableRectChanged) {
// Even if we didn't accept a new scroll offset from content, the
// scrollable rect may have changed in a way that makes our local
// scroll offset out of bounds, so re-clamp it.
mFrameMetrics.SetScrollOffset(
mFrameMetrics.CalculateScrollRange().ClampPoint(
mFrameMetrics.GetScrollOffset()));
}
}