зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1341372 - Part 4: Add a utility method to get AnimationCollection by Element and nsIAtom. r=hiro
We need a utility method to get the AnimationCollection by dom::Element and the pseudo element tag. MozReview-Commit-ID: KCOY6EKFFX5 --HG-- extra : rebase_source : de1b9386d6324cfb4cee0d84b13a0b1af4aa5c12
This commit is contained in:
Родитель
f074c41907
Коммит
61b7e58f8a
|
@ -58,6 +58,25 @@ AnimationCollection<AnimationType>::GetAnimationCollection(
|
|||
GetProperty(propName));
|
||||
}
|
||||
|
||||
template <class AnimationType>
|
||||
/* static */ AnimationCollection<AnimationType>*
|
||||
AnimationCollection<AnimationType>::GetAnimationCollection(
|
||||
const dom::Element *aElement,
|
||||
nsIAtom* aPseudoTagOrNull)
|
||||
{
|
||||
MOZ_ASSERT(!aPseudoTagOrNull ||
|
||||
aPseudoTagOrNull == nsCSSPseudoElements::before ||
|
||||
aPseudoTagOrNull == nsCSSPseudoElements::after);
|
||||
|
||||
CSSPseudoElementType pseudoType = CSSPseudoElementType::NotPseudo;
|
||||
if (aPseudoTagOrNull) {
|
||||
pseudoType = aPseudoTagOrNull == nsCSSPseudoElements::before
|
||||
? CSSPseudoElementType::before
|
||||
: CSSPseudoElementType::after;
|
||||
}
|
||||
return GetAnimationCollection(aElement, pseudoType);
|
||||
}
|
||||
|
||||
template <class AnimationType>
|
||||
/* static */ AnimationCollection<AnimationType>*
|
||||
AnimationCollection<AnimationType>::GetAnimationCollection(
|
||||
|
|
|
@ -70,6 +70,12 @@ public:
|
|||
GetAnimationCollection(const dom::Element* aElement,
|
||||
CSSPseudoElementType aPseudoType);
|
||||
|
||||
// Get the collection of animations for the given |aElement| and
|
||||
// |aPseudoTagOrNull|.
|
||||
static AnimationCollection<AnimationType>*
|
||||
GetAnimationCollection(const dom::Element* aElement,
|
||||
nsIAtom* aPseudoTagOrNull);
|
||||
|
||||
// Given the frame |aFrame| with possibly animated content, finds its
|
||||
// associated collection of animations. If |aFrame| is a generated content
|
||||
// frame, this function may examine the parent frame to search for such
|
||||
|
|
|
@ -513,16 +513,9 @@ bool
|
|||
Gecko_ElementHasCSSAnimations(RawGeckoElementBorrowed aElement,
|
||||
nsIAtom* aPseudoTagOrNull)
|
||||
{
|
||||
MOZ_ASSERT(!aPseudoTagOrNull ||
|
||||
aPseudoTagOrNull == nsCSSPseudoElements::before ||
|
||||
aPseudoTagOrNull == nsCSSPseudoElements::after);
|
||||
|
||||
CSSPseudoElementType pseudoType =
|
||||
nsCSSPseudoElements::GetPseudoType(aPseudoTagOrNull,
|
||||
CSSEnabledState::eForAllContent);
|
||||
nsAnimationManager::CSSAnimationCollection* collection =
|
||||
nsAnimationManager::CSSAnimationCollection
|
||||
::GetAnimationCollection(aElement, pseudoType);
|
||||
::GetAnimationCollection(aElement, aPseudoTagOrNull);
|
||||
|
||||
return collection && !collection->mAnimations.IsEmpty();
|
||||
}
|
||||
|
@ -531,16 +524,9 @@ bool
|
|||
Gecko_ElementHasCSSTransitions(RawGeckoElementBorrowed aElement,
|
||||
nsIAtom* aPseudoTagOrNull)
|
||||
{
|
||||
MOZ_ASSERT(!aPseudoTagOrNull ||
|
||||
aPseudoTagOrNull == nsCSSPseudoElements::before ||
|
||||
aPseudoTagOrNull == nsCSSPseudoElements::after);
|
||||
|
||||
CSSPseudoElementType pseudoType =
|
||||
nsCSSPseudoElements::GetPseudoType(aPseudoTagOrNull,
|
||||
CSSEnabledState::eForAllContent);
|
||||
nsTransitionManager::CSSTransitionCollection* collection =
|
||||
nsTransitionManager::CSSTransitionCollection
|
||||
::GetAnimationCollection(aElement, pseudoType);
|
||||
::GetAnimationCollection(aElement, aPseudoTagOrNull);
|
||||
|
||||
return collection && !collection->mAnimations.IsEmpty();
|
||||
}
|
||||
|
@ -549,16 +535,9 @@ size_t
|
|||
Gecko_ElementTransitions_Length(RawGeckoElementBorrowed aElement,
|
||||
nsIAtom* aPseudoTagOrNull)
|
||||
{
|
||||
MOZ_ASSERT(!aPseudoTagOrNull ||
|
||||
aPseudoTagOrNull == nsCSSPseudoElements::before ||
|
||||
aPseudoTagOrNull == nsCSSPseudoElements::after);
|
||||
|
||||
CSSPseudoElementType pseudoType =
|
||||
nsCSSPseudoElements::GetPseudoType(aPseudoTagOrNull,
|
||||
CSSEnabledState::eForAllContent);
|
||||
nsTransitionManager::CSSTransitionCollection* collection =
|
||||
nsTransitionManager::CSSTransitionCollection
|
||||
::GetAnimationCollection(aElement, pseudoType);
|
||||
::GetAnimationCollection(aElement, aPseudoTagOrNull);
|
||||
|
||||
return collection ? collection->mAnimations.Length() : 0;
|
||||
}
|
||||
|
@ -568,16 +547,9 @@ GetCurrentTransitionAt(RawGeckoElementBorrowed aElement,
|
|||
nsIAtom* aPseudoTagOrNull,
|
||||
size_t aIndex)
|
||||
{
|
||||
MOZ_ASSERT(!aPseudoTagOrNull ||
|
||||
aPseudoTagOrNull == nsCSSPseudoElements::before ||
|
||||
aPseudoTagOrNull == nsCSSPseudoElements::after);
|
||||
|
||||
CSSPseudoElementType pseudoType =
|
||||
nsCSSPseudoElements::GetPseudoType(aPseudoTagOrNull,
|
||||
CSSEnabledState::eForAllContent);
|
||||
nsTransitionManager::CSSTransitionCollection* collection =
|
||||
nsTransitionManager::CSSTransitionCollection
|
||||
::GetAnimationCollection(aElement, pseudoType);
|
||||
::GetAnimationCollection(aElement, aPseudoTagOrNull);
|
||||
if (!collection) {
|
||||
return nullptr;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче