summaryrefslogtreecommitdiffstats
path: root/layout/base/nsRefreshDriver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'layout/base/nsRefreshDriver.cpp')
-rw-r--r--layout/base/nsRefreshDriver.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/layout/base/nsRefreshDriver.cpp b/layout/base/nsRefreshDriver.cpp
index a5c2b1ded9..7885d6b8db 100644
--- a/layout/base/nsRefreshDriver.cpp
+++ b/layout/base/nsRefreshDriver.cpp
@@ -1528,6 +1528,16 @@ void nsRefreshDriver::PostScrollEvent(mozilla::Runnable* aScrollEvent,
}
}
+void nsRefreshDriver::PostScrollEndEvent(mozilla::Runnable* aScrollEndEvent,
+ bool aDelayed) {
+ if (aDelayed) {
+ mDelayedScrollEndEvents.AppendElement(aScrollEndEvent);
+ } else {
+ mScrollEndEvents.AppendElement(aScrollEndEvent);
+ EnsureTimerStarted();
+ }
+}
+
void nsRefreshDriver::DispatchScrollEvents() {
// Scroll events are one-shot, so after running them we can drop them.
// However, dispatching a scroll event can potentially cause more scroll
@@ -1539,6 +1549,13 @@ void nsRefreshDriver::DispatchScrollEvents() {
}
}
+void nsRefreshDriver::DispatchScrollEndEvents() {
+ ScrollEventArray events = std::move(mScrollEndEvents);
+ for (auto& event : events) {
+ event->Run();
+ }
+}
+
void nsRefreshDriver::PostVisualViewportScrollEvent(
VVPScrollEvent* aScrollEvent) {
mVisualViewportScrollEvents.AppendElement(aScrollEvent);
@@ -1673,6 +1690,9 @@ void nsRefreshDriver::RunDelayedEventsSoon() {
mScrollEvents.AppendElements(mDelayedScrollEvents);
mDelayedScrollEvents.Clear();
+ mScrollEndEvents.AppendElements(mDelayedScrollEvents);
+ mDelayedScrollEndEvents.Clear();
+
mResizeEventFlushObservers.AppendElements(mDelayedResizeEventFlushObservers);
mDelayedResizeEventFlushObservers.Clear();
@@ -2008,7 +2028,7 @@ auto nsRefreshDriver::GetReasonsToTick() const -> TickReasons {
if (!mVisualViewportResizeEvents.IsEmpty()) {
reasons |= TickReasons::eHasVisualViewportResizeEvents;
}
- if (!mScrollEvents.IsEmpty()) {
+ if (!mScrollEvents.IsEmpty() || !mScrollEndEvents.IsEmpty()) {
reasons |= TickReasons::eHasScrollEvents;
}
if (!mVisualViewportScrollEvents.IsEmpty()) {
@@ -2476,6 +2496,7 @@ bool nsRefreshDriver::TickObserverArray(uint32_t aIdx, TimeStamp aNowTime) {
FlushAutoFocusDocuments();
DispatchScrollEvents();
DispatchVisualViewportScrollEvents();
+ DispatchScrollEndEvents();
EvaluateMediaQueriesAndReportChanges();
DispatchAnimationEvents();
RunFullscreenSteps();