browser(firefox): avoid clobbering scroll requests after scrollIntoViewIfNeeded (#1785)

5ef35728ff

If there is a pending visual update `AsyncPanZoomController::NotifyLayersUpdated` will override scroll offset set from layout with the visual one. See [`visualScrollOffsetUpdated`](http://ffsearch.azurewebsites.net/#path=%2Fhome%2Fjoe%2Ffirefox%2Fgfx%2Flayers%2Fapz%2Fsrc%2FAsyncPanZoomController.cpp&line=4530) and its comment in the method.
This commit is contained in:
Yury Semikhatsky 2020-04-14 16:24:36 -07:00 committed by GitHub
parent 24d51cb2bb
commit d5e75d8bb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -1 +1 @@
1077
1078

View File

@ -623,10 +623,10 @@ index 249580e733d1b05e35205cd2f7b4ccbe91c9cb54..765e3f58e0a359c622f68d371c5089bc
}
diff --git a/dom/base/nsINode.cpp b/dom/base/nsINode.cpp
index 41c8b8dad90e0b322bb941a714ca332760176259..630e309cb97cd7376211020dfd5f5e64e6e7d3e2 100644
index 41c8b8dad90e0b322bb941a714ca332760176259..ec393547a7710840fdd07649fe9936bacffe37d3 100644
--- a/dom/base/nsINode.cpp
+++ b/dom/base/nsINode.cpp
@@ -1221,6 +1221,42 @@ void nsINode::GetBoxQuadsFromWindowOrigin(const BoxQuadOptions& aOptions,
@@ -1221,6 +1221,48 @@ void nsINode::GetBoxQuadsFromWindowOrigin(const BoxQuadOptions& aOptions,
mozilla::GetBoxQuadsFromWindowOrigin(this, aOptions, aResult, aRv);
}
@ -664,6 +664,12 @@ index 41c8b8dad90e0b322bb941a714ca332760176259..630e309cb97cd7376211020dfd5f5e64
+ ScrollAxis(kScrollToCenter, WhenToScroll::Always),
+ ScrollAxis(kScrollToCenter, WhenToScroll::Always),
+ ScrollFlags::ScrollOverflowHidden);
+ // If a _visual_ scroll update is pending, cancel it; otherwise, it will
+ // clobber next scroll (e.g. subsequent window.scrollTo(0, 0) wlll break).
+ if (presShell->GetPendingVisualScrollUpdate()) {
+ presShell->AcknowledgePendingVisualScrollUpdate();
+ presShell->ClearPendingVisualScrollUpdate();
+ }
+}
+
already_AddRefed<DOMQuad> nsINode::ConvertQuadFromNode(