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

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

Issue 28263002: Plumb timeToNextEffect through players and animation (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 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
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 virtual ~EventDelegate() { }; 67 virtual ~EventDelegate() { };
68 virtual void onEventCondition(const TimedItem*, bool isFirstSample, Phas e previousPhase, double previousIteration) = 0; 68 virtual void onEventCondition(const TimedItem*, bool isFirstSample, Phas e previousPhase, double previousIteration) = 0;
69 }; 69 };
70 70
71 virtual ~TimedItem() { } 71 virtual ~TimedItem() { }
72 72
73 Phase phase() const { return ensureCalculated().phase; } 73 Phase phase() const { return ensureCalculated().phase; }
74 bool isCurrent() const { return ensureCalculated().isCurrent; } 74 bool isCurrent() const { return ensureCalculated().isCurrent; }
75 bool isInEffect() const { return ensureCalculated().isInEffect; } 75 bool isInEffect() const { return ensureCalculated().isInEffect; }
76 bool isInPlay() const { return ensureCalculated().isInPlay; } 76 bool isInPlay() const { return ensureCalculated().isInPlay; }
77 double timeToEffectChange() const { return ensureCalculated().timeToEffectCh ange; }
77 78
78 double startTime() const { return m_startTime; } 79 double startTime() const { return m_startTime; }
79 80
80 double currentIteration() const { return ensureCalculated().currentIteration ; } 81 double currentIteration() const { return ensureCalculated().currentIteration ; }
81 double activeDuration() const { return ensureCalculated().activeDuration; } 82 double activeDuration() const { return ensureCalculated().activeDuration; }
82 double timeFraction() const { return ensureCalculated().timeFraction; } 83 double timeFraction() const { return ensureCalculated().timeFraction; }
83 const Player* player() const { return m_player; } 84 const Player* player() const { return m_player; }
84 85
85 const Timing& specified() const { return m_specified; } 86 const Timing& specified() const { return m_specified; }
86 87
87 protected: 88 protected:
88 TimedItem(const Timing&, PassOwnPtr<EventDelegate> = nullptr); 89 TimedItem(const Timing&, PassOwnPtr<EventDelegate> = nullptr);
89 90
90 // When TimedItem receives a new inherited time via updateInheritedTime 91 // When TimedItem receives a new inherited time via updateInheritedTime
91 // it will (if necessary) recalculate timings and (if necessary) call 92 // it will (if necessary) recalculate timings and (if necessary) call
92 // updateChildrenAndEffects. 93 // updateChildrenAndEffects.
93 void updateInheritedTime(double inheritedTime) const; 94 void updateInheritedTime(double inheritedTime) const;
94 virtual void updateChildrenAndEffects(bool wasInEffect) const = 0; 95 virtual void updateChildrenAndEffects(bool wasInEffect) const = 0;
95 virtual double intrinsicIterationDuration() const { return 0; }; 96 virtual double intrinsicIterationDuration() const { return 0; };
96 virtual void willDetach() = 0; 97 virtual void willDetach() = 0;
98 virtual double calculateTimeToEffectChange(double inheritedTime, double acti veTime, Phase) const = 0;
Timothy Loh 2013/10/18 06:01:27 Can we make this private? I think protected-virtua
shans 2013/10/21 00:37:57 private-virtual disallows *any* access to the ance
97 99
98 private: 100 private:
99 void attach(Player* player) { m_player = player; }; 101 void attach(Player* player) { m_player = player; };
100 void detach() 102 void detach()
101 { 103 {
102 ASSERT(m_player); 104 ASSERT(m_player);
103 willDetach(); 105 willDetach();
104 m_player = 0; 106 m_player = 0;
105 }; 107 };
106 108
107 // FIXME: m_parent and m_startTime are placeholders, they depend on timing g roups. 109 // FIXME: m_parent and m_startTime are placeholders, they depend on timing g roups.
108 TimedItem* const m_parent; 110 TimedItem* const m_parent;
109 const double m_startTime; 111 const double m_startTime;
110 Player* m_player; 112 Player* m_player;
111 Timing m_specified; 113 Timing m_specified;
112 OwnPtr<EventDelegate> m_eventDelegate; 114 OwnPtr<EventDelegate> m_eventDelegate;
113 115
114 // FIXME: Should be versioned by monotonic value on player. 116 // FIXME: Should be versioned by monotonic value on player.
115 mutable struct CalculatedTiming { 117 mutable struct CalculatedTiming {
116 double activeDuration; 118 double activeDuration;
117 Phase phase; 119 Phase phase;
118 double currentIteration; 120 double currentIteration;
119 double timeFraction; 121 double timeFraction;
120 bool isCurrent; 122 bool isCurrent;
121 bool isInEffect; 123 bool isInEffect;
122 bool isInPlay; 124 bool isInPlay;
125 double timeToEffectChange;
123 } m_calculated; 126 } m_calculated;
124 mutable bool m_isFirstSample; 127 mutable bool m_isFirstSample;
125 128
126 // FIXME: Should check the version and reinherit time if inconsistent. 129 // FIXME: Should check the version and reinherit time if inconsistent.
127 const CalculatedTiming& ensureCalculated() const { return m_calculated; } 130 const CalculatedTiming& ensureCalculated() const { return m_calculated; }
128 }; 131 };
129 132
130 } // namespace WebCore 133 } // namespace WebCore
131 134
132 #endif 135 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698