Bug 1226118 part 12b - Rename CommonAnimationManager::GetAnimations to GetAnimationCollection; r=dholbert

This is to align with the existing GetAnimationCollection method that takes
a frame. Also, by making this name more specific hopefully it will be used less
since we are trying to move as much code as possible over to using EffectSet
instead of AnimationCollection.
This commit is contained in:
Brian Birtles 2015-12-04 08:34:17 +09:00
Родитель e0492c55ba
Коммит f82ce867cf
5 изменённых файлов: 39 добавлений и 24 удалений

Просмотреть файл

@ -1204,7 +1204,9 @@ Animation::GetCollection() const
MOZ_ASSERT(targetElement,
"An animation with an animation manager must have a target");
return manager->GetAnimations(targetElement, targetPseudoType, false);
return manager->GetAnimationCollection(targetElement,
targetPseudoType,
false /* aCreateIfNeeded */);
}
void

Просмотреть файл

@ -236,9 +236,10 @@ CommonAnimationManager::ExtractComputedValueForTransition(
}
AnimationCollection*
CommonAnimationManager::GetAnimations(dom::Element *aElement,
nsCSSPseudoElements::Type aPseudoType,
bool aCreateIfNeeded)
CommonAnimationManager::GetAnimationCollection(dom::Element *aElement,
nsCSSPseudoElements::Type
aPseudoType,
bool aCreateIfNeeded)
{
if (!aCreateIfNeeded && mElementCollections.isEmpty()) {
// Early return for the most common case.
@ -318,7 +319,7 @@ CommonAnimationManager::GetAnimationRule(mozilla::dom::Element* aElement,
}
AnimationCollection* collection =
GetAnimations(aElement, aPseudoType, false);
GetAnimationCollection(aElement, aPseudoType, false /* aCreateIfNeeded */);
if (!collection) {
return nullptr;
}

Просмотреть файл

@ -73,11 +73,6 @@ public:
// elements.
void AddStyleUpdatesTo(RestyleTracker& aTracker);
AnimationCollection*
GetAnimations(dom::Element *aElement,
nsCSSPseudoElements::Type aPseudoType,
bool aCreateIfNeeded);
// Returns true if aContent or any of its ancestors has an animation
// or transition.
static bool ContentOrAncestorHasAnimation(nsIContent* aContent) {
@ -120,7 +115,14 @@ protected:
virtual nsIAtom* GetAnimationsAfterAtom() = 0;
public:
// Given the frame aFrame with possibly animated content, finds its
// Get (and optionally create) the collection of animations managed
// by this class for the given |aElement| and |aPseudoType|.
AnimationCollection*
GetAnimationCollection(dom::Element *aElement,
nsCSSPseudoElements::Type aPseudoType,
bool aCreateIfNeeded);
// Given the frame |aFrame| with possibly animated content, finds its
// associated collection of animations. If it is a generated content
// frame, it may examine the parent frame to search for such animations.
AnimationCollection*

Просмотреть файл

@ -403,7 +403,9 @@ nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext,
const nsStyleDisplay* disp = aStyleContext->StyleDisplay();
AnimationCollection* collection =
GetAnimations(aElement, aStyleContext->GetPseudoType(), false);
GetAnimationCollection(aElement,
aStyleContext->GetPseudoType(),
false /* aCreateIfNeeded */);
if (!collection &&
disp->mAnimationNameCount == 1 &&
disp->mAnimations[0].GetName().IsEmpty()) {
@ -536,8 +538,9 @@ nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext,
}
}
} else {
collection =
GetAnimations(aElement, aStyleContext->GetPseudoType(), true);
collection = GetAnimationCollection(aElement,
aStyleContext->GetPseudoType(),
true /* aCreateIfNeeded */);
for (Animation* animation : newAnimations) {
// FIXME: Bug 1134163 - As above, we have shouldn't actually need to
// queue events here. (But we do for now since some tests expect
@ -575,7 +578,7 @@ nsAnimationManager::StopAnimationsForElement(
{
MOZ_ASSERT(aElement);
AnimationCollection* collection =
GetAnimations(aElement, aPseudoType, false);
GetAnimationCollection(aElement, aPseudoType, false /* aCreateIfNeeded */);
if (!collection) {
return;
}

Просмотреть файл

@ -304,7 +304,8 @@ nsTransitionManager::StyleContextChanged(dom::Element *aElement,
aElement = aElement->GetParent()->AsElement();
}
AnimationCollection* collection = GetAnimations(aElement, pseudoType, false);
AnimationCollection* collection =
GetAnimationCollection(aElement, pseudoType, false /* aCreateIfNeeded */);
if (!collection &&
disp->mTransitionPropertyCount == 1 &&
disp->mTransitions[0].GetCombinedDuration() <= 0.0f) {
@ -703,7 +704,9 @@ nsTransitionManager::ConsiderStartingTransition(
if (!aElementTransitions) {
aElementTransitions =
GetAnimations(aElement, aNewStyleContext->GetPseudoType(), true);
GetAnimationCollection(aElement,
aNewStyleContext->GetPseudoType(),
true /* aCreateIfNeeded */);
if (!aElementTransitions) {
NS_WARNING("allocating CommonAnimationManager failed");
return;
@ -743,7 +746,8 @@ nsTransitionManager::PruneCompletedTransitions(mozilla::dom::Element* aElement,
aPseudoType,
nsStyleContext* aNewStyleContext)
{
AnimationCollection* collection = GetAnimations(aElement, aPseudoType, false);
AnimationCollection* collection =
GetAnimationCollection(aElement, aPseudoType, false /* aCreateIfNeeded */);
if (!collection) {
return;
}
@ -796,8 +800,9 @@ nsTransitionManager::UpdateCascadeResultsWithTransitions(
AnimationCollection* aTransitions)
{
AnimationCollection* animations = mPresContext->AnimationManager()->
GetAnimations(aTransitions->mElement,
aTransitions->PseudoElementType(), false);
GetAnimationCollection(aTransitions->mElement,
aTransitions->PseudoElementType(),
false /* aCreateIfNeeded */);
UpdateCascadeResults(aTransitions, animations);
}
@ -806,8 +811,9 @@ nsTransitionManager::UpdateCascadeResultsWithAnimations(
AnimationCollection* aAnimations)
{
AnimationCollection* transitions = mPresContext->TransitionManager()->
GetAnimations(aAnimations->mElement,
aAnimations->PseudoElementType(), false);
GetAnimationCollection(aAnimations->mElement,
aAnimations->PseudoElementType(),
false /* aCreateIfNeeded */);
UpdateCascadeResults(transitions, aAnimations);
}
@ -820,8 +826,9 @@ nsTransitionManager::UpdateCascadeResultsWithAnimationsToBeDestroyed(
// information that may now be incorrect.
AnimationCollection* transitions =
mPresContext->TransitionManager()->
GetAnimations(aAnimations->mElement,
aAnimations->PseudoElementType(), false);
GetAnimationCollection(aAnimations->mElement,
aAnimations->PseudoElementType(),
false /* aCreateIfNeeded */);
UpdateCascadeResults(transitions, nullptr);
}