Bug 1519007 - Do not allow APZ to move the layout viewport outside the scrollable rect. r=kats

Differential Revision: https://phabricator.services.mozilla.com/D24826

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Botond Ballo 2019-03-29 22:00:36 +00:00
Родитель 2dd9337727
Коммит 58c5bb6a5a
3 изменённых файлов: 13 добавлений и 4 удалений

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

@ -18,12 +18,13 @@ void FrameMetrics::RecalculateLayoutViewportOffset() {
return;
}
KeepLayoutViewportEnclosingVisualViewport(GetVisualViewport(),
mLayoutViewport);
mScrollableRect, mLayoutViewport);
}
/* static */
void FrameMetrics::KeepLayoutViewportEnclosingVisualViewport(
const CSSRect& aVisualViewport, CSSRect& aLayoutViewport) {
const CSSRect& aVisualViewport, const CSSRect& aScrollableRect,
CSSRect& aLayoutViewport) {
// If the visual viewport is contained within the layout viewport, we don't
// need to make any adjustments, so we can exit early.
//
@ -77,6 +78,10 @@ void FrameMetrics::KeepLayoutViewportEnclosingVisualViewport(
aLayoutViewport.YMost());
}
}
// Regardless of any adjustment above, the layout viewport is not allowed
// to go outside the scrollable rect.
aLayoutViewport = aLayoutViewport.MoveInsideAndClamp(aScrollableRect);
}
void ScrollMetadata::SetUsesContainerScrolling(bool aValue) {

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

@ -511,8 +511,12 @@ struct FrameMetrics {
// the frame delay).
// Modifies |aLayoutViewport| to continue enclosing |aVisualViewport|
// if possible.
// The layout viewport needs to remain clamped to the scrollable rect,
// and we pass in the scrollable rect so this function can maintain that
// constraint.
static void KeepLayoutViewportEnclosingVisualViewport(
const CSSRect& aVisualViewport, CSSRect& aLayoutViewport);
const CSSRect& aVisualViewport, const CSSRect& aScrollableRect,
CSSRect& aLayoutViewport);
private:
// A ID assigned to each scrollable frame, unique within each LayersId..

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

@ -3545,7 +3545,7 @@ void AsyncPanZoomController::AdjustScrollForSurfaceShift(
FrameMetrics::KeepLayoutViewportEnclosingVisualViewport(
CSSRect(mCompositedScrollOffset,
Metrics().CalculateCompositedSizeInCssPixels()),
mCompositedLayoutViewport);
Metrics().GetScrollableRect(), mCompositedLayoutViewport);
RequestContentRepaint();
UpdateSharedCompositorFrameMetrics();
}