From 77b4f9fdf9d97228ce3f1d824aea62632d2e7616 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Fri, 3 Jul 2020 15:55:56 +0000 Subject: [PATCH] Bug 1644567 - Use a more appropriate check when reading the visual viewport offset. r=botond Instead of checking for the visual viewport *size* being set, we check for the *offset* being set. This makes more sense becuase we're going to be reading the offset, not the size. Depends on D81740 Differential Revision: https://phabricator.services.mozilla.com/D81741 --- layout/generic/nsGfxScrollFrame.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index fc83979bae5c..ff705234c5e5 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -4283,11 +4283,13 @@ nsSize ScrollFrameHelper::GetVisualViewportSize() const { nsPoint ScrollFrameHelper::GetVisualViewportOffset() const { PresShell* presShell = mOuter->PresShell(); - if (mIsRoot && presShell->IsVisualViewportSizeSet()) { + if (mIsRoot) { if (auto pendingUpdate = presShell->GetPendingVisualScrollUpdate()) { return pendingUpdate->mVisualScrollOffset; } - return presShell->GetVisualViewportOffset(); + if (presShell->IsVisualViewportOffsetSet()) { + return presShell->GetVisualViewportOffset(); + } } return GetScrollPosition(); }