From de81d8832429ac449e036e48fb0d7ab796edf641 Mon Sep 17 00:00:00 2001 From: Glenn Watson Date: Wed, 27 Jan 2016 09:25:20 +1000 Subject: [PATCH] Add comment to explain callback ordering --- components/script/dom/document.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 9edc7bb9c35..b5672319837 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -1208,6 +1208,10 @@ impl Document { callback(*timing); } + // Only send the animation change state message after running any callbacks. + // This means that if the animation callback adds a new callback for + // the next frame (which is the common case), we won't send a NoAnimationCallbacksPresent + // message quickly followed by an AnimationCallbacksPresent message. if self.animation_frame_list.borrow().is_empty() { let ConstellationChan(ref chan) = self.window.constellation_chan(); let event = ConstellationMsg::ChangeRunningAnimationsState(self.window.pipeline(),