Bug 1490561 - Make sure we remove our RefreshDriver observers in CompleteAsyncScroll. r=emilio

This commit is contained in:
Mats Palmgren 2018-10-01 07:59:25 +02:00
Родитель 569d0d514e
Коммит 729982d840
2 изменённых файлов: 13 добавлений и 2 удалений

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

@ -2270,8 +2270,7 @@ void
ScrollFrameHelper::CompleteAsyncScroll(const nsRect &aRange, nsAtom* aOrigin)
{
// Apply desired destination range since this is the last step of scrolling.
mAsyncSmoothMSDScroll = nullptr;
mAsyncScroll = nullptr;
RemoveObservers();
AutoWeakFrame weakFrame(mOuter);
ScrollToImpl(mDestination, aRange, aOrigin);
if (!weakFrame.IsAlive()) {
@ -4934,14 +4933,23 @@ ScrollFrameHelper::Destroy(PostDestroyData& aPostDestroyData)
mScrollActivityTimer->Cancel();
mScrollActivityTimer = nullptr;
}
RemoveObservers();
}
void
ScrollFrameHelper::RemoveObservers()
{
if (mAsyncScroll) {
mAsyncScroll->RemoveObserver();
mAsyncScroll = nullptr;
}
if (mAsyncSmoothMSDScroll) {
mAsyncSmoothMSDScroll->RemoveObserver();
mAsyncSmoothMSDScroll = nullptr;
}
}
/**
* Called when we want to update the scrollbar position, either because scrolling happened
* or the user moved the scrollbar position and we need to undo that (e.g., when the user

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

@ -690,6 +690,9 @@ protected:
bool IsForTextControlWithNoScrollbars() const;
// Removes any RefreshDriver observers we might have registered.
void RemoveObservers();
static void EnsureFrameVisPrefsCached();
static bool sFrameVisPrefsCached;
// The number of scrollports wide/high to expand when tracking frame visibility.