зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1004383 part 2 - Rename StyleAnimation to ElementAnimation; r=dholbert
We currently have mozilla::StyleAnimation as well as nsStyleAnimation. This patch renames StyleAnimation back to ElementAnimation. Although ElementAnimation is very similar to ElementAnimations, in the near future we expect to retire ElementAnimations and replace it with a common AnimationSet-like structure that is covers the features of ElementAnimations and ElementTransitions.
This commit is contained in:
Родитель
7595a03399
Коммит
92e305760e
|
@ -313,7 +313,7 @@ ToTimingFunction(css::ComputedTimingFunction& aCTF)
|
|||
|
||||
static void
|
||||
AddAnimationForProperty(nsIFrame* aFrame, nsCSSProperty aProperty,
|
||||
mozilla::StyleAnimation* ea, Layer* aLayer,
|
||||
mozilla::ElementAnimation* ea, Layer* aLayer,
|
||||
AnimationData& aData, bool aPending)
|
||||
{
|
||||
NS_ASSERTION(aLayer->AsContainerLayer(), "Should only animate ContainerLayer");
|
||||
|
@ -377,7 +377,7 @@ AddAnimationsForProperty(nsIFrame* aFrame, nsCSSProperty aProperty,
|
|||
mozilla::TimeStamp currentTime =
|
||||
aFrame->PresContext()->RefreshDriver()->MostRecentRefresh();
|
||||
for (uint32_t animIdx = 0; animIdx < aAnimations.Length(); animIdx++) {
|
||||
mozilla::StyleAnimation* anim = aAnimations[animIdx];
|
||||
mozilla::ElementAnimation* anim = aAnimations[animIdx];
|
||||
if (!(anim->HasAnimationOfProperty(aProperty) &&
|
||||
anim->IsRunningAt(currentTime))) {
|
||||
continue;
|
||||
|
|
|
@ -391,7 +391,7 @@ nsLayoutUtils::ComputeSuitableScaleForAnimation(nsIContent* aContent)
|
|||
(aContent, nsGkAtoms::animationsProperty, eCSSProperty_transform);
|
||||
if (animations) {
|
||||
for (uint32_t animIdx = animations->mAnimations.Length(); animIdx-- != 0; ) {
|
||||
mozilla::StyleAnimation* anim = animations->mAnimations[animIdx];
|
||||
mozilla::ElementAnimation* anim = animations->mAnimations[animIdx];
|
||||
for (uint32_t propIdx = anim->mProperties.Length(); propIdx-- != 0; ) {
|
||||
AnimationProperty& prop = anim->mProperties[propIdx];
|
||||
if (prop.mProperty == eCSSProperty_transform) {
|
||||
|
|
|
@ -363,7 +363,7 @@ ComputedTimingFunction::GetValue(double aPortion) const
|
|||
} /* end sub-namespace css */
|
||||
|
||||
bool
|
||||
StyleAnimation::IsRunningAt(TimeStamp aTime) const
|
||||
ElementAnimation::IsRunningAt(TimeStamp aTime) const
|
||||
{
|
||||
if (IsPaused() || mIterationDuration.ToMilliseconds() <= 0.0 ||
|
||||
mStartTime.IsNull()) {
|
||||
|
@ -375,7 +375,7 @@ StyleAnimation::IsRunningAt(TimeStamp aTime) const
|
|||
}
|
||||
|
||||
bool
|
||||
StyleAnimation::HasAnimationOfProperty(nsCSSProperty aProperty) const
|
||||
ElementAnimation::HasAnimationOfProperty(nsCSSProperty aProperty) const
|
||||
{
|
||||
for (uint32_t propIdx = 0, propEnd = mProperties.Length();
|
||||
propIdx != propEnd; ++propIdx) {
|
||||
|
|
|
@ -222,9 +222,9 @@ struct AnimationProperty
|
|||
* Data about one animation (i.e., one of the values of
|
||||
* 'animation-name') running on an element.
|
||||
*/
|
||||
struct StyleAnimation
|
||||
struct ElementAnimation
|
||||
{
|
||||
StyleAnimation()
|
||||
ElementAnimation()
|
||||
: mIsRunningOnCompositor(false)
|
||||
, mLastNotification(LAST_NOTIFICATION_NONE)
|
||||
{
|
||||
|
@ -279,10 +279,10 @@ struct StyleAnimation
|
|||
|
||||
InfallibleTArray<AnimationProperty> mProperties;
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(StyleAnimation)
|
||||
NS_INLINE_DECL_REFCOUNTING(ElementAnimation)
|
||||
};
|
||||
|
||||
typedef InfallibleTArray<nsRefPtr<StyleAnimation> > StyleAnimationPtrArray;
|
||||
typedef InfallibleTArray<nsRefPtr<ElementAnimation> > ElementAnimationPtrArray;
|
||||
|
||||
namespace css {
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ ElementAnimations::GetPositionInIteration(TimeDuration aElapsedDuration,
|
|||
TimeDuration aIterationDuration,
|
||||
double aIterationCount,
|
||||
uint32_t aDirection,
|
||||
StyleAnimation* aAnimation,
|
||||
ElementAnimation* aAnimation,
|
||||
ElementAnimations* aEa,
|
||||
EventArray* aEventsToDispatch)
|
||||
{
|
||||
|
@ -68,8 +68,8 @@ ElementAnimations::GetPositionInIteration(TimeDuration aElapsedDuration,
|
|||
if (aAnimation) {
|
||||
// Dispatch 'animationend' when needed.
|
||||
if (aAnimation->mLastNotification !=
|
||||
StyleAnimation::LAST_NOTIFICATION_END) {
|
||||
aAnimation->mLastNotification = StyleAnimation::LAST_NOTIFICATION_END;
|
||||
ElementAnimation::LAST_NOTIFICATION_END) {
|
||||
aAnimation->mLastNotification = ElementAnimation::LAST_NOTIFICATION_END;
|
||||
AnimationEventInfo ei(aEa->mElement, aAnimation->mName, NS_ANIMATION_END,
|
||||
aElapsedDuration, aEa->PseudoElement());
|
||||
aEventsToDispatch->AppendElement(ei);
|
||||
|
@ -149,7 +149,7 @@ ElementAnimations::GetPositionInIteration(TimeDuration aElapsedDuration,
|
|||
// immediately in many cases. It's not clear to me if that's the
|
||||
// right thing to do.
|
||||
uint32_t message =
|
||||
aAnimation->mLastNotification == StyleAnimation::LAST_NOTIFICATION_NONE
|
||||
aAnimation->mLastNotification == ElementAnimation::LAST_NOTIFICATION_NONE
|
||||
? NS_ANIMATION_START : NS_ANIMATION_ITERATION;
|
||||
|
||||
aAnimation->mLastNotification = whichIteration;
|
||||
|
@ -179,7 +179,7 @@ ElementAnimations::EnsureStyleRuleFor(TimeStamp aRefreshTime,
|
|||
// the style recalculation if we find any.
|
||||
if (aIsThrottled) {
|
||||
for (uint32_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
|
||||
StyleAnimation* anim = mAnimations[animIdx];
|
||||
ElementAnimation* anim = mAnimations[animIdx];
|
||||
|
||||
if (anim->mProperties.Length() == 0 ||
|
||||
anim->mIterationDuration.ToMilliseconds() <= 0.0) {
|
||||
|
@ -205,7 +205,8 @@ ElementAnimations::EnsureStyleRuleFor(TimeStamp aRefreshTime,
|
|||
// changing.
|
||||
if (!anim->mIsRunningOnCompositor ||
|
||||
(anim->mLastNotification != oldLastNotification &&
|
||||
anim->mLastNotification == StyleAnimation::LAST_NOTIFICATION_END)) {
|
||||
anim->mLastNotification ==
|
||||
ElementAnimation::LAST_NOTIFICATION_END)) {
|
||||
aIsThrottled = false;
|
||||
break;
|
||||
}
|
||||
|
@ -230,7 +231,7 @@ ElementAnimations::EnsureStyleRuleFor(TimeStamp aRefreshTime,
|
|||
nsCSSPropertySet properties;
|
||||
|
||||
for (uint32_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
|
||||
StyleAnimation* anim = mAnimations[animIdx];
|
||||
ElementAnimation* anim = mAnimations[animIdx];
|
||||
|
||||
if (anim->mProperties.Length() == 0 ||
|
||||
anim->mIterationDuration.ToMilliseconds() <= 0.0) {
|
||||
|
@ -330,7 +331,7 @@ bool
|
|||
ElementAnimations::HasAnimationOfProperty(nsCSSProperty aProperty) const
|
||||
{
|
||||
for (uint32_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
|
||||
const StyleAnimation* anim = mAnimations[animIdx];
|
||||
const ElementAnimation* anim = mAnimations[animIdx];
|
||||
if (anim->HasAnimationOfProperty(aProperty)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -360,7 +361,7 @@ ElementAnimations::CanPerformOnCompositorThread(CanAnimateFlags aFlags) const
|
|||
TimeStamp now = frame->PresContext()->RefreshDriver()->MostRecentRefresh();
|
||||
|
||||
for (uint32_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
|
||||
const StyleAnimation* anim = mAnimations[animIdx];
|
||||
const ElementAnimation* anim = mAnimations[animIdx];
|
||||
for (uint32_t propIdx = 0, propEnd = anim->mProperties.Length();
|
||||
propIdx != propEnd; ++propIdx) {
|
||||
if (IsGeometricProperty(anim->mProperties[propIdx].mProperty) &&
|
||||
|
@ -374,7 +375,7 @@ ElementAnimations::CanPerformOnCompositorThread(CanAnimateFlags aFlags) const
|
|||
bool hasOpacity = false;
|
||||
bool hasTransform = false;
|
||||
for (uint32_t animIdx = mAnimations.Length(); animIdx-- != 0; ) {
|
||||
const StyleAnimation* anim = mAnimations[animIdx];
|
||||
const ElementAnimation* anim = mAnimations[animIdx];
|
||||
if (!anim->IsRunningAt(now)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -547,7 +548,7 @@ nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext,
|
|||
}
|
||||
|
||||
// build the animations list
|
||||
StyleAnimationPtrArray newAnimations;
|
||||
ElementAnimationPtrArray newAnimations;
|
||||
BuildAnimations(aStyleContext, newAnimations);
|
||||
|
||||
if (newAnimations.IsEmpty()) {
|
||||
|
@ -577,7 +578,7 @@ nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext,
|
|||
if (!ea->mAnimations.IsEmpty()) {
|
||||
for (uint32_t newIdx = 0, newEnd = newAnimations.Length();
|
||||
newIdx != newEnd; ++newIdx) {
|
||||
nsRefPtr<StyleAnimation> newAnim = newAnimations[newIdx];
|
||||
nsRefPtr<ElementAnimation> newAnim = newAnimations[newIdx];
|
||||
|
||||
// Find the matching animation with this name in the old list
|
||||
// of animations. Because of this code, they must all have
|
||||
|
@ -587,9 +588,9 @@ nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext,
|
|||
// different pause states, they, well, get what they deserve.
|
||||
// We'll use the last one since it's more likely to be the one
|
||||
// doing something.
|
||||
const StyleAnimation* oldAnim = nullptr;
|
||||
const ElementAnimation* oldAnim = nullptr;
|
||||
for (uint32_t oldIdx = ea->mAnimations.Length(); oldIdx-- != 0; ) {
|
||||
const StyleAnimation* a = ea->mAnimations[oldIdx];
|
||||
const ElementAnimation* a = ea->mAnimations[oldIdx];
|
||||
if (a->mName == newAnim->mName) {
|
||||
oldAnim = a;
|
||||
break;
|
||||
|
@ -717,7 +718,7 @@ ResolvedStyleCache::Get(nsPresContext *aPresContext,
|
|||
|
||||
void
|
||||
nsAnimationManager::BuildAnimations(nsStyleContext* aStyleContext,
|
||||
StyleAnimationPtrArray& aAnimations)
|
||||
ElementAnimationPtrArray& aAnimations)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(aAnimations.IsEmpty(), "expect empty array");
|
||||
|
||||
|
@ -728,8 +729,8 @@ nsAnimationManager::BuildAnimations(nsStyleContext* aStyleContext,
|
|||
for (uint32_t animIdx = 0, animEnd = disp->mAnimationNameCount;
|
||||
animIdx != animEnd; ++animIdx) {
|
||||
const nsAnimation& src = disp->mAnimations[animIdx];
|
||||
nsRefPtr<StyleAnimation> dest =
|
||||
*aAnimations.AppendElement(new StyleAnimation());
|
||||
nsRefPtr<ElementAnimation> dest =
|
||||
*aAnimations.AppendElement(new ElementAnimation());
|
||||
|
||||
dest->mName = src.GetName();
|
||||
dest->mIterationCount = src.GetIterationCount();
|
||||
|
|
|
@ -66,7 +66,7 @@ struct ElementAnimations MOZ_FINAL
|
|||
// This way of calling the function can be used from the compositor. Note
|
||||
// that if the animation has not started yet, has already ended, or is paused,
|
||||
// it should not be run from the compositor. When this function is called
|
||||
// from the main thread, we need the actual StyleAnimation* in order to
|
||||
// from the main thread, we need the actual ElementAnimation* in order to
|
||||
// get correct animation-fill behavior and to fire animation events.
|
||||
// This function returns -1 for the position if the animation should not be
|
||||
// run (because it is not currently active and has no fill behavior), but
|
||||
|
@ -78,7 +78,7 @@ struct ElementAnimations MOZ_FINAL
|
|||
TimeDuration aIterationDuration,
|
||||
double aIterationCount,
|
||||
uint32_t aDirection,
|
||||
mozilla::StyleAnimation* aAnimation =
|
||||
mozilla::ElementAnimation* aAnimation =
|
||||
nullptr,
|
||||
ElementAnimations* aEa = nullptr,
|
||||
EventArray* aEventsToDispatch = nullptr);
|
||||
|
@ -127,7 +127,7 @@ struct ElementAnimations MOZ_FINAL
|
|||
// either completed or paused). May be invalidated by a style change.
|
||||
bool mNeedsRefreshes;
|
||||
|
||||
mozilla::StyleAnimationPtrArray mAnimations;
|
||||
mozilla::ElementAnimationPtrArray mAnimations;
|
||||
};
|
||||
|
||||
class nsAnimationManager MOZ_FINAL
|
||||
|
@ -236,7 +236,7 @@ protected:
|
|||
|
||||
private:
|
||||
void BuildAnimations(nsStyleContext* aStyleContext,
|
||||
mozilla::StyleAnimationPtrArray& aAnimations);
|
||||
mozilla::ElementAnimationPtrArray& aAnimations);
|
||||
bool BuildSegment(InfallibleTArray<mozilla::AnimationPropertySegment>&
|
||||
aSegments,
|
||||
nsCSSProperty aProperty, const nsAnimation& aAnimation,
|
||||
|
|
|
@ -23,7 +23,7 @@ struct ElementDependentRuleProcessorData;
|
|||
* Per-Element data *
|
||||
*****************************************************************************/
|
||||
|
||||
struct ElementPropertyTransition : public mozilla::StyleAnimation
|
||||
struct ElementPropertyTransition : public mozilla::ElementAnimation
|
||||
{
|
||||
// This is the start value to be used for a check for whether a
|
||||
// transition is being reversed. Normally the same as
|
||||
|
@ -49,7 +49,7 @@ struct ElementPropertyTransition : public mozilla::StyleAnimation
|
|||
|
||||
bool IsRemovedSentinel() const
|
||||
{
|
||||
// Note that mozilla::StyleAnimation::IsRunningAt depends on removed
|
||||
// Note that mozilla::ElementAnimation::IsRunningAt depends on removed
|
||||
// sentinels being represented by a null mStartTime.
|
||||
return mStartTime.IsNull();
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче