Bug 1509575 - Restore the visual viewport offset from the main thread during a first paint. r=kats

During a "first paint" transaction, compositor-side state such as APZ's copy
of the visual viewport offset is overwritten. However, the scroll frame may
persist on the main thread, and in such a case we want to restore the visual
viewport offset stored in the scroll frame. This comes into play during e.g.
navigation back to a page.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Botond Ballo 2019-01-11 04:21:29 +00:00
Родитель e98d64e015
Коммит 1346c277b1
1 изменённых файлов: 7 добавлений и 0 удалений

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

@ -8708,6 +8708,13 @@ static void MaybeReflowForInflationScreenSizeChange(
metrics.SetBaseScrollOffset(apzScrollPosition);
if (aIsRootContent) {
if (aLayerManager->GetIsFirstPaint()) {
// Restore the visual viewport offset to the copy stored on the
// main thread.
presShell->SetPendingVisualViewportOffset(
Some(presShell->GetVisualViewportOffset()));
}
if (const Maybe<nsPoint>& visualOffset =
presShell->GetPendingVisualViewportOffset()) {
metrics.SetVisualViewportOffset(CSSPoint::FromAppUnits(*visualOffset));