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

Unified Diff: Source/core/animation/css/CSSAnimationUpdate.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: Rebase and address comments Created 5 years, 11 months 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/CSSAnimationUpdate.h
diff --git a/Source/core/animation/css/CSSAnimationUpdate.h b/Source/core/animation/css/CSSAnimationUpdate.h
index 9ae2286f746dbd4b4e787f1ce25a9d8346e814a7..1db490af79e4825e457d5394afe2d1378147e5c1 100644
--- a/Source/core/animation/css/CSSAnimationUpdate.h
+++ b/Source/core/animation/css/CSSAnimationUpdate.h
@@ -6,6 +6,7 @@
#define CSSAnimationUpdate_h
#include "core/animation/Interpolation.h"
+#include "core/css/CSSKeyframesRule.h"
#include "wtf/HashMap.h"
#include "wtf/Vector.h"
#include "wtf/text/AtomicString.h"
@@ -19,12 +20,15 @@ class InertAnimation;
// 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& timing, PassRefPtrWillBeRawPtr<StyleRuleKeyframes> styleRule)
{
animation->setName(animationName);
NewAnimation newAnimation;
esprehn 2015/01/30 02:50:28 Since you're adding a constructor you can just pas
shend 2015/02/01 23:49:13 Done.
newAnimation.name = animationName;
newAnimation.animation = animation;
+ newAnimation.timing = timing;
+ newAnimation.styleRuleVersion = styleRule->version();
+ newAnimation.styleRule = styleRule;
m_newAnimations.append(newAnimation);
}
// Returns whether player has been suppressed and should be filtered during style application.
@@ -38,13 +42,17 @@ 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& specifiedTiming,
+ PassRefPtrWillBeRawPtr<StyleRuleKeyframes> styleRule)
{
- UpdatedAnimationTiming updatedAnimation;
+ UpdatedAnimation updatedAnimation;
esprehn 2015/01/30 02:50:28 ditto for the constructor.
shend 2015/02/01 23:49:13 Done.
+ updatedAnimation.name = name;
updatedAnimation.player = player;
updatedAnimation.animation = animation;
- updatedAnimation.newTiming = timing;
- m_animationsWithTimingUpdates.append(updatedAnimation);
+ updatedAnimation.specifiedTiming = specifiedTiming;
+ updatedAnimation.styleRuleVersion = styleRule->version();
+ updatedAnimation.styleRule = styleRule;
+ m_animationsWithUpdates.append(updatedAnimation);
m_suppressedAnimationPlayers.add(player);
}
@@ -65,6 +73,11 @@ public:
struct NewAnimation {
ALLOW_ONLY_INLINE_ALLOCATION();
public:
+ NewAnimation()
+ : styleRuleVersion(0)
+ {
+ }
+
void trace(Visitor* visitor)
{
visitor->trace(animation);
@@ -72,27 +85,39 @@ public:
AtomicString name;
RefPtrWillBeMember<InertAnimation> animation;
+ Timing timing;
+ RefPtrWillBeMember<StyleRuleKeyframes> styleRule;
+ unsigned styleRuleVersion;
};
- struct UpdatedAnimationTiming {
+ struct UpdatedAnimation {
ALLOW_ONLY_INLINE_ALLOCATION();
public:
+ UpdatedAnimation()
+ : styleRuleVersion(0)
+ {
+ }
+
void trace(Visitor* visitor)
{
visitor->trace(player);
visitor->trace(animation);
+ visitor->trace(styleRule);
}
+ AtomicString name;
RawPtrWillBeMember<AnimationPlayer> player;
RefPtrWillBeMember<InertAnimation> animation;
- Timing newTiming;
+ Timing specifiedTiming;
+ RefPtrWillBeMember<StyleRuleKeyframes> styleRule;
+ unsigned styleRuleVersion;
};
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();
@@ -126,7 +151,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()
@@ -144,7 +169,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;
@@ -156,6 +181,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