| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "sky/engine/config.h" | 5 #include "sky/engine/config.h" |
| 6 #include "sky/engine/core/animation/AnimationNodeTiming.h" | 6 #include "sky/engine/core/animation/AnimationNodeTiming.h" |
| 7 | 7 |
| 8 #include "sky/engine/core/animation/Animation.h" | 8 #include "sky/engine/core/animation/Animation.h" |
| 9 #include "sky/engine/core/animation/AnimationNode.h" | 9 #include "sky/engine/core/animation/AnimationNode.h" |
| 10 #include "sky/engine/platform/animation/TimingFunction.h" | 10 #include "sky/engine/platform/animation/TimingFunction.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 double AnimationNodeTiming::iterationStart() | 53 double AnimationNodeTiming::iterationStart() |
| 54 { | 54 { |
| 55 return m_parent->specifiedTiming().iterationStart; | 55 return m_parent->specifiedTiming().iterationStart; |
| 56 } | 56 } |
| 57 | 57 |
| 58 double AnimationNodeTiming::iterations() | 58 double AnimationNodeTiming::iterations() |
| 59 { | 59 { |
| 60 return m_parent->specifiedTiming().iterationCount; | 60 return m_parent->specifiedTiming().iterationCount; |
| 61 } | 61 } |
| 62 | 62 |
| 63 // This logic was copied from the example in bindings/tests/idls/TestInterface.i
dl | 63 String AnimationNodeTiming::getDuration(String propertyName) |
| 64 // and bindings/tests/results/V8TestInterface.cpp. | |
| 65 // FIXME: It might be possible to have 'duration' defined as an attribute in the
idl. | |
| 66 // If possible, fix will be in a follow-up patch. | |
| 67 void AnimationNodeTiming::getDuration(String propertyName, Nullable<double>& ele
ment0, String& element1) | |
| 68 { | 64 { |
| 69 if (propertyName != "duration") | 65 if (propertyName != "duration") |
| 70 return; | 66 return String(); |
| 71 | 67 |
| 72 if (std::isnan(m_parent->specifiedTiming().iterationDuration)) { | 68 if (std::isnan(m_parent->specifiedTiming().iterationDuration)) |
| 73 element1 = "auto"; | 69 return "auto"; |
| 74 return; | 70 |
| 75 } | 71 return String::number(m_parent->specifiedTiming().iterationDuration * 1000); |
| 76 element0.set(m_parent->specifiedTiming().iterationDuration * 1000); | |
| 77 return; | |
| 78 } | 72 } |
| 79 | 73 |
| 80 double AnimationNodeTiming::playbackRate() | 74 double AnimationNodeTiming::playbackRate() |
| 81 { | 75 { |
| 82 return m_parent->specifiedTiming().playbackRate; | 76 return m_parent->specifiedTiming().playbackRate; |
| 83 } | 77 } |
| 84 | 78 |
| 85 String AnimationNodeTiming::direction() | 79 String AnimationNodeTiming::direction() |
| 86 { | 80 { |
| 87 Timing::PlaybackDirection direction = m_parent->specifiedTiming().direction; | 81 Timing::PlaybackDirection direction = m_parent->specifiedTiming().direction; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 } | 158 } |
| 165 | 159 |
| 166 void AnimationNodeTiming::setEasing(String easing) | 160 void AnimationNodeTiming::setEasing(String easing) |
| 167 { | 161 { |
| 168 Timing timing = m_parent->specifiedTiming(); | 162 Timing timing = m_parent->specifiedTiming(); |
| 169 TimingInput::setTimingFunction(timing, easing); | 163 TimingInput::setTimingFunction(timing, easing); |
| 170 m_parent->updateSpecifiedTiming(timing); | 164 m_parent->updateSpecifiedTiming(timing); |
| 171 } | 165 } |
| 172 | 166 |
| 173 } // namespace blink | 167 } // namespace blink |
| OLD | NEW |