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

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

Issue 19266007: Web Animations: Introduce ActiveAnimations and AnimationStack (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased. Created 7 years, 5 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 | « Source/core/animation/Player.h ('k') | Source/core/animation/TimedItem.h » ('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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 Player::Player(DocumentTimeline* timeline, TimedItem* content) 46 Player::Player(DocumentTimeline* timeline, TimedItem* content)
47 : m_pauseStartTime(nullValue()) 47 : m_pauseStartTime(nullValue())
48 , m_playbackRate(1) 48 , m_playbackRate(1)
49 , m_timeDrift(0) 49 , m_timeDrift(0)
50 , m_startTime(effectiveTime(timeline->currentTime())) 50 , m_startTime(effectiveTime(timeline->currentTime()))
51 , m_content(content) 51 , m_content(content)
52 , m_timeline(timeline) 52 , m_timeline(timeline)
53 { 53 {
54 ASSERT(m_startTime >= 0); 54 ASSERT(m_startTime >= 0);
55 if (m_content)
56 m_content->attach(this);
55 update(); 57 update();
56 } 58 }
57 59
60 Player::~Player()
61 {
62 if (m_content)
63 m_content->detach();
64 }
65
58 double Player::currentTimeBeforeDrift() const 66 double Player::currentTimeBeforeDrift() const
59 { 67 {
60 return (effectiveTime(m_timeline->currentTime()) - m_startTime) * m_playback Rate; 68 return (effectiveTime(m_timeline->currentTime()) - m_startTime) * m_playback Rate;
61 } 69 }
62 70
63 double Player::pausedTimeDrift() const 71 double Player::pausedTimeDrift() const
64 { 72 {
65 ASSERT(paused()); 73 ASSERT(paused());
66 return currentTimeBeforeDrift() - m_pauseStartTime; 74 return currentTimeBeforeDrift() - m_pauseStartTime;
67 } 75 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 118 }
111 119
112 void Player::setPlaybackRate(double newRate) 120 void Player::setPlaybackRate(double newRate)
113 { 121 {
114 double previousTime = currentTime(); 122 double previousTime = currentTime();
115 m_playbackRate = newRate; 123 m_playbackRate = newRate;
116 setCurrentTime(previousTime); 124 setCurrentTime(previousTime);
117 } 125 }
118 126
119 } // namespace 127 } // namespace
OLDNEW
« no previous file with comments | « Source/core/animation/Player.h ('k') | Source/core/animation/TimedItem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698