Chromium Code Reviews| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 } | 67 } |
| 68 | 68 |
| 69 void updateInheritedTime(double time, TimingUpdateReason reason) | 69 void updateInheritedTime(double time, TimingUpdateReason reason) |
| 70 { | 70 { |
| 71 m_eventDelegate->reset(); | 71 m_eventDelegate->reset(); |
| 72 AnimationNode::updateInheritedTime(time, reason); | 72 AnimationNode::updateInheritedTime(time, reason); |
| 73 } | 73 } |
| 74 | 74 |
| 75 virtual void updateChildrenAndEffects() const OVERRIDE { } | 75 virtual void updateChildrenAndEffects() const OVERRIDE { } |
| 76 void willDetach() { } | 76 void willDetach() { } |
| 77 TestAnimationNodeEventDelegate* eventDelegate() { return m_eventDelegate; } | 77 TestAnimationNodeEventDelegate* eventDelegate() { return m_eventDelegate.get (); } |
| 78 virtual double calculateTimeToEffectChange(bool forwards, double localTime, double timeToNextIteration) const OVERRIDE | 78 virtual double calculateTimeToEffectChange(bool forwards, double localTime, double timeToNextIteration) const OVERRIDE |
| 79 { | 79 { |
| 80 m_localTime = localTime; | 80 m_localTime = localTime; |
| 81 m_timeToNextIteration = timeToNextIteration; | 81 m_timeToNextIteration = timeToNextIteration; |
| 82 return -1; | 82 return -1; |
| 83 } | 83 } |
| 84 double takeLocalTime() | 84 double takeLocalTime() |
| 85 { | 85 { |
| 86 const double result = m_localTime; | 86 const double result = m_localTime; |
| 87 m_localTime = nullValue(); | 87 m_localTime = nullValue(); |
| 88 return result; | 88 return result; |
| 89 } | 89 } |
| 90 | 90 |
| 91 double takeTimeToNextIteration() | 91 double takeTimeToNextIteration() |
| 92 { | 92 { |
| 93 const double result = m_timeToNextIteration; | 93 const double result = m_timeToNextIteration; |
| 94 m_timeToNextIteration = nullValue(); | 94 m_timeToNextIteration = nullValue(); |
| 95 return result; | 95 return result; |
| 96 } | 96 } |
| 97 | 97 |
| 98 void trace(Visitor* visitor) OVERRIDE | |
|
tkent
2014/07/28 23:36:19
This should be virtual, and call AnimationNode::tr
haraken
2014/07/28 23:53:24
Done.
| |
| 99 { | |
| 100 visitor->trace(m_eventDelegate); | |
| 101 } | |
| 102 | |
| 98 private: | 103 private: |
| 99 TestAnimationNode(const Timing& specified, TestAnimationNodeEventDelegate* e ventDelegate) | 104 TestAnimationNode(const Timing& specified, TestAnimationNodeEventDelegate* e ventDelegate) |
| 100 : AnimationNode(specified, adoptPtr(eventDelegate)) | 105 : AnimationNode(specified, adoptPtrWillBeNoop(eventDelegate)) |
| 101 , m_eventDelegate(eventDelegate) | 106 , m_eventDelegate(eventDelegate) |
| 102 { | 107 { |
| 103 } | 108 } |
| 104 | 109 |
| 105 TestAnimationNodeEventDelegate* m_eventDelegate; | 110 RawPtrWillBeMember<TestAnimationNodeEventDelegate> m_eventDelegate; |
| 106 mutable double m_localTime; | 111 mutable double m_localTime; |
| 107 mutable double m_timeToNextIteration; | 112 mutable double m_timeToNextIteration; |
| 108 }; | 113 }; |
| 109 | 114 |
| 110 TEST(AnimationAnimationNodeTest, Sanity) | 115 TEST(AnimationAnimationNodeTest, Sanity) |
| 111 { | 116 { |
| 112 Timing timing; | 117 Timing timing; |
| 113 timing.iterationDuration = 2; | 118 timing.iterationDuration = 2; |
| 114 RefPtrWillBeRawPtr<TestAnimationNode> animationNode = TestAnimationNode::cre ate(timing); | 119 RefPtrWillBeRawPtr<TestAnimationNode> animationNode = TestAnimationNode::cre ate(timing); |
| 115 | 120 |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 766 EXPECT_TRUE(std::isinf(animationNode->takeTimeToNextIteration())); | 771 EXPECT_TRUE(std::isinf(animationNode->takeTimeToNextIteration())); |
| 767 | 772 |
| 768 // Item has finished. | 773 // Item has finished. |
| 769 animationNode->updateInheritedTime(3.5); | 774 animationNode->updateInheritedTime(3.5); |
| 770 EXPECT_EQ(AnimationNode::PhaseAfter, animationNode->phase()); | 775 EXPECT_EQ(AnimationNode::PhaseAfter, animationNode->phase()); |
| 771 EXPECT_EQ(3.5, animationNode->takeLocalTime()); | 776 EXPECT_EQ(3.5, animationNode->takeLocalTime()); |
| 772 EXPECT_TRUE(std::isinf(animationNode->takeTimeToNextIteration())); | 777 EXPECT_TRUE(std::isinf(animationNode->takeTimeToNextIteration())); |
| 773 } | 778 } |
| 774 | 779 |
| 775 } | 780 } |
| OLD | NEW |