| OLD | NEW |
| 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 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef Player_h | 31 #ifndef Player_h |
| 32 #define Player_h | 32 #define Player_h |
| 33 | 33 |
| 34 #include "CSSPropertyNames.h" |
| 34 #include "core/animation/TimedItem.h" | 35 #include "core/animation/TimedItem.h" |
| 35 #include "wtf/RefPtr.h" | 36 #include "wtf/RefPtr.h" |
| 36 | 37 |
| 37 namespace WebCore { | 38 namespace WebCore { |
| 38 | 39 |
| 39 class DocumentTimeline; | 40 class DocumentTimeline; |
| 41 class Element; |
| 40 | 42 |
| 41 class Player FINAL : public RefCounted<Player> { | 43 class Player FINAL : public RefCounted<Player> { |
| 42 | 44 |
| 43 public: | 45 public: |
| 44 ~Player(); | 46 ~Player(); |
| 45 static PassRefPtr<Player> create(DocumentTimeline&, TimedItem*); | 47 static PassRefPtr<Player> create(DocumentTimeline&, TimedItem*); |
| 46 | 48 |
| 49 static double effectiveTime(double time) { return isNull(time) ? 0 : time; } |
| 50 |
| 47 // Returns whether this player is still current or in effect. | 51 // Returns whether this player is still current or in effect. |
| 48 // timeToEffectChange returns: | 52 // timeToEffectChange returns: |
| 49 // infinity - if this player is no longer in effect | 53 // infinity - if this player is no longer in effect |
| 50 // 0 - if this player requires an update on the next frame | 54 // 0 - if this player requires an update on the next frame |
| 51 // n - if this player requires an update after 'n' units of time | 55 // n - if this player requires an update after 'n' units of time |
| 52 bool update(double* timeToEffectChange = 0, bool* didTriggerStyleRecalc = 0)
; | 56 bool update(double* timeToEffectChange = 0, bool* didTriggerStyleRecalc = 0)
; |
| 53 void cancel(); | 57 void cancel(); |
| 54 | 58 |
| 55 double currentTime() const; | 59 double currentTime() const; |
| 56 void setCurrentTime(double); | 60 void setCurrentTime(double); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 68 void setStartTime(double); | 72 void setStartTime(double); |
| 69 | 73 |
| 70 TimedItem* source() { return m_content.get(); } | 74 TimedItem* source() { return m_content.get(); } |
| 71 | 75 |
| 72 // Pausing via this method is not reflected in the value returned by | 76 // Pausing via this method is not reflected in the value returned by |
| 73 // paused() and must never overlap with pausing via setPaused(). | 77 // paused() and must never overlap with pausing via setPaused(). |
| 74 void pauseForTesting(); | 78 void pauseForTesting(); |
| 75 // Reflects all pausing, including via pauseForTesting(). | 79 // Reflects all pausing, including via pauseForTesting(). |
| 76 bool pausedInternal() const { return !isNull(m_pauseStartTime); } | 80 bool pausedInternal() const { return !isNull(m_pauseStartTime); } |
| 77 | 81 |
| 82 bool isCandidateForCompositorAnimation() const; |
| 83 bool startCompositorAnimations(); |
| 84 bool isRunningCompositorAnimation(const Element* = 0, CSSPropertyID = CSSPro
pertyInvalid); |
| 85 void cancelCompositorAnimations(); |
| 86 |
| 78 private: | 87 private: |
| 79 Player(DocumentTimeline&, TimedItem*); | 88 Player(DocumentTimeline&, TimedItem*); |
| 80 inline double pausedTimeDrift() const; | 89 inline double pausedTimeDrift() const; |
| 81 inline double currentTimeBeforeDrift() const; | 90 inline double currentTimeBeforeDrift() const; |
| 82 | 91 |
| 83 void setPausedImpl(bool); | 92 void setPausedImpl(bool); |
| 84 | 93 |
| 85 double m_pauseStartTime; | 94 double m_pauseStartTime; |
| 86 double m_playbackRate; | 95 double m_playbackRate; |
| 87 double m_timeDrift; | 96 double m_timeDrift; |
| 88 double m_startTime; | 97 double m_startTime; |
| 89 | 98 |
| 90 RefPtr<TimedItem> m_content; | 99 RefPtr<TimedItem> m_content; |
| 91 DocumentTimeline& m_timeline; | 100 DocumentTimeline& m_timeline; |
| 92 bool m_isPausedForTesting; | 101 bool m_isPausedForTesting; |
| 93 }; | 102 }; |
| 94 | 103 |
| 95 } // namespace | 104 } // namespace |
| 96 | 105 |
| 97 #endif | 106 #endif |
| OLD | NEW |