Bug 1546027 - Don't apply scroll anchor adjustments if we're restoring our scroll position. r=dholbert

Since scroll position restoration is absolute, and we'll lose it as soon as we
apply any adjustment or do any other sort of scrolling.

Differential Revision: https://phabricator.services.mozilla.com/D37941

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-07-15 17:46:11 +00:00
Родитель b44982b9f4
Коммит 1a121e2e21
2 изменённых файлов: 11 добавлений и 3 удалений

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

@ -307,10 +307,14 @@ void ScrollAnchorContainer::Destroy() {
} }
void ScrollAnchorContainer::ApplyAdjustments() { void ScrollAnchorContainer::ApplyAdjustments() {
if (!mAnchorNode || mAnchorNodeIsDirty) { if (!mAnchorNode || mAnchorNodeIsDirty ||
mScrollFrame->HasPendingScrollRestoration()) {
mSuppressAnchorAdjustment = false; mSuppressAnchorAdjustment = false;
ANCHOR_LOG("Ignoring post-reflow (anchor=%p, dirty=%d, container=%p).\n", ANCHOR_LOG(
mAnchorNode, mAnchorNodeIsDirty, this); "Ignoring post-reflow (anchor=%p, dirty=%d, pendingRestoration=%d, "
"container=%p).\n",
mAnchorNode, mAnchorNodeIsDirty,
mScrollFrame->HasPendingScrollRestoration(), this);
return; return;
} }

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

@ -201,6 +201,10 @@ class ScrollFrameHelper : public nsIReflowCallback {
void ScrollSnap(const nsPoint& aDestination, void ScrollSnap(const nsPoint& aDestination,
ScrollMode aMode = ScrollMode::SmoothMsd); ScrollMode aMode = ScrollMode::SmoothMsd);
bool HasPendingScrollRestoration() const {
return mRestorePos != nsPoint(-1, -1);
}
protected: protected:
nsRect GetVisualScrollRange() const; nsRect GetVisualScrollRange() const;