mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Bug 1226118 part 4 - Use EffectSet in ActiveLayerManager's animated-scale checks; r=dholbert
This commit is contained in:
parent
a92b5ec6ab
commit
7f1672cff8
@ -5,7 +5,9 @@
|
||||
#include "ActiveLayerTracker.h"
|
||||
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/dom/KeyframeEffect.h"
|
||||
#include "mozilla/gfx/Matrix.h"
|
||||
#include "mozilla/EffectSet.h"
|
||||
#include "mozilla/PodOperations.h"
|
||||
#include "nsExpirationTracker.h"
|
||||
#include "nsContainerFrame.h"
|
||||
@ -449,19 +451,15 @@ ActiveLayerTracker::IsOffsetOrMarginStyleAnimated(nsIFrame* aFrame)
|
||||
}
|
||||
|
||||
// A helper function for IsScaleSubjectToAnimation which returns true if the
|
||||
// given AnimationCollection contains a current effect that animates scale.
|
||||
// given EffectSet contains a current effect that animates scale.
|
||||
static bool
|
||||
ContainsAnimatedScale(AnimationCollection* aCollection, nsIFrame* aFrame)
|
||||
ContainsAnimatedScale(EffectSet& aEffects, nsIFrame* aFrame)
|
||||
{
|
||||
if (!aCollection) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (dom::Animation* anim : aCollection->mAnimations) {
|
||||
if (!anim->HasCurrentEffect()) {
|
||||
for (dom::KeyframeEffectReadOnly* effect : aEffects) {
|
||||
if (!effect->IsCurrent()) {
|
||||
continue;
|
||||
}
|
||||
KeyframeEffectReadOnly* effect = anim->GetEffect();
|
||||
|
||||
for (const AnimationProperty& prop : effect->Properties()) {
|
||||
if (prop.mProperty != eCSSProperty_transform) {
|
||||
continue;
|
||||
@ -491,27 +489,10 @@ ActiveLayerTracker::IsScaleSubjectToAnimation(nsIFrame* aFrame)
|
||||
return true;
|
||||
}
|
||||
|
||||
nsIContent* content = aFrame->GetContent();
|
||||
if (!content || !content->IsElement()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCSSPseudoElements::Type pseudoType =
|
||||
aFrame->StyleContext()->GetPseudoType();
|
||||
|
||||
// Check if any transitions associated with this frame may animate its scale.
|
||||
AnimationCollection* transitions =
|
||||
aFrame->PresContext()->TransitionManager()->GetAnimations(
|
||||
content->AsElement(), pseudoType, false /* don't create */);
|
||||
if (ContainsAnimatedScale(transitions, aFrame)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if any animations associated with this frame may animate its scale.
|
||||
AnimationCollection* animations =
|
||||
aFrame->PresContext()->AnimationManager()->GetAnimations(
|
||||
content->AsElement(), pseudoType, false /* don't create */);
|
||||
if (ContainsAnimatedScale(animations, aFrame)) {
|
||||
// Check if any animations, transitions, etc. associated with this frame may
|
||||
// animate its scale.
|
||||
EffectSet* effects = EffectSet::GetEffectSet(aFrame);
|
||||
if (effects && ContainsAnimatedScale(*effects, aFrame)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user