Bug 1301305 - Notify animations when they should synchronize with geometric animations; r?hiro draft
authorBrian Birtles <birtles@gmail.com>
Fri, 02 Dec 2016 10:21:11 +0900
changeset 447583 64322a0166d97b85ba3e4d7f752c8501774b77ef
parent 447582 59d2fea0458f833a97a3b32413930f9970c7eddb
child 447584 ec757beec11a107272e69ab40323fac4e3980911
push id38084
push userbbirtles@mozilla.com
push dateTue, 06 Dec 2016 07:57:40 +0000
reviewershiro
bugs1301305
milestone53.0a1
Bug 1301305 - Notify animations when they should synchronize with geometric animations; r?hiro MozReview-Commit-ID: 9Ploi5UwseA
devtools/client/animationinspector/test/browser_animation_animated_properties_displayed.js
dom/animation/EffectCompositor.cpp
dom/animation/test/chrome/test_animation_performance_warning.html
--- a/devtools/client/animationinspector/test/browser_animation_animated_properties_displayed.js
+++ b/devtools/client/animationinspector/test/browser_animation_animated_properties_displayed.js
@@ -77,15 +77,15 @@ function hasExpectedProperties(container
 
   return true;
 }
 
 function hasExpectedWarnings(containerEl) {
   let warnings = [...containerEl.querySelectorAll(".warning")];
   for (let warning of warnings) {
     let warningID =
-      "CompositorAnimationWarningTransformWithGeometricProperties";
+      "CompositorAnimationWarningTransformWithSyncGeometricAnimations";
     if (warning.getAttribute("title") == LAYOUT_ERRORS_L10N.getStr(warningID)) {
       return true;
     }
   }
   return false;
 }
--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -120,16 +120,28 @@ FindAnimationsForCompositor(const nsIFra
   MOZ_ASSERT(!aMatches || aMatches->IsEmpty(),
              "Matches array, if provided, should be empty");
 
   EffectSet* effects = EffectSet::GetEffectSet(aFrame);
   if (!effects || effects->IsEmpty()) {
     return false;
   }
 
+  // First check for newly-started transform animations that should be
+  // synchronized with geometric animations. We need to do this before any
+  // other early returns (the one above is ok) since we can only check this
+  // state when the animation is newly-started.
+  if (aProperty == eCSSProperty_transform) {
+    PendingAnimationTracker* tracker =
+      aFrame->PresContext()->Document()->GetPendingAnimationTracker();
+    if (tracker) {
+      tracker->MarkAnimationsThatMightNeedSynchronization();
+    }
+  }
+
   // If the property will be added to the animations level of the cascade but
   // there is an !important rule for that property in the cascade then the
   // animation will not be applied since the !important rule overrides it.
   if (effects->PropertiesWithImportantRules().HasProperty(aProperty) &&
       effects->PropertiesForAnimationsLevel().HasProperty(aProperty)) {
     return false;
   }
 
--- a/dom/animation/test/chrome/test_animation_performance_warning.html
+++ b/dom/animation/test/chrome/test_animation_performance_warning.html
@@ -316,17 +316,17 @@ function testSetOfGeometricProperties() 
           [
             {
               property,
               runningOnCompositor: false
             },
             {
               property: 'transform',
               runningOnCompositor: false,
-              warning: 'CompositorAnimationWarningTransformWithGeometricProperties'
+              warning: 'CompositorAnimationWarningTransformWithSyncGeometricAnimations'
             }
           ]);
       }, 'Transform animation should be run on the main thread');
     }, `${property} is treated as a geometric property`);
   });
 }
 
 // Performance warning tests that set and clear a style property.