Bug 900783: Make HasAnimationOfProperty return false in the refresh driver tick in which the transition completes. r=nrc
authorL. David Baron <dbaron@dbaron.org>
Mon, 09 Sep 2013 12:21:24 +0200
changeset 146172 279c6aca048aef638dd52acaee524adfc796e4ed
parent 146171 b560ee360b68cc543a8aa38e721bbc9a4ea3c9ea
child 146173 2b26501fd20357d4dc10dd39fa36c47f5baf2ef3
push id25244
push userryanvm@gmail.com
push dateMon, 09 Sep 2013 20:03:14 +0000
treeherdermozilla-central@f320b8c034bd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnrc
bugs900783, 876626
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 900783: Make HasAnimationOfProperty return false in the refresh driver tick in which the transition completes. r=nrc I don't know of any observable bug that this fixes, but the code without this fix seems incorrect; the "removed sentinel" concept generally requires that callers enumerating transitions check that they're not enumerating the sentinel. This ensures that HasAnimationOfProperty switches from returning true to false in the first refresh cycle after the end of the animation rather than the second. I originally wrote this in https://bugzilla.mozilla.org/show_bug.cgi?id=876626#c13 but it turned out not to be related to that bug.
layout/style/nsTransitionManager.cpp
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -129,17 +129,18 @@ ElementPropertyTransition::IsRunningAt(T
          mStartTime <= aTime &&
          aTime < mStartTime + mDuration;
 }
 
 bool
 ElementTransitions::HasAnimationOfProperty(nsCSSProperty aProperty) const
 {
   for (uint32_t tranIdx = mPropertyTransitions.Length(); tranIdx-- != 0; ) {
-    if (aProperty == mPropertyTransitions[tranIdx].mProperty) {
+    const ElementPropertyTransition& pt = mPropertyTransitions[tranIdx];
+    if (aProperty == pt.mProperty && !pt.IsRemovedSentinel()) {
       return true;
     }
   }
   return false;
 }
 
 bool
 ElementTransitions::CanPerformOnCompositorThread(CanAnimateFlags aFlags) const