зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1046055 part 4 - Add HasCurrentAnimationsForProperty to nsLayoutUtils; r=dbaron
This patch adds a method to nsLayoutUtils, alongside the existing HasCurrentAnimations, that returns true if there exists an unfinished animation on the element for the specified property.
This commit is contained in:
Родитель
139a4e3a73
Коммит
d77b5db74f
|
@ -405,6 +405,26 @@ nsLayoutUtils::HasCurrentAnimations(nsIContent* aContent,
|
|||
return (collection && collection->HasCurrentAnimations());
|
||||
}
|
||||
|
||||
bool
|
||||
nsLayoutUtils::HasCurrentAnimationsForProperty(nsIContent* aContent,
|
||||
nsCSSProperty aProperty)
|
||||
{
|
||||
if (!aContent->MayHaveAnimations())
|
||||
return false;
|
||||
|
||||
static nsIAtom* const sAnimProps[] = { nsGkAtoms::transitionsProperty,
|
||||
nsGkAtoms::animationsProperty,
|
||||
nullptr };
|
||||
for (nsIAtom* const* animProp = sAnimProps; *animProp; animProp++) {
|
||||
AnimationPlayerCollection* collection =
|
||||
static_cast<AnimationPlayerCollection*>(aContent->GetProperty(*animProp));
|
||||
if (collection && collection->HasCurrentAnimationsForProperty(aProperty))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static gfxSize
|
||||
GetScaleForValue(const StyleAnimationValue& aValue, nsIFrame* aFrame)
|
||||
{
|
||||
|
|
|
@ -1879,13 +1879,21 @@ public:
|
|||
static bool HasAnimations(nsIContent* aContent, nsCSSProperty aProperty);
|
||||
|
||||
/**
|
||||
* Returns true if the content node has any current animations or transitions.
|
||||
* Returns true if the content node has any current animations or transitions
|
||||
* (depending on the value of |aAnimationProperty|).
|
||||
* A current animation is any animation that has not yet finished playing
|
||||
* including paused animations.
|
||||
*/
|
||||
static bool HasCurrentAnimations(nsIContent* aContent,
|
||||
nsIAtom* aAnimationProperty);
|
||||
|
||||
/**
|
||||
* Returns true if the content node has any current animations or transitions
|
||||
* for the specified property.
|
||||
*/
|
||||
static bool HasCurrentAnimationsForProperty(nsIContent* aContent,
|
||||
nsCSSProperty aProperty);
|
||||
|
||||
/**
|
||||
* Checks if off-main-thread animations are enabled.
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче