Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(347)

Unified Diff: Source/core/animation/css/CSSAnimations.h

Issue 814083003: Update animation when changes in animation keyframes are detected. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Move change counters to CSSAnimations Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/animation/css/CSSAnimations.h
diff --git a/Source/core/animation/css/CSSAnimations.h b/Source/core/animation/css/CSSAnimations.h
index 3dab7d2eb68fb34572d79ceb2ed5d433cefb6a36..98a694a7d271dd260cec5184697c5bd037595135 100644
--- a/Source/core/animation/css/CSSAnimations.h
+++ b/Source/core/animation/css/CSSAnimations.h
@@ -55,12 +55,13 @@ class StyleRuleKeyframes;
// This includes updates to animations/transitions as well as the Interpolations to be applied.
class CSSAnimationUpdate final : public NoBaseWillBeGarbageCollectedFinalized<CSSAnimationUpdate> {
public:
- void startAnimation(const AtomicString& animationName, PassRefPtrWillBeRawPtr<InertAnimation> animation)
+ void startAnimation(const AtomicString& animationName, PassRefPtrWillBeRawPtr<InertAnimation> animation, const Timing& newTiming)
{
animation->setName(animationName);
NewAnimation newAnimation;
newAnimation.name = animationName;
newAnimation.animation = animation;
+ newAnimation.newTiming = newTiming;
m_newAnimations.append(newAnimation);
}
// Returns whether player has been suppressed and should be filtered during style application.
@@ -74,13 +75,15 @@ public:
{
m_animationsWithPauseToggled.append(name);
}
- void updateAnimationTiming(AnimationPlayer* player, PassRefPtrWillBeRawPtr<InertAnimation> animation, const Timing& timing)
+ void updateAnimation(const AtomicString& name, AnimationPlayer* player, PassRefPtrWillBeRawPtr<InertAnimation> animation, const Timing& newTiming, unsigned styleChangeCounter)
{
- UpdatedAnimationTiming updatedAnimation;
+ UpdatedAnimation updatedAnimation;
+ updatedAnimation.name = name;
updatedAnimation.player = player;
updatedAnimation.animation = animation;
- updatedAnimation.newTiming = timing;
- m_animationsWithTimingUpdates.append(updatedAnimation);
+ updatedAnimation.newTiming = newTiming;
+ updatedAnimation.styleChangeCounter = styleChangeCounter;
+ m_animationsWithUpdates.append(updatedAnimation);
m_suppressedAnimationPlayers.add(player);
}
@@ -108,9 +111,10 @@ public:
AtomicString name;
RefPtrWillBeMember<InertAnimation> animation;
+ Timing newTiming;
dstockwell 2014/12/29 23:16:33 Why newTiming rather than just timing?
shend 2014/12/30 00:03:40 Changed to just 'timing'. It was meant to differen
};
- struct UpdatedAnimationTiming {
+ struct UpdatedAnimation {
ALLOW_ONLY_INLINE_ALLOCATION();
public:
void trace(Visitor* visitor)
@@ -119,16 +123,18 @@ public:
visitor->trace(animation);
}
+ AtomicString name;
RawPtrWillBeMember<AnimationPlayer> player;
RefPtrWillBeMember<InertAnimation> animation;
Timing newTiming;
+ unsigned styleChangeCounter;
};
const WillBeHeapVector<NewAnimation>& newAnimations() const { return m_newAnimations; }
const Vector<AtomicString>& cancelledAnimationNames() const { return m_cancelledAnimationNames; }
const WillBeHeapHashSet<RawPtrWillBeMember<const AnimationPlayer>>& suppressedAnimationAnimationPlayers() const { return m_suppressedAnimationPlayers; }
const Vector<AtomicString>& animationsWithPauseToggled() const { return m_animationsWithPauseToggled; }
- const WillBeHeapVector<UpdatedAnimationTiming>& animationsWithTimingUpdates() const { return m_animationsWithTimingUpdates; }
+ const WillBeHeapVector<UpdatedAnimation>& animationsWithUpdates() const { return m_animationsWithUpdates; }
struct NewTransition {
ALLOW_ONLY_INLINE_ALLOCATION();
@@ -162,7 +168,7 @@ public:
&& m_cancelledAnimationNames.isEmpty()
&& m_suppressedAnimationPlayers.isEmpty()
&& m_animationsWithPauseToggled.isEmpty()
- && m_animationsWithTimingUpdates.isEmpty()
+ && m_animationsWithUpdates.isEmpty()
&& m_newTransitions.isEmpty()
&& m_cancelledTransitions.isEmpty()
&& m_activeInterpolationsForAnimations.isEmpty()
@@ -180,7 +186,7 @@ private:
Vector<AtomicString> m_cancelledAnimationNames;
WillBeHeapHashSet<RawPtrWillBeMember<const AnimationPlayer>> m_suppressedAnimationPlayers;
Vector<AtomicString> m_animationsWithPauseToggled;
- WillBeHeapVector<UpdatedAnimationTiming> m_animationsWithTimingUpdates;
+ WillBeHeapVector<UpdatedAnimation> m_animationsWithUpdates;
NewTransitionMap m_newTransitions;
HashSet<CSSPropertyID> m_cancelledTransitions;
@@ -215,6 +221,19 @@ public:
void trace(Visitor*);
private:
+ struct RunningAnimation {
+ ALLOW_ONLY_INLINE_ALLOCATION();
+ public:
+ void trace(Visitor* visitor)
+ {
+ visitor->trace(player);
+ }
+
+ RefPtrWillBeMember<AnimationPlayer> player;
+ Timing specifiedTiming;
+ unsigned styleChangeCounter;
+ };
+
struct RunningTransition {
ALLOW_ONLY_INLINE_ALLOCATION();
public:
@@ -230,7 +249,7 @@ private:
RawPtrWillBeMember<const AnimatableValue> to;
};
- using AnimationMap = WillBeHeapHashMap<AtomicString, RefPtrWillBeMember<AnimationPlayer>>;
+ using AnimationMap = WillBeHeapHashMap<AtomicString, RunningAnimation>;
AnimationMap m_animations;
using TransitionMap = WillBeHeapHashMap<CSSPropertyID, RunningTransition>;
@@ -290,6 +309,6 @@ private:
} // namespace blink
WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::CSSAnimationUpdate::NewAnimation);
-WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::CSSAnimationUpdate::UpdatedAnimationTiming);
+WTF_ALLOW_INIT_WITH_MEM_FUNCTIONS(blink::CSSAnimationUpdate::UpdatedAnimation);
#endif

Powered by Google App Engine
This is Rietveld 408576698