Commit 03887b30 authored by samli@chromium.org's avatar samli@chromium.org

Animations: Fix bug where getAnimationPlayers() crashes

ElementAnimation:getAnimationPlayers() crashes when it is called and no
animations have been previously created on the element.

BUG=396376

Review URL: https://codereview.chromium.org/423763002

git-svn-id: svn://svn.chromium.org/blink/trunk@179001 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 744f0cb4
......@@ -21,6 +21,8 @@ var element = document.getElementById('element');
test(function() {
assert_equals(document.timeline.getAnimationPlayers().length, 0);
assert_equals(container.getAnimationPlayers().length, 0);
assert_equals(element.getAnimationPlayers().length, 0);
var player = element.animate([], 1000);
assert_equals(document.timeline.getAnimationPlayers().length, 1);
......
......@@ -91,7 +91,11 @@ public:
static WillBeHeapVector<RefPtrWillBeMember<AnimationPlayer> > getAnimationPlayers(Element& element)
{
WillBeHeapVector<RefPtrWillBeMember<AnimationPlayer> > animationPlayers = WillBeHeapVector<RefPtrWillBeMember<AnimationPlayer> >();
WillBeHeapVector<RefPtrWillBeMember<AnimationPlayer> > animationPlayers;
if (!element.hasActiveAnimations())
return animationPlayers;
const AnimationPlayerCountedSet& players = element.activeAnimations()->players();
for (AnimationPlayerCountedSet::const_iterator it = players.begin(); it != players.end(); ++it) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment