mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1182981 part 2 - Use nsTHashtable::Iterator in AnimationTimeline; r=njn
This commit is contained in:
parent
9a4df31364
commit
8ea5b02209
@ -20,46 +20,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AnimationTimeline)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
namespace {
|
||||
struct AddAnimationParams {
|
||||
AnimationTimeline::AnimationSequence& mSequence;
|
||||
#ifdef DEBUG
|
||||
// This is only used for a pointer-equality assertion
|
||||
AnimationTimeline* mTimeline;
|
||||
#endif
|
||||
};
|
||||
} // namespace
|
||||
|
||||
static PLDHashOperator
|
||||
AppendAnimationToSequence(nsRefPtrHashKey<dom::Animation>* aKey,
|
||||
void* aParams)
|
||||
{
|
||||
Animation* animation = aKey->GetKey();
|
||||
AddAnimationParams* params = static_cast<AddAnimationParams*>(aParams);
|
||||
|
||||
MOZ_ASSERT(animation->IsRelevant(),
|
||||
"Animations registered with a timeline should be relevant");
|
||||
MOZ_ASSERT(animation->GetTimeline() == params->mTimeline,
|
||||
"Animation should refer to this timeline");
|
||||
|
||||
// Bug 1174575: Until we implement a suitable PseudoElement interface we
|
||||
// don't have anything to return for the |target| attribute of
|
||||
// KeyframeEffect(ReadOnly) objects that refer to pseudo-elements.
|
||||
// Rather than return some half-baked version of these objects (e.g.
|
||||
// we a null effect attribute) we simply don't provide access to animations
|
||||
// whose effect refers to a pseudo-element until we can support them properly.
|
||||
Element* target;
|
||||
nsCSSPseudoElements::Type pseudoType;
|
||||
animation->GetEffect()->GetTarget(target, pseudoType);
|
||||
if (pseudoType != nsCSSPseudoElements::ePseudo_NotPseudoElement) {
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
params->mSequence.AppendElement(animation);
|
||||
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
void
|
||||
AnimationTimeline::GetAnimations(AnimationSequence& aAnimations)
|
||||
{
|
||||
@ -71,12 +31,28 @@ AnimationTimeline::GetAnimations(AnimationSequence& aAnimations)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
AddAnimationParams params{ aAnimations, this };
|
||||
#else
|
||||
AddAnimationParams params{ aAnimations };
|
||||
#endif
|
||||
mAnimations.EnumerateEntries(AppendAnimationToSequence, ¶ms);
|
||||
for (auto iter = mAnimations.Iter(); !iter.Done(); iter.Next()) {
|
||||
Animation* animation = iter.Get()->GetKey();
|
||||
|
||||
MOZ_ASSERT(animation->IsRelevant(),
|
||||
"Animations registered with a timeline should be relevant");
|
||||
MOZ_ASSERT(animation->GetTimeline() == this,
|
||||
"Animation should refer to this timeline");
|
||||
|
||||
// Bug 1174575: Until we implement a suitable PseudoElement interface we
|
||||
// don't have anything to return for the |target| attribute of
|
||||
// KeyframeEffect(ReadOnly) objects that refer to pseudo-elements.
|
||||
// Rather than return some half-baked version of these objects (e.g.
|
||||
// we a null effect attribute) we simply don't provide access to animations
|
||||
// whose effect refers to a pseudo-element until we can support them
|
||||
// properly.
|
||||
Element* target;
|
||||
nsCSSPseudoElements::Type pseudoType;
|
||||
animation->GetEffect()->GetTarget(target, pseudoType);
|
||||
if (pseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement) {
|
||||
aAnimations.AppendElement(animation);
|
||||
}
|
||||
}
|
||||
|
||||
// Sort animations by priority
|
||||
aAnimations.Sort(AnimationPtrComparator<nsRefPtr<Animation>>());
|
||||
|
Loading…
Reference in New Issue
Block a user