Bug 1301305 - Notify animations when they should synchronize with geometric animations; r=hiro
authorBrian Birtles <birtles@gmail.com>
Fri, 02 Dec 2016 10:21:11 +0900
changeset 325335 aea2d20ddd3495a0519bf6f6891be66b2fc99e3b
parent 325334 8f7a10d823e2dcc2fd9fa0a976443f4068ce7c1f
child 325336 f0c1e6b61ded83d3b646f55bb0f7cabdf822912b
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +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.