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

Side by Side Diff: Source/core/animation/ElementAnimation.h

Issue 423763002: Animations: Fix bug where getAnimationPlayers() crashes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/web-animations-api/w3c/getAnimationPlayers.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 { 84 {
85 RefPtrWillBeRawPtr<AnimationEffect> effect = EffectInput::convert(&eleme nt, keyframeDictionaryVector, exceptionState); 85 RefPtrWillBeRawPtr<AnimationEffect> effect = EffectInput::convert(&eleme nt, keyframeDictionaryVector, exceptionState);
86 if (exceptionState.hadException()) 86 if (exceptionState.hadException())
87 return 0; 87 return 0;
88 ASSERT(effect); 88 ASSERT(effect);
89 return animateInternal(element, effect.release(), Timing()); 89 return animateInternal(element, effect.release(), Timing());
90 } 90 }
91 91
92 static WillBeHeapVector<RefPtrWillBeMember<AnimationPlayer> > getAnimationPl ayers(Element& element) 92 static WillBeHeapVector<RefPtrWillBeMember<AnimationPlayer> > getAnimationPl ayers(Element& element)
93 { 93 {
94 WillBeHeapVector<RefPtrWillBeMember<AnimationPlayer> > animationPlayers = WillBeHeapVector<RefPtrWillBeMember<AnimationPlayer> >(); 94 WillBeHeapVector<RefPtrWillBeMember<AnimationPlayer> > animationPlayers;
95
96 if (!element.hasActiveAnimations())
97 return animationPlayers;
98
95 const AnimationPlayerCountedSet& players = element.activeAnimations()->p layers(); 99 const AnimationPlayerCountedSet& players = element.activeAnimations()->p layers();
96 100
97 for (AnimationPlayerCountedSet::const_iterator it = players.begin(); it != players.end(); ++it) { 101 for (AnimationPlayerCountedSet::const_iterator it = players.begin(); it != players.end(); ++it) {
98 ASSERT(it->key->source()); 102 ASSERT(it->key->source());
99 if (it->key->source()->isCurrent()) 103 if (it->key->source()->isCurrent())
100 animationPlayers.append(it->key); 104 animationPlayers.append(it->key);
101 } 105 }
102 return animationPlayers; 106 return animationPlayers;
103 } 107 }
104 108
105 private: 109 private:
106 static AnimationPlayer* animateInternal(Element& element, PassRefPtrWillBeRa wPtr<AnimationEffect> effect, const Timing& timing) 110 static AnimationPlayer* animateInternal(Element& element, PassRefPtrWillBeRa wPtr<AnimationEffect> effect, const Timing& timing)
107 { 111 {
108 if (RuntimeEnabledFeatures::webAnimationsElementAnimateEnabled()) { 112 if (RuntimeEnabledFeatures::webAnimationsElementAnimateEnabled()) {
109 RefPtrWillBeRawPtr<Animation> animation = Animation::create(&element , effect, timing); 113 RefPtrWillBeRawPtr<Animation> animation = Animation::create(&element , effect, timing);
110 return element.document().timeline().play(animation.get()); 114 return element.document().timeline().play(animation.get());
111 } 115 }
112 return 0; 116 return 0;
113 } 117 }
114 }; 118 };
115 119
116 } // namespace blink 120 } // namespace blink
117 121
118 #endif // ElementAnimation_h 122 #endif // ElementAnimation_h
OLDNEW
« no previous file with comments | « LayoutTests/web-animations-api/w3c/getAnimationPlayers.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698