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.
This commit is contained in:
Brian Birtles 2016-01-06 11:04:05 +09:00
parent e3dba52363
commit 26b701c0cc
2 changed files with 29 additions and 7 deletions

View File

@ -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<nsCSSProperty, LayerAnimationInfo::kRecords> 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;

View File

@ -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