Bug 1218646 - Skip to check whether property can run on compositor or not if mWinsInCascade is false. r=birtles
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Fri, 25 Dec 2015 07:14:02 +0900
changeset 312789 aa1170c267414e5d32d86d51098d56b61df1127e
parent 312788 84163eb4992b55414c20f471daacca9ac475d132
child 312790 3196d7dae075e80f1c62c461e30ebd50c5d13342
push id5703
push userraliiev@mozilla.com
push dateMon, 07 Mar 2016 14:18:41 +0000
treeherdermozilla-beta@31e373ad5b5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles
bugs1218646
milestone46.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 1218646 - Skip to check whether property can run on compositor or not if mWinsInCascade is false. r=birtles
dom/animation/KeyframeEffect.cpp
dom/animation/test/chrome/test_running_on_compositor.html
--- a/dom/animation/KeyframeEffect.cpp
+++ b/dom/animation/KeyframeEffect.cpp
@@ -2011,16 +2011,21 @@ KeyframeEffectReadOnly::ShouldBlockCompo
   // to update this to only return true when that is the case since paused,
   // filling, cancelled Animations etc. shouldn't stop other Animations from
   // running on the compositor.
   MOZ_ASSERT(mAnimation && mAnimation->IsPlaying());
 
   bool shouldLog = nsLayoutUtils::IsAnimationLoggingEnabled();
 
   for (const AnimationProperty& property : mProperties) {
+    // If a property is overridden in the CSS cascade, it should not block other
+    // animations from running on the compositor.
+    if (!property.mWinsInCascade) {
+      continue;
+    }
     // Check for geometric properties
     if (IsGeometricProperty(property.mProperty)) {
       if (shouldLog) {
         nsCString message;
         message.AppendLiteral("Performance warning: Async animation of "
           "'transform' or 'opacity' not possible due to animation of geometric"
           "properties on the same element");
         AnimationUtils::LogAsyncAnimationFailure(message, aFrame->GetContent());
--- a/dom/animation/test/chrome/test_running_on_compositor.html
+++ b/dom/animation/test/chrome/test_running_on_compositor.html
@@ -15,16 +15,20 @@
 }
 @keyframes background {
   to { background-color: red; }
 }
 @keyframes rotate {
   from { transform: rotate(0deg); }
   to { transform: rotate(360deg); }
 }
+@keyframes rotate_and_opacity {
+  from { transform: rotate(0deg); opacity: 1;}
+  to { transform: rotate(360deg); opacity: 0;}
+}
 div {
   /* Element needs geometry to be eligible for layerization */
   width: 100px;
   height: 100px;
   background-color: white;
 }
 </style>
 </head>
@@ -260,10 +264,27 @@ promise_test(function(t) {
 
   return animation.ready.then(t.step_func(function() {
     assert_equals(animation.isRunningOnCompositor, omtaEnabled,
        'Transition reports that it is running on the compositor'
        + ' during playback for opacity transition');
   }));
 }, 'isRunningOnCompositor for transitions');
 
+promise_test(function(t) {
+  var div = addDiv(t, { style: 'animation: rotate_and_opacity 100s; ' +
+                               'backface-visibility: hidden; ' +
+                               'transform: none !important;' });
+  var animation = div.getAnimations()[0];
+
+  return animation.ready.then(t.step_func(function() {
+    assert_equals(animation.isRunningOnCompositor, omtaEnabled,
+       'If an animation has a property that can run on the compositor and a '
+       + 'property that cannot (due to Gecko limitations) but where the latter'
+       + 'property is overridden in the CSS cascade, the animation should '
+       + 'still report that it is running on the compositor');
+  }));
+}, 'isRunningOnCompositor is true when a property that would otherwise block ' +
+   'running on the compositor is overridden in the CSS cascade');
+
+</script>
 </script>
 </body>