Bug 1509575 - Make nsIPresShell::mVisualViewportOffset a Maybe so we can tell if it's ever been set. r=kats

This allows us to e.g. avoid sending a value that's (0,0) because it hasn't
been set yet in a visual scroll update.

Depends on D16346

Differential Revision: https://phabricator.services.mozilla.com/D16477
This commit is contained in:
Botond Ballo
2019-01-15 01:30:55 +00:00
parent de57a984b6
commit e7b3975365
2 changed files with 10 additions and 5 deletions

View File

@@ -10102,9 +10102,9 @@ void nsIPresShell::SetVisualViewportSize(nscoord aWidth, nscoord aHeight) {
bool nsIPresShell::SetVisualViewportOffset(
const nsPoint& aScrollOffset, const nsPoint& aPrevLayoutScrollPos) {
bool didChange = false;
if (mVisualViewportOffset != aScrollOffset) {
nsPoint prevOffset = mVisualViewportOffset;
mVisualViewportOffset = aScrollOffset;
if (GetVisualViewportOffset() != aScrollOffset) {
nsPoint prevOffset = GetVisualViewportOffset();
mVisualViewportOffset = Some(aScrollOffset);
didChange = true;
if (auto* window = nsGlobalWindowInner::Cast(mDocument->GetInnerWindow())) {