Bug 1506988 - Don't incorporate properties that are prevented from running on the compositor in GetPropertiesForCompositor. r=birtles
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Thu, 22 Nov 2018 03:57:59 +0000
changeset 504088 fc274ec5515e6b5f72f56b4e39097cbc1972f2e3
parent 504087 d639382fc76a4ffbbe119311b65fddf767dbeed7
child 504089 56460b8902bc75a17685c28423d5fcff7ee9c681
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles
bugs1506988
milestone65.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 1506988 - Don't incorporate properties that are prevented from running on the compositor in GetPropertiesForCompositor. r=birtles Now we no longer update the corresponding display items for the animations that are prevented from running on the compositor if the animations themselves don't generate any change hints, e.g the same value is specified in both 'from' and 'to' keyframes. So that we can enable the reftests that we had been suffering from continuous MozAfterPaint events. Depends on D12397 Differential Revision: https://phabricator.services.mozilla.com/D12369
dom/animation/KeyframeEffect.cpp
dom/animation/KeyframeEffect.h
layout/base/nsLayoutUtils.cpp
layout/reftests/transform-3d/reftest.list
--- a/dom/animation/KeyframeEffect.cpp
+++ b/dom/animation/KeyframeEffect.cpp
@@ -291,17 +291,18 @@ KeyframeEffect::GetEffectiveAnimationOfP
       result = &property;
     }
     return result;
   }
   return nullptr;
 }
 
 nsCSSPropertyIDSet
-KeyframeEffect::GetPropertiesForCompositor(const EffectSet& aEffects) const
+KeyframeEffect::GetPropertiesForCompositor(EffectSet& aEffects,
+                                           const nsIFrame* aFrame) const
 {
   MOZ_ASSERT(
     &aEffects ==
       EffectSet::GetEffectSet(mTarget->mElement, mTarget->mPseudoType));
 
   nsCSSPropertyIDSet properties;
 
   if (!IsInEffect() && !IsCurrent()) {
@@ -309,19 +310,27 @@ KeyframeEffect::GetPropertiesForComposit
   }
 
   static constexpr nsCSSPropertyIDSet compositorAnimatables =
     nsCSSPropertyIDSet::CompositorAnimatables();
   for (const AnimationProperty& property : mProperties) {
     if (!compositorAnimatables.HasProperty(property.mProperty)) {
       continue;
     }
-    if (IsEffectiveProperty(aEffects, property.mProperty)) {
-      properties.AddProperty(property.mProperty);
+
+    AnimationPerformanceWarning::Type warning;
+    KeyframeEffect::MatchForCompositor matchResult =
+      IsMatchForCompositor(property.mProperty, aFrame, aEffects, warning);
+    if (matchResult ==
+          KeyframeEffect::MatchForCompositor::NoAndBlockThisProperty ||
+        matchResult == KeyframeEffect::MatchForCompositor::No) {
+      continue;
     }
+
+    properties.AddProperty(property.mProperty);
   }
   return properties;
 }
 
 bool
 KeyframeEffect::HasAnimationOfProperty(nsCSSPropertyID aProperty) const
 {
   for (const AnimationProperty& property : mProperties) {
--- a/dom/animation/KeyframeEffect.h
+++ b/dom/animation/KeyframeEffect.h
@@ -214,17 +214,23 @@ public:
     nsCSSPropertyID aProperty, const EffectSet& aEffect) const;
 
   // Returns all the effective animated CSS properties that can be animated on
   // the compositor and are not overridden by a higher cascade level.
   //
   // NOTE: This function is basically called for all KeyframeEffects on an
   // element thus it takes |aEffects| to avoid multiple calls of
   // EffectSet::GetEffect().
-  nsCSSPropertyIDSet GetPropertiesForCompositor(const EffectSet& aEffects) const;
+  //
+  // NOTE(2): This function does NOT check that animations are permitted on
+  // |aFrame|. It is the responsibility of the caller to first call
+  // EffectCompositor::AllowCompositorAnimationsOnFrame for |aFrame|, or use
+  // nsLayoutUtils::GetAnimationPropertiesForCompositor instead.
+  nsCSSPropertyIDSet GetPropertiesForCompositor(EffectSet& aEffects,
+                                                const nsIFrame* aFrame) const;
 
   const InfallibleTArray<AnimationProperty>& Properties() const
   {
     return mProperties;
   }
 
   // Update |mProperties| by recalculating from |mKeyframes| using
   // |aComputedStyle| to resolve specified values.
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -334,18 +334,25 @@ nsLayoutUtils::GetAnimationPropertiesFor
 {
   nsCSSPropertyIDSet properties;
 
   EffectSet* effects = EffectSet::GetEffectSet(aFrame);
   if (!effects) {
     return properties;
   }
 
+  AnimationPerformanceWarning::Type warning;
+  if (!EffectCompositor::AllowCompositorAnimationsOnFrame(aFrame,
+                                                          *effects,
+                                                          warning)) {
+    return properties;
+  }
+
   for (const KeyframeEffect* effect : *effects) {
-    properties |= effect->GetPropertiesForCompositor(*effects);
+    properties |= effect->GetPropertiesForCompositor(*effects, aFrame);
   }
 
   return properties;
 }
 
 static float
 GetSuitableScale(float aMaxScale, float aMinScale,
                  nscoord aVisibleDimension, nscoord aDisplayDimension)
--- a/layout/reftests/transform-3d/reftest.list
+++ b/layout/reftests/transform-3d/reftest.list
@@ -66,19 +66,19 @@ fails-if(!layersGPUAccelerated) fuzzy-if
 != 1157984-1.html about:blank # Bug 1157984
 fuzzy(0-3,0-99) == animate-cube-radians.html animate-cube-radians-ref.html # subpixel AA
 fuzzy(0-3,0-99) fuzzy-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)&&!layersGPUAccelerated,0-16,0-6) == animate-cube-radians-zoom.html animate-cube-radians-zoom-ref.html
 != animate-cube-radians-ref.html animate-cube-radians-zoom-ref.html
 fuzzy(0-3,0-99) == animate-cube-degrees.html animate-cube-degrees-ref.html # subpixel AA
 == animate-cube-degrees-zoom.html animate-cube-degrees-zoom-ref.html
 != animate-cube-degrees-ref.html animate-cube-degrees-zoom-ref.html
 fuzzy-if(gtkWidget,0-128,0-100) fuzzy-if(Android||OSX==1010||(gtkWidget&&layersGPUAccelerated),0-143,0-100) fuzzy-if(winWidget||OSX<1010,0-141,0-100) == preserves3d-nested.html preserves3d-nested-ref.html
-skip-if(cocoaWidget&&webrender) fuzzy-if(cocoaWidget,0-128,0-9) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == animate-preserve3d-parent.html animate-preserve3d-ref.html # intermittently fuzzy on Mac
-skip-if(cocoaWidget&&webrender) fuzzy-if(cocoaWidget,0-128,0-9) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == animate-preserve3d-child.html animate-preserve3d-ref.html # intermittently fuzzy on Mac, bug 1461311 for Android
-skip-if(cocoaWidget&&webrender) == animate-backface-hidden.html about:blank # intermittent failure on MacOSX builds (bug 1505613)
+fuzzy-if(cocoaWidget,0-128,0-9) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == animate-preserve3d-parent.html animate-preserve3d-ref.html # intermittently fuzzy on Mac
+fuzzy-if(cocoaWidget,0-128,0-9) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == animate-preserve3d-child.html animate-preserve3d-ref.html # intermittently fuzzy on Mac, bug 1461311 for Android
+== animate-backface-hidden.html about:blank
 == 1245450-1.html green-rect.html
 fuzzy(0-1,0-2000) == opacity-preserve3d-1.html opacity-preserve3d-1-ref.html
 fuzzy(0-1,0-15000) == opacity-preserve3d-2.html opacity-preserve3d-2-ref.html
 fuzzy(0-1,0-10000) == opacity-preserve3d-3.html opacity-preserve3d-3-ref.html
 fuzzy(0-1,0-10000) == opacity-preserve3d-4.html opacity-preserve3d-4-ref.html
 == opacity-preserve3d-5.html opacity-preserve3d-5-ref.html
 == snap-perspective-1.html snap-perspective-1-ref.html
 == mask-layer-1.html mask-layer-ref.html