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

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

Issue 25079006: Update CSSAnimationUpdate and CSSAnimations to handle multiple animations with a given name (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Minor fixes Created 7 years, 3 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/CSSAnimations.h
diff --git a/Source/core/animation/css/CSSAnimations.h b/Source/core/animation/css/CSSAnimations.h
index f59b8f6c8cbcd5301805adead5e8f513b985dba2..5b5ecf1bd9bae80a2459446b0b23594c0d5cbf36 100644
--- a/Source/core/animation/css/CSSAnimations.h
+++ b/Source/core/animation/css/CSSAnimations.h
@@ -60,28 +60,32 @@ private:
class CSSAnimationUpdate FINAL {
public:
- void startAnimation(AtomicString& animationName, PassRefPtr<InertAnimation> animation)
+ void startAnimation(AtomicString& animationName, const HashSet<RefPtr<InertAnimation> >& animations)
{
NewAnimation newAnimation;
newAnimation.name = animationName;
- newAnimation.animation = animation;
+ newAnimation.animations = animations;
m_newAnimations.append(newAnimation);
}
// Returns whether player has been cancelled and should be filtered during style application.
bool isCancelled(const Player* player) const { return m_cancelledAnimationPlayers.contains(player); }
- void cancelAnimation(const AtomicString& name, const Player* player)
+ void cancelAnimation(const AtomicString& name, const HashSet<RefPtr<Player> >& players)
{
m_cancelledAnimationNames.append(name);
- m_cancelledAnimationPlayers.add(player);
+ for (HashSet<RefPtr<Player> >::const_iterator iter = players.begin(); iter != players.end(); ++iter)
+ m_cancelledAnimationPlayers.add(iter->get());
}
struct NewAnimation {
AtomicString name;
- RefPtr<InertAnimation> animation;
+ HashSet<RefPtr<InertAnimation> > animations;
};
const Vector<NewAnimation>& newAnimations() const { return m_newAnimations; }
const Vector<AtomicString>& cancelledAnimationNames() const { return m_cancelledAnimationNames; }
private:
- // Order is significant since it defines the order in which new animations will be started.
+ // Order is significant since it defines the order in which new animations
+ // will be started. Note that there may be multiple animations present
+ // with the same name, due to the way in which we split up animations with
+ // incomplete keyframes.
Vector<NewAnimation> m_newAnimations;
Vector<AtomicString> m_cancelledAnimationNames;
HashSet<const Player*> m_cancelledAnimationPlayers;
@@ -97,7 +101,11 @@ public:
bool isEmpty() const { return m_animations.isEmpty() && !m_pendingUpdate; }
void cancel();
private:
- typedef HashMap<AtomicString, RefPtr<Player> > AnimationMap;
+ // Note that a single animation name may map to multiple players due to
+ // the way in which we split up animations with incomplete keyframes.
+ // FIXME: Once the Web Animations model supports groups, we could use a
+ // ParGroup to drive multiple animations from a single Player.
+ typedef HashMap<AtomicString, HashSet<RefPtr<Player> > > AnimationMap;
AnimationMap m_animations;
OwnPtr<CSSAnimationUpdate> m_pendingUpdate;
class EventDelegate FINAL : public TimedItem::EventDelegate {

Powered by Google App Engine
This is Rietveld 408576698