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

Side by Side Diff: Source/core/animation/AnimationPlayer.cpp

Issue 210363007: Declare onFinish event handler for AnimationPlayer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use ContextLifecycleObserver Created 6 years, 8 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
« no previous file with comments | « Source/core/animation/AnimationPlayer.h ('k') | Source/core/animation/AnimationPlayer.idl » ('j') | 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 28 matching lines...) Expand all
39 namespace { 39 namespace {
40 40
41 static unsigned nextSequenceNumber() 41 static unsigned nextSequenceNumber()
42 { 42 {
43 static unsigned next = 0; 43 static unsigned next = 0;
44 return ++next; 44 return ++next;
45 } 45 }
46 46
47 } 47 }
48 48
49 PassRefPtr<AnimationPlayer> AnimationPlayer::create(DocumentTimeline& timeline, TimedItem* content) 49 PassRefPtr<AnimationPlayer> AnimationPlayer::create(ExecutionContext* context, D ocumentTimeline& timeline, TimedItem* content)
50 { 50 {
51 return adoptRef(new AnimationPlayer(timeline, content)); 51 return adoptRef(new AnimationPlayer(context, timeline, content));
52 } 52 }
53 53
54 AnimationPlayer::AnimationPlayer(DocumentTimeline& timeline, TimedItem* content) 54 AnimationPlayer::AnimationPlayer(ExecutionContext* context, DocumentTimeline& ti meline, TimedItem* content)
55 : m_playbackRate(1) 55 : ContextLifecycleObserver(context)
56 , m_playbackRate(1)
56 , m_startTime(nullValue()) 57 , m_startTime(nullValue())
57 , m_holdTime(nullValue()) 58 , m_holdTime(nullValue())
58 , m_storedTimeLag(0) 59 , m_storedTimeLag(0)
59 , m_sortInfo(nextSequenceNumber(), timeline.effectiveTime()) 60 , m_sortInfo(nextSequenceNumber(), timeline.effectiveTime())
60 , m_content(content) 61 , m_content(content)
61 , m_timeline(&timeline) 62 , m_timeline(&timeline)
62 , m_paused(false) 63 , m_paused(false)
63 , m_held(false) 64 , m_held(false)
64 , m_isPausedForTesting(false) 65 , m_isPausedForTesting(false)
65 , m_outdated(false) 66 , m_outdated(false)
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 } else { 232 } else {
232 if (sourceEnd() == std::numeric_limits<double>::infinity()) { 233 if (sourceEnd() == std::numeric_limits<double>::infinity()) {
233 exceptionState.throwDOMException(InvalidStateError, "AnimationPlayer has source content whose end time is infinity."); 234 exceptionState.throwDOMException(InvalidStateError, "AnimationPlayer has source content whose end time is infinity.");
234 return; 235 return;
235 } 236 }
236 setCurrentTime(sourceEnd()); 237 setCurrentTime(sourceEnd());
237 } 238 }
238 ASSERT(finished()); 239 ASSERT(finished());
239 } 240 }
240 241
242 const AtomicString& AnimationPlayer::interfaceName() const
243 {
244 return EventTargetNames::AnimationPlayer;
245 }
246
247 ExecutionContext* AnimationPlayer::executionContext() const
248 {
249 return ContextLifecycleObserver::executionContext();
dstockwell 2014/03/31 09:17:24 Isn't the timeline's document the execution contex
Eric Willigers 2014/04/01 05:05:48 The execution context is document.contextDocument(
250 }
251
241 void AnimationPlayer::setPlaybackRate(double playbackRate) 252 void AnimationPlayer::setPlaybackRate(double playbackRate)
242 { 253 {
243 if (!std::isfinite(playbackRate)) 254 if (!std::isfinite(playbackRate))
244 return; 255 return;
245 double storedCurrentTime = currentTime(); 256 double storedCurrentTime = currentTime();
246 m_playbackRate = playbackRate; 257 m_playbackRate = playbackRate;
247 updateTimingState(storedCurrentTime); 258 updateTimingState(storedCurrentTime);
248 } 259 }
249 260
250 void AnimationPlayer::setOutdated() 261 void AnimationPlayer::setOutdated()
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 { 337 {
327 RELEASE_ASSERT(!paused()); 338 RELEASE_ASSERT(!paused());
328 updateTimingState(pauseTime); 339 updateTimingState(pauseTime);
329 if (!m_isPausedForTesting && hasActiveAnimationsOnCompositor()) 340 if (!m_isPausedForTesting && hasActiveAnimationsOnCompositor())
330 toAnimation(m_content.get())->pauseAnimationForTestingOnCompositor(curre ntTime()); 341 toAnimation(m_content.get())->pauseAnimationForTestingOnCompositor(curre ntTime());
331 m_isPausedForTesting = true; 342 m_isPausedForTesting = true;
332 pause(); 343 pause();
333 } 344 }
334 345
335 } // namespace 346 } // namespace
OLDNEW
« no previous file with comments | « Source/core/animation/AnimationPlayer.h ('k') | Source/core/animation/AnimationPlayer.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698