Bug 1753881. If the visual viewport offset hasn't been set on the presshell return the layout scroll position. r=botond

Because that is the correct value.

Differential Revision: https://phabricator.services.mozilla.com/D139472
This commit is contained in:
Timothy Nikkel 2022-02-27 13:09:27 +00:00
Родитель 9cd34079f8
Коммит ed30449176
2 изменённых файлов: 12 добавлений и 2 удалений

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

@ -11197,7 +11197,14 @@ bool PresShell::SetVisualViewportOffset(const nsPoint& aScrollOffset,
}
}
nsPoint prevOffset = GetVisualViewportOffset();
// Careful here not to call GetVisualViewportOffset to get the previous visual
// viewport offset because if mVisualViewportOffset is nothing then we'll get
// the layout scroll position directly from the scroll frame and it has likely
// already been updated.
nsPoint prevOffset = aPrevLayoutScrollPos;
if (mVisualViewportOffset.isSome()) {
prevOffset = *mVisualViewportOffset;
}
if (prevOffset == newOffset) {
return false;
}

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

@ -1481,7 +1481,10 @@ class PresShell final : public nsStubDocumentObserver,
const nsPoint& aPrevLayoutScrollPos);
nsPoint GetVisualViewportOffset() const {
return mVisualViewportOffset.valueOr(nsPoint());
if (mVisualViewportOffset.isSome()) {
return *mVisualViewportOffset;
}
return GetLayoutViewportOffset();
}
bool IsVisualViewportOffsetSet() const {
return mVisualViewportOffset.isSome();