From bf9f389bdaad00902e3bb4a4a64de9fe3236f97f Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Wed, 6 Jan 2016 11:04:05 +0900 Subject: [PATCH] Bug 1228229 part 11 - Avoid calling nsRuleNode::ComputePropertiesOverridingAnimation when there are no compositor-animatable properties; r=dbaron This restores the code removed in part 3 but adjusts it to iterate over an effect set instead of an AnimationCollection. It also adds an early return for the case where no compositor-animatable properties are found. --HG-- extra : rebase_source : 5e73374c8fb7df4e946f73512337a55f5dae94f2 --- dom/animation/EffectCompositor.cpp | 29 +++++++++++++++++++++++++---- dom/animation/EffectCompositor.h | 7 ++++--- 2 files changed, 29 insertions(+), 7 deletions(-) diff --git a/dom/animation/EffectCompositor.cpp b/dom/animation/EffectCompositor.cpp index 9b1baa27c61e..1b8940910cd7 100644 --- a/dom/animation/EffectCompositor.cpp +++ b/dom/animation/EffectCompositor.cpp @@ -16,6 +16,7 @@ #include "nsAnimationManager.h" #include "nsComputedDOMStyle.h" // nsComputedDOMStyle::GetPresShellForContent #include "nsCSSPropertySet.h" +#include "nsCSSProps.h" #include "nsIPresShell.h" #include "nsLayoutUtils.h" #include "nsRuleNode.h" // For nsRuleNode::ComputePropertiesOverridingAnimation @@ -225,14 +226,34 @@ EffectCompositor::GetAnimationElementAndPseudoForFrame(const nsIFrame* aFrame) /* static */ void EffectCompositor::GetOverriddenProperties(nsStyleContext* aStyleContext, + EffectSet& aEffectSet, nsCSSPropertySet& aPropertiesOverridden) { nsAutoTArray propertiesToTrack; - for (const LayerAnimationInfo::Record& record : - LayerAnimationInfo::sRecords) { - propertiesToTrack.AppendElement(record.mProperty); + { + nsCSSPropertySet propertiesToTrackAsSet; + for (KeyframeEffectReadOnly* effect : aEffectSet) { + for (const AnimationProperty& property : effect->Properties()) { + if (nsCSSProps::PropHasFlags(property.mProperty, + CSS_PROPERTY_CAN_ANIMATE_ON_COMPOSITOR) && + !propertiesToTrackAsSet.HasProperty(property.mProperty)) { + propertiesToTrackAsSet.AddProperty(property.mProperty); + propertiesToTrack.AppendElement(property.mProperty); + } + } + // Skip iterating over the rest of the effects if we've already + // found all the compositor-animatable properties. + if (propertiesToTrack.Length() == LayerAnimationInfo::kRecords) { + break; + } + } } + + if (propertiesToTrack.IsEmpty()) { + return; + } + nsRuleNode::ComputePropertiesOverridingAnimation(propertiesToTrack, aStyleContext, aPropertiesOverridden); @@ -265,7 +286,7 @@ EffectCompositor::UpdateCascadeResults(EffectSet& aEffectSet, // cascade applies. nsCSSPropertySet overriddenProperties; if (aStyleContext) { - GetOverriddenProperties(aStyleContext, overriddenProperties); + GetOverriddenProperties(aStyleContext, aEffectSet, overriddenProperties); } bool changed = false; diff --git a/dom/animation/EffectCompositor.h b/dom/animation/EffectCompositor.h index 013139c65c18..ed6c8954632e 100644 --- a/dom/animation/EffectCompositor.h +++ b/dom/animation/EffectCompositor.h @@ -73,11 +73,12 @@ public: GetAnimationElementAndPseudoForFrame(const nsIFrame* aFrame); private: - // Get the properties that we are able to animate on the compositor that - // are specified at a higher level in the cascade than the animations - // level in |aStyleContext|. + // Get the properties in |aEffectSet| that we are able to animate on the + // compositor but which are also specified at a higher level in the cascade + // than the animations level in |aStyleContext|. static void GetOverriddenProperties(nsStyleContext* aStyleContext, + EffectSet& aEffectSet, nsCSSPropertySet& aPropertiesOverridden); static void