mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 09:15:35 +00:00
Bug 1516722 - Don't let ScrollToVisual clobber further layout scrolling in the same transaction. r=kats
Test coverage for this is provided in the web platform test html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-fragment-scrolling-samedoc.html. Differential Revision: https://phabricator.services.mozilla.com/D30105 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
5c7f1d92a6
commit
5101ae966a
@ -2703,6 +2703,27 @@ void ScrollFrameHelper::ScrollToImpl(nsPoint aPt, const nsRect& aRange,
|
||||
return;
|
||||
}
|
||||
|
||||
// If we are scrolling the RCD-RSF, and a visual scroll update is pending,
|
||||
// cancel it; otherwise, it will clobber this scroll.
|
||||
if (IsRootScrollFrameOfDocument() && presContext->IsRootContentDocument()) {
|
||||
PresShell* ps = presContext->GetPresShell();
|
||||
if (const auto& visualScrollUpdate = ps->GetPendingVisualScrollUpdate()) {
|
||||
if (visualScrollUpdate->mVisualScrollOffset != aPt) {
|
||||
// Only clobber if the scroll was originated by the main thread.
|
||||
// Respect the priority of origins (an "eRestore" layout scroll should
|
||||
// not clobber an "eMainThread" visual scroll.)
|
||||
bool shouldClobber =
|
||||
aOrigin == nsGkAtoms::other ||
|
||||
(aOrigin == nsGkAtoms::restore &&
|
||||
visualScrollUpdate->mUpdateType == FrameMetrics::eRestore);
|
||||
if (shouldClobber) {
|
||||
ps->AcknowledgePendingVisualScrollUpdate();
|
||||
ps->ClearPendingVisualScrollUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool needFrameVisibilityUpdate = mLastUpdateFramesPos == nsPoint(-1, -1);
|
||||
|
||||
nsPoint dist(std::abs(pt.x - mLastUpdateFramesPos.x),
|
||||
|
Loading…
Reference in New Issue
Block a user