Bug 1218646 - Skip to check whether property can run on compositor or not if mWinsInCascade is false. r?birtles draft
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Fri, 25 Dec 2015 07:14:02 +0900
changeset 317629 4615d0bd037f1606813727428f77b8510f150451
parent 317276 35b211eaad1fa828064514c547057e4400e24459
child 512328 be0ff24f8b7e862e0b64a85a1964eabe6863b437
push id8730
push userhiikezoe@mozilla-japan.org
push dateThu, 24 Dec 2015 22:16:35 +0000
reviewersbirtles
bugs1218646
milestone46.0a1
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>